Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/99355
Change subject: Break long lines in media related classes
......................................................................
Break long lines in media related classes
Change-Id: I94653b4cde14f75180dae795d1fdaa1b073ec1d1
---
M includes/media/Bitmap.php
M includes/media/BitmapMetadataHandler.php
M includes/media/DjVuImage.php
M includes/media/Exif.php
M includes/media/FormatMetadata.php
M includes/media/ImageHandler.php
M includes/media/Jpeg.php
M includes/media/JpegMetadataExtractor.php
M includes/media/MediaTransformOutput.php
M includes/media/SVGMetadataExtractor.php
M includes/media/XCF.php
M includes/media/XMP.php
M includes/media/XMPInfo.php
13 files changed, 172 insertions(+), 69 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/55/99355/1
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index f50c3e5..6f7130d 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -57,7 +57,11 @@
# Check if the file is smaller than the maximum image area for
thumbnailing
$checkImageAreaHookResult = null;
- wfRunHooks( 'BitmapHandlerCheckImageArea', array( $image,
&$params, &$checkImageAreaHookResult ) );
+ wfRunHooks(
+ 'BitmapHandlerCheckImageArea',
+ array( $image, &$params, &$checkImageAreaHookResult )
+ );
+
if ( is_null( $checkImageAreaHookResult ) ) {
global $wgMaxImageArea;
@@ -137,7 +141,8 @@
# Determine scaler type
$scaler = self::getScalerType( $dstPath );
- wfDebug( __METHOD__ . ": creating
{$scalerParams['physicalDimensions']} thumbnail at $dstPath using scaler
$scaler\n" );
+ wfDebug( __METHOD__ . ": creating
{$scalerParams['physicalDimensions']} " .
+ "thumbnail at $dstPath using scaler $scaler\n" );
if ( !$image->mustRender() &&
$scalerParams['physicalWidth'] ==
$scalerParams['srcWidth']
@@ -168,7 +173,8 @@
# Try to make a target path for the thumbnail
if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) )
{
- wfDebug( __METHOD__ . ": Unable to create thumbnail
destination directory, falling back to client scaling\n" );
+ wfDebug( __METHOD__ . ": Unable to create thumbnail
destination " .
+ "directory, falling back to client scaling\n" );
return $this->getClientScalingThumbnailImage( $image,
$scalerParams );
}
@@ -530,7 +536,8 @@
$typemap = array(
'image/gif' => array( 'imagecreatefromgif', 'palette',
'imagegif' ),
- 'image/jpeg' => array( 'imagecreatefromjpeg',
'truecolor', array( __CLASS__, 'imageJpegWrapper' ) ),
+ 'image/jpeg' => array( 'imagecreatefromjpeg',
'truecolor',
+ array( __CLASS__, 'imageJpegWrapper' ) ),
'image/png' => array( 'imagecreatefrompng', 'bits',
'imagepng' ),
'image/vnd.wap.wbmp' => array( 'imagecreatefromwbmp',
'palette', 'imagewbmp' ),
'image/xbm' => array( 'imagecreatefromxbm', 'palette',
'imagexbm' ),
diff --git a/includes/media/BitmapMetadataHandler.php
b/includes/media/BitmapMetadataHandler.php
index f85f15e..1e9419b 100644
--- a/includes/media/BitmapMetadataHandler.php
+++ b/includes/media/BitmapMetadataHandler.php
@@ -197,7 +197,9 @@
$meta = new self();
$array = PNGMetadataExtractor::getMetadata( $filename );
- if ( isset( $array['text']['xmp']['x-default'] ) &&
$array['text']['xmp']['x-default'] !== '' && $showXMP ) {
+ if ( isset( $array['text']['xmp']['x-default'] )
+ && $array['text']['xmp']['x-default'] !== '' && $showXMP
+ ) {
$xmp = new XMPReader();
$xmp->parse( $array['text']['xmp']['x-default'] );
$xmpRes = $xmp->getResults();
diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php
index f201c28..9bfc378 100644
--- a/includes/media/DjVuImage.php
+++ b/includes/media/DjVuImage.php
@@ -84,7 +84,8 @@
function dump() {
$file = fopen( $this->mFilename, 'rb' );
$header = fread( $file, 12 );
- // @todo FIXME: Would be good to replace this extract() call
with something that explicitly initializes local variables.
+ // @todo FIXME: Would be good to replace this extract() call
with
+ // something that explicitly initializes local variables.
extract( unpack( 'a4magic/a4chunk/NchunkLength', $header ) );
echo "$chunk $chunkLength\n";
$this->dumpForm( $file, $chunkLength, 1 );
@@ -100,7 +101,8 @@
if ( $chunkHeader == '' ) {
break;
}
- // @todo FIXME: Would be good to replace this extract()
call with something that explicitly initializes local variables.
+ // @todo FIXME: Would be good to replace this extract()
call with
+ // something that explicitly initializes local
variables.
extract( unpack( 'a4chunk/NchunkLength', $chunkHeader )
);
echo str_repeat( ' ', $indent * 4 ) . "$chunk
$chunkLength\n";
@@ -132,7 +134,8 @@
if ( strlen( $header ) < 16 ) {
wfDebug( __METHOD__ . ": too short file header\n" );
} else {
- // @todo FIXME: Would be good to replace this extract()
call with something that explicitly initializes local variables.
+ // @todo FIXME: Would be good to replace this extract()
call with
+ // something that explicitly initializes local
variables.
extract( unpack(
'a4magic/a4form/NformLength/a4subtype', $header ) );
if ( $magic != 'AT&T' ) {
@@ -157,7 +160,8 @@
if ( strlen( $header ) < 8 ) {
return array( false, 0 );
} else {
- // @todo FIXME: Would be good to replace this extract()
call with something that explicitly initializes local variables.
+ // @todo FIXME: Would be good to replace this extract()
call with
+ // something that explicitly initializes local
variables.
extract( unpack( 'a4chunk/Nlength', $header ) );
return array( $chunk, $length );
@@ -222,7 +226,8 @@
return false;
}
- // @todo FIXME: Would be good to replace this extract() call
with something that explicitly initializes local variables.
+ // @todo FIXME: Would be good to replace this extract() call
with
+ // something that explicitly initializes local variables.
extract( unpack(
'nwidth/' .
'nheight/' .
@@ -381,7 +386,11 @@
break;
}
- if ( preg_match( '/^ *INFO *\[\d*\] *DjVu *(\d+)x(\d+),
*\w*, *(\d+) *dpi, *gamma=([0-9.-]+)/', $line, $m ) ) {
+ if ( preg_match(
+ '/^ *INFO *\[\d*\] *DjVu *(\d+)x(\d+), *\w*,
*(\d+) *dpi, *gamma=([0-9.-]+)/',
+ $line,
+ $m
+ ) ) {
$xml .= Xml::tags(
'OBJECT',
array(
diff --git a/includes/media/Exif.php b/includes/media/Exif.php
index 5f40fe9..a0d5e95 100644
--- a/includes/media/Exif.php
+++ b/includes/media/Exif.php
@@ -30,16 +30,41 @@
* @ingroup Media
*/
class Exif {
- const BYTE = 1; //!< An 8-bit (1-byte) unsigned integer.
- const ASCII = 2; //!< An 8-bit byte containing one 7-bit ASCII code.
The final byte is terminated with NULL.
- const SHORT = 3; //!< A 16-bit (2-byte) unsigned integer.
- const LONG = 4; //!< A 32-bit (4-byte) unsigned integer.
- const RATIONAL = 5; //!< Two LONGs. The first LONG is the numerator and
the second LONG expresses the denominator
- const SHORT_OR_LONG = 6; //!< A 16-bit (2-byte) or 32-bit (4-byte)
unsigned integer.
- const UNDEFINED = 7; //!< An 8-bit byte that can take any value
depending on the field definition
- const SLONG = 9; //!< A 32-bit (4-byte) signed integer (2's complement
notation),
- const SRATIONAL = 10; //!< Two SLONGs. The first SLONG is the numerator
and the second SLONG is the denominator.
- const IGNORE = -1; // A fake value for things we don't want or don't
support.
+ /** An 8-bit (1-byte) unsigned integer. */
+ const BYTE = 1;
+
+ /** An 8-bit byte containing one 7-bit ASCII code.
+ * The final byte is terminated with NULL.
+ */
+ const ASCII = 2;
+
+ /** A 16-bit (2-byte) unsigned integer. */
+ const SHORT = 3;
+
+ /** A 32-bit (4-byte) unsigned integer. */
+ const LONG = 4;
+
+ /** Two LONGs. The first LONG is the numerator and the second LONG
expresses
+ * the denominator
+ */
+ const RATIONAL = 5;
+
+ /** A 16-bit (2-byte) or 32-bit (4-byte) unsigned integer. */
+ const SHORT_OR_LONG = 6;
+
+ /** An 8-bit byte that can take any value depending on the field
definition */
+ const UNDEFINED = 7;
+
+ /** A 32-bit (4-byte) signed integer (2's complement notation), */
+ const SLONG = 9;
+
+ /** Two SLONGs. The first SLONG is the numerator and the second SLONG is
+ * the denominator.
+ */
+ const SRATIONAL = 10;
+
+ /** A fake value for things we don't want or don't support. */
+ const IGNORE = -1;
//@{
/* @var array
@@ -104,7 +129,8 @@
* Constructor
*
* @param string $file filename.
- * @param string $byteOrder Type of byte ordering either 'BE' (Big
Endian) or 'LE' (Little Endian). Default ''.
+ * @param string $byteOrder Type of byte ordering either 'BE' (Big
Endian)
+ * or 'LE' (Little Endian). Default ''.
* @throws MWException
* @todo FIXME: The following are broke:
* SubjectArea. Need to test the more obscure tags.
@@ -152,7 +178,8 @@
'TransferFunction' => Exif::IGNORE, # Transfer
function
'WhitePoint' => array( Exif::RATIONAL, 2 ), #
White point chromaticity
'PrimaryChromaticities' => array(
Exif::RATIONAL, 6 ), # Chromaticities of primarities
- 'YCbCrCoefficients' => array( Exif::RATIONAL, 3
), # Color space transformation matrix coefficients #p27
+ # Color space transformation matrix
coefficients #p27
+ 'YCbCrCoefficients' => array( Exif::RATIONAL, 3
),
'ReferenceBlackWhite' => array( Exif::RATIONAL,
6 ), # Pair of black and white reference values
# Other tags
@@ -302,7 +329,8 @@
$data = exif_read_data( $this->file, 0, true );
wfRestoreWarnings();
} else {
- throw new MWException( "Internal error: exif_read_data
not present. \$wgShowEXIF may be incorrectly set or not checked by an
extension." );
+ throw new MWException( "Internal error: exif_read_data
not present. " .
+ "\$wgShowEXIF may be incorrectly set or not
checked by an extension." );
}
/**
* exif_read_data() will return false on invalid input, such as
@@ -371,10 +399,12 @@
$this->exifGPStoNumber( 'GPSLongitude' );
$this->exifGPStoNumber( 'GPSDestLongitude' );
- if ( isset( $this->mFilteredExifData['GPSAltitude'] ) && isset(
$this->mFilteredExifData['GPSAltitudeRef'] ) ) {
-
- // We know altitude data is a <num>/<denom> from the
validation functions ran earlier.
- // But multiplying such a string by -1 doesn't work
well, so convert.
+ if ( isset( $this->mFilteredExifData['GPSAltitude'] )
+ && isset( $this->mFilteredExifData['GPSAltitudeRef'] )
+ ) {
+ // We know altitude data is a <num>/<denom> from the
validation
+ // functions ran earlier. But multiplying such a string
by -1
+ // doesn't work well, so convert.
list( $num, $denom ) = explode( '/',
$this->mFilteredExifData['GPSAltitude'] );
$this->mFilteredExifData['GPSAltitude'] = $num / $denom;
@@ -420,6 +450,7 @@
}
$newVal .= ord( substr( $val, $i, 1 ) );
}
+
if ( $this->byteOrder === 'LE' ) {
// Need to reverse the string
$newVal2 = '';
@@ -520,7 +551,9 @@
$dir =& $this->mFilteredExifData[$prop . 'Ref'];
$res = false;
- if ( isset( $loc ) && isset( $dir ) && ( $dir === 'N' || $dir
=== 'S' || $dir === 'E' || $dir === 'W' ) ) {
+ if ( isset( $loc ) && isset( $dir )
+ && ( $dir === 'N' || $dir === 'S' || $dir === 'E' ||
$dir === 'W' )
+ ) {
list( $num, $denom ) = explode( '/', $loc[0] );
$res = $num / $denom;
list( $num, $denom ) = explode( '/', $loc[1] );
@@ -693,7 +726,11 @@
*/
private function isRational( $in ) {
$m = array();
- if ( !is_array( $in ) && preg_match(
'/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
+
+ # Avoid division by zero
+ if ( !is_array( $in )
+ && preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in,
$m )
+ ) {
return $this->isLong( $m[1] ) && $this->isLong( $m[2] );
} else {
$this->debug( $in, __FUNCTION__, 'fed a non-fraction
value' );
@@ -734,7 +771,11 @@
*/
private function isSrational( $in ) {
$m = array();
- if ( !is_array( $in ) && preg_match(
'/^(-?\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
+
+ # Avoid division by zero
+ if ( !is_array( $in ) &&
+ preg_match( '/^(-?\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m
)
+ ) {
return $this->isSlong( $m[0] ) && $this->isSlong( $m[1]
);
} else {
$this->debug( $in, __FUNCTION__, 'fed a non-fraction
value' );
diff --git a/includes/media/FormatMetadata.php
b/includes/media/FormatMetadata.php
index fa0fa55..6bd3de2 100644
--- a/includes/media/FormatMetadata.php
+++ b/includes/media/FormatMetadata.php
@@ -43,7 +43,8 @@
* is already a large number of messages using the 'exif' prefix.
*
* @ingroup Media
- * @since 1.23 the class extends ContextSource and various formerly-public
internal methods are private
+ * @since 1.23 the class extends ContextSource and various formerly-public
+ * internal methods are private
*/
class FormatMetadata extends ContextSource {
/**
@@ -302,7 +303,10 @@
case 'DateTimeMetadata':
if ( $val == '0000:00:00
00:00:00' || $val == ' : : : : ' ) {
$val = $this->msg(
'exif-unknowndate' )->text();
- } elseif ( preg_match(
'/^(?:\d{4}):(?:\d\d):(?:\d\d) (?:\d\d):(?:\d\d):(?:\d\d)$/D', $val ) ) {
+ } elseif ( preg_match(
+
'/^(?:\d{4}):(?:\d\d):(?:\d\d) (?:\d\d):(?:\d\d):(?:\d\d)$/D',
+ $val
+ ) ) {
// Full date.
$time = wfTimestamp(
TS_MW, $val );
if ( $time && intval(
$time ) > 0 ) {
@@ -984,7 +988,9 @@
* @return String single value (in wiki-syntax).
* @since 1.23
*/
- public static function flattenArrayContentLang( $vals, $type = 'ul',
$noHtml = false, $context = false ) {
+ public static function flattenArrayContentLang( $vals, $type = 'ul',
+ $noHtml = false, $context = false
+ ) {
global $wgContLang;
$obj = new FormatMetadata;
if ( $context ) {
@@ -1651,7 +1657,8 @@
// If this is a remote file accessed via an API request, we
already
// have remote metadata so we just ignore any local one
if ( $file instanceof ForeignAPIFile ) {
- // in case of error we pretend no metadata - this will
get cached. Might or might not be a good idea.
+ // In case of error we pretend no metadata - this will
get cached.
+ // Might or might not be a good idea.
return $file->getExtendedMetadata() ?: array();
}
@@ -1710,7 +1717,9 @@
* @return array [<property name> => ['value' => <value>]], or [] on
error
* @since 1.23
*/
- protected function getExtendedMetadataFromHook( File $file, array
$extendedMetadata, &$maxCacheTime ) {
+ protected function getExtendedMetadataFromHook( File $file, array
$extendedMetadata,
+ &$maxCacheTime
+ ) {
wfProfileIn( __METHOD__ );
wfRunHooks( 'GetExtendedMetadata', array(
@@ -1856,8 +1865,13 @@
* @since 1.23
*/
protected function getPriorityLanguages() {
- $priorityLanguages =
Language::getFallbacksIncludingSiteLanguage( $this->getLanguage()->getCode() );
- $priorityLanguages = array_merge(
(array)$this->getLanguage()->getCode(), $priorityLanguages[0],
$priorityLanguages[1] );
+ $priorityLanguages =
+ Language::getFallbacksIncludingSiteLanguage(
$this->getLanguage()->getCode() );
+ $priorityLanguages = array_merge(
+ (array)$this->getLanguage()->getCode(),
+ $priorityLanguages[0],
+ $priorityLanguages[1]
+ );
return $priorityLanguages;
}
diff --git a/includes/media/ImageHandler.php b/includes/media/ImageHandler.php
index c319908..eecef1d 100644
--- a/includes/media/ImageHandler.php
+++ b/includes/media/ImageHandler.php
@@ -227,7 +227,8 @@
function getShortDesc( $file ) {
global $wgLang;
$nbytes = htmlspecialchars( $wgLang->formatSize(
$file->getSize() ) );
- $widthheight = wfMessage( 'widthheight' )->numParams(
$file->getWidth(), $file->getHeight() )->escaped();
+ $widthheight = wfMessage( 'widthheight' )
+ ->numParams( $file->getWidth(), $file->getHeight()
)->escaped();
return "$widthheight ($nbytes)";
}
@@ -260,9 +261,11 @@
function getDimensionsString( $file ) {
$pages = $file->pageCount();
if ( $pages > 1 ) {
- return wfMessage( 'widthheightpage' )->numParams(
$file->getWidth(), $file->getHeight(), $pages )->text();
+ return wfMessage( 'widthheightpage' )
+ ->numParams( $file->getWidth(),
$file->getHeight(), $pages )->text();
} else {
- return wfMessage( 'widthheight' )->numParams(
$file->getWidth(), $file->getHeight() )->text();
+ return wfMessage( 'widthheight' )
+ ->numParams( $file->getWidth(),
$file->getHeight() )->text();
}
}
}
diff --git a/includes/media/Jpeg.php b/includes/media/Jpeg.php
index ccbd544..213bee0 100644
--- a/includes/media/Jpeg.php
+++ b/includes/media/Jpeg.php
@@ -42,7 +42,8 @@
return serialize( $meta );
} catch ( MWException $e ) {
- // BitmapMetadataHandler throws an exception in certain
exceptional cases like if file does not exist.
+ // BitmapMetadataHandler throws an exception in certain
exceptional
+ // cases like if file does not exist.
wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
/* This used to use 0
(ExifBitmapHandler::OLD_BROKEN_FILE) for the cases
diff --git a/includes/media/JpegMetadataExtractor.php
b/includes/media/JpegMetadataExtractor.php
index 7763c6f..00be258 100644
--- a/includes/media/JpegMetadataExtractor.php
+++ b/includes/media/JpegMetadataExtractor.php
@@ -83,7 +83,8 @@
throw new MWException( 'Too many jpeg segments.
Aborting' );
}
if ( $buffer !== "\xFF" ) {
- throw new MWException( "Error reading jpeg file
marker. Expected 0xFF but got " . bin2hex( $buffer ) );
+ throw new MWException( "Error reading jpeg file
marker. " .
+ "Expected 0xFF but got " . bin2hex(
$buffer ) );
}
$buffer = fread( $fh, 1 );
diff --git a/includes/media/MediaTransformOutput.php
b/includes/media/MediaTransformOutput.php
index 494a495..fa9a729 100644
--- a/includes/media/MediaTransformOutput.php
+++ b/includes/media/MediaTransformOutput.php
@@ -345,7 +345,10 @@
'title' => empty( $options['title'] ) ?
$title->getFullText() : $options['title']
);
} elseif ( !empty( $options['desc-link'] ) ) {
- $linkAttribs = $this->getDescLinkAttribs( empty(
$options['title'] ) ? null : $options['title'], $query );
+ $linkAttribs = $this->getDescLinkAttribs(
+ empty( $options['title'] ) ? null :
$options['title'],
+ $query
+ );
} elseif ( !empty( $options['file-link'] ) ) {
$linkAttribs = array( 'href' => $this->file->getURL() );
} else {
diff --git a/includes/media/SVGMetadataExtractor.php
b/includes/media/SVGMetadataExtractor.php
index 15cf82d..d332c3f 100644
--- a/includes/media/SVGMetadataExtractor.php
+++ b/includes/media/SVGMetadataExtractor.php
@@ -151,7 +151,9 @@
$this->debug( "$tag" );
- if ( $isSVG && $tag == 'svg' && $type ==
XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) {
+ if ( $isSVG && $tag == 'svg' && $type ==
XmlReader::END_ELEMENT
+ && $this->reader->depth <= $exitDepth
+ ) {
break;
} elseif ( $isSVG && $tag == 'title' ) {
$this->readField( $tag, 'title' );
@@ -195,7 +197,10 @@
}
$keepReading = $this->reader->read();
while ( $keepReading ) {
- if ( $this->reader->localName == $name &&
$this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType ==
XmlReader::END_ELEMENT ) {
+ if ( $this->reader->localName == $name
+ && $this->reader->namespaceURI == self::NS_SVG
+ && $this->reader->nodeType ==
XmlReader::END_ELEMENT
+ ) {
break;
} elseif ( $this->reader->nodeType == XmlReader::TEXT )
{
$this->metadata[$metafield] = trim(
$this->reader->value );
@@ -219,7 +224,9 @@
if ( method_exists( $this->reader, 'readInnerXML' ) ) {
$this->metadata[$metafield] = trim(
$this->reader->readInnerXML() );
} else {
- throw new MWException( "The PHP XMLReader extension
does not come with readInnerXML() method. Your libxml is probably out of date
(need 2.6.20 or later)." );
+ throw new MWException( "The PHP XMLReader extension
does not come " .
+ "with readInnerXML() method. Your libxml is
probably out of " .
+ "date (need 2.6.20 or later)." );
}
$this->reader->next();
}
@@ -244,7 +251,9 @@
&& $this->reader->nodeType ==
XmlReader::END_ELEMENT
) {
break;
- } elseif ( $this->reader->namespaceURI == self::NS_SVG
&& $this->reader->nodeType == XmlReader::ELEMENT ) {
+ } elseif ( $this->reader->namespaceURI ==
+ self::NS_SVG && $this->reader->nodeType ==
XmlReader::ELEMENT
+ ) {
switch ( $this->reader->localName ) {
case 'script':
// Normally we disallow files
with
diff --git a/includes/media/XCF.php b/includes/media/XCF.php
index abf1f36..9f11ca7 100644
--- a/includes/media/XCF.php
+++ b/includes/media/XCF.php
@@ -121,7 +121,8 @@
}
# TODO: we might want to check for sane values of width and
height
- wfDebug( __METHOD__ . ": canvas size of '$filename' is
{$header['width']} x {$header['height']} px\n" );
+ wfDebug( __METHOD__ .
+ ": canvas size of '$filename' is {$header['width']} x
{$header['height']} px\n" );
# Forge a return array containing metadata information just
like getimagesize()
# See PHP documentation at: http://www.php.net/getimagesize
@@ -136,7 +137,8 @@
$metadata['channels'] = null;
$metadata['bits'] = 8; # Always 8-bits per color
- assert( '7 == count($metadata); # return array must contains 7
elements just like getimagesize() return' );
+ assert( '7 == count($metadata); ' .
+ '# return array must contains 7 elements just like
getimagesize() return' );
return $metadata;
}
diff --git a/includes/media/XMP.php b/includes/media/XMP.php
index 36e967e..d60b699 100644
--- a/includes/media/XMP.php
+++ b/includes/media/XMP.php
@@ -329,7 +329,8 @@
if ( !isset( $this->results['xmp-special']['HasExtendedXMP'] )
|| $this->results['xmp-special']['HasExtendedXMP'] !==
$guid
) {
- wfDebugLog( 'XMP', __METHOD__ . " Ignoring XMPExtended
block due to wrong guid (guid= '$guid')" );
+ wfDebugLog( 'XMP', __METHOD__ .
+ " Ignoring XMPExtended block due to wrong guid
(guid= '$guid')" );
return false;
}
@@ -341,14 +342,16 @@
return false;
}
- // we're not very robust here. we should accept it in the wrong
order. To quote
- // the xmp standard:
- // "A JPEG writer should write the ExtendedXMP marker segments
in order, immediately following the
- // StandardXMP. However, the JPEG standard does not require
preservation of marker segment order. A
- // robust JPEG reader should tolerate the marker segments in
any order."
+ // we're not very robust here. we should accept it in the wrong
order.
+ // To quote the XMP standard:
+ // "A JPEG writer should write the ExtendedXMP marker segments
in order,
+ // immediately following the StandardXMP. However, the JPEG
standard
+ // does not require preservation of marker segment order. A
robust JPEG
+ // reader should tolerate the marker segments in any order."
//
- // otoh the probability that an image will have more than 128k
of metadata is rather low...
- // so the probability that it will have > 128k, and be in the
wrong order is very low...
+ // otoh the probability that an image will have more than 128k
of
+ // metadata is rather low... so the probability that it will
have
+ // > 128k, and be in the wrong order is very low...
if ( $len['offset'] !== $this->extendedXMPOffset ) {
wfDebugLog( 'XMP', __METHOD__ . 'Ignoring XMPExtended
block due to wrong order. (Offset was '
@@ -494,7 +497,8 @@
&& !( $elm === self::NS_RDF . ' Description'
&& $this->mode[0] === self::MODE_STRUCT )
) {
- throw new MWException( "nesting mismatch. got a </$elm>
but expected a </" . $this->curItem[0] . '>' );
+ throw new MWException( "nesting mismatch. got a </$elm>
but expected a </" .
+ $this->curItem[0] . '>' );
}
// Validate structures.
@@ -796,7 +800,9 @@
throw new MWException( __METHOD__ . ' Encountered
<rdf:value> where it was unexpected.' );
} else {
// something else we don't recognize, like a qualifier
maybe.
- wfDebugLog( 'XMP', __METHOD__ . " Encountered element
<$elm> where only expecting character data as value of " . $this->curItem[0] );
+ wfDebugLog( 'XMP', __METHOD__ .
+ " Encountered element <$elm> where only
expecting character data as value of " .
+ $this->curItem[0] );
array_unshift( $this->mode, self::MODE_IGNORE );
array_unshift( $this->curItem, $elm );
}
@@ -917,7 +923,8 @@
if ( $this->charContent !== false ) {
// Something weird.
// Should not happen in valid XMP.
- throw new MWException( "tag <$tag>
nested in non-whitespace characters (" . $this->charContent . ")." );
+ throw new MWException( "tag <$tag>
nested in non-whitespace characters (" .
+ $this->charContent . ")." );
}
} else {
array_unshift( $this->mode, self::MODE_IGNORE );
@@ -1120,7 +1127,6 @@
* @throws MWException
*/
private function doAttribs( $attribs ) {
-
// first check for rdf:parseType attribute, as that can change
// how the attributes are interperted.
diff --git a/includes/media/XMPInfo.php b/includes/media/XMPInfo.php
index 03d8505..d57af5d 100644
--- a/includes/media/XMPInfo.php
+++ b/includes/media/XMPInfo.php
@@ -53,13 +53,18 @@
* each containing an array of tags
* each tag is an array of information about the
* tag, including:
- * * map_group - what group (used for precedence during conflicts)
- * * mode - What type of item (self::MODE_SIMPLE usually, see
above for all values)
- * * validate - method to validate input. Could also post-process
the input. A string value is assumed to be a static method of XMPValidate. Can
also take a array( 'className', 'methodName' ).
- * * choices - array of potential values (format of 'value' =>
true ). Only used with validateClosed
- * * rangeLow and rangeHigh - alternative to choices for numeric
ranges. Again for validateClosed only.
- * * children - for MODE_STRUCT items, allowed children.
- * * structPart - Indicates that this element can only appear as a
member of a structure.
+ * * map_group - what group (used for precedence during conflicts)
+ * * mode - What type of item (self::MODE_SIMPLE usually, see above
+ * for all values)
+ * * validate - method to validate input. Could also post-process the
+ * input. A string value is assumed to be a static method of
+ * XMPValidate. Can also take a array( 'className', 'methodName' ).
+ * * choices - array of potential values (format of 'value' => true
).
+ * Only used with validateClosed
+ * * rangeLow and rangeHigh - alternative to choices for numeric
ranges.
+ * Again for validateClosed only.
+ * * children - for MODE_STRUCT items, allowed children.
+ * * structPart - Indicates that this element can only appear as a
member of a structure.
*
* currently this just has a bunch of exif values as this class is only
half-done
*/
--
To view, visit https://gerrit.wikimedia.org/r/99355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94653b4cde14f75180dae795d1fdaa1b073ec1d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits