dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cache: Make APCUBagOStuff::set return a useful value
[lhc/web/wiklou.git]
/
includes
/
media
/
FormatMetadata.php
diff --git
a/includes/media/FormatMetadata.php
b/includes/media/FormatMetadata.php
index
b008a22
..
345b3cb
100644
(file)
--- a/
includes/media/FormatMetadata.php
+++ b/
includes/media/FormatMetadata.php
@@
-20,7
+20,7
@@
* @ingroup Media
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
* @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason, 2009 Brent Garber, 2010 Brian Wolff
* @ingroup Media
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
* @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason, 2009 Brent Garber, 2010 Brian Wolff
- * @license
http://www.gnu.org/copyleft/gpl.html GNU General Public License
+ * @license
GPL-2.0-or-later
* @see http://exif.org/Exif2-2.PDF The Exif 2.2 specification
* @file
*/
* @see http://exif.org/Exif2-2.PDF The Exif 2.2 specification
* @file
*/
@@
-271,7
+271,7
@@
class FormatMetadata extends ContextSource {
// TODO: YCbCrCoefficients #p27 (see annex E)
case 'ExifVersion':
case 'FlashpixVersion':
// TODO: YCbCrCoefficients #p27 (see annex E)
case 'ExifVersion':
case 'FlashpixVersion':
- $val =
"$val"
/ 100;
+ $val =
(int)$val
/ 100;
break;
case 'ColorSpace':
break;
case 'ColorSpace':
@@
-787,7
+787,7
@@
class FormatMetadata extends ContextSource {
}
}
if ( is_numeric( $val ) ) {
}
}
if ( is_numeric( $val ) ) {
- $fNumber =
pow( 2,
$val / 2 );
+ $fNumber =
2 ** (
$val / 2 );
if ( $fNumber !== false ) {
$val = $this->msg( 'exif-maxaperturevalue-value',
$this->formatNum( $val ),
if ( $fNumber !== false ) {
$val = $this->msg( 'exif-maxaperturevalue-value',
$this->formatNum( $val ),
@@
-971,11
+971,7
@@
class FormatMetadata extends ContextSource {
case 'LanguageCode':
$lang = Language::fetchLanguageName( strtolower( $val ), $this->getLanguage()->getCode() );
case 'LanguageCode':
$lang = Language::fetchLanguageName( strtolower( $val ), $this->getLanguage()->getCode() );
- if ( $lang ) {
- $val = htmlspecialchars( $lang );
- } else {
- $val = htmlspecialchars( $val );
- }
+ $val = htmlspecialchars( $lang ?: $val );
break;
default:
break;
default:
@@
-1007,13
+1003,12
@@
class FormatMetadata extends ContextSource {
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 ) {
$obj->setContext( $context );
}
$context = new DerivativeContext( $obj->getContext() );
$obj = new FormatMetadata;
if ( $context ) {
$obj->setContext( $context );
}
$context = new DerivativeContext( $obj->getContext() );
- $context->setLanguage(
$wgContLang
);
+ $context->setLanguage(
MediaWikiServices::getInstance()->getContentLanguage()
);
$obj->setContext( $context );
return $obj->flattenArrayReal( $vals, $type, $noHtml );
$obj->setContext( $context );
return $obj->flattenArrayReal( $vals, $type, $noHtml );
@@
-1047,7
+1042,7
@@
class FormatMetadata extends ContextSource {
if ( !is_array( $vals ) ) {
return $vals; // do nothing if not an array;
if ( !is_array( $vals ) ) {
return $vals; // do nothing if not an array;
- } elseif ( count( $vals ) === 1 && $type !== 'lang' ) {
+ } elseif ( count( $vals ) === 1 && $type !== 'lang'
&& isset( $vals[0] )
) {
return $vals[0];
} elseif ( count( $vals ) === 0 ) {
wfDebug( __METHOD__ . " metadata array with 0 elements!\n" );
return $vals[0];
} elseif ( count( $vals ) === 0 ) {
wfDebug( __METHOD__ . " metadata array with 0 elements!\n" );
@@
-1060,7
+1055,7
@@
class FormatMetadata extends ContextSource {
*/
switch ( $type ) {
case 'lang':
*/
switch ( $type ) {
case 'lang':
- // Display default, followed by Cont
Lang
,
+ // Display default, followed by Cont
entLanguage
,
// followed by the rest in no particular
// order.
// followed by the rest in no particular
// order.
@@
-1222,13
+1217,15
@@
class FormatMetadata extends ContextSource {
* @return string The text content of "exif-$tag-$val" message in lower case
*/
private function exifMsg( $tag, $val, $arg = null, $arg2 = null ) {
* @return string The text content of "exif-$tag-$val" message in lower case
*/
private function exifMsg( $tag, $val, $arg = null, $arg2 = null ) {
- global $wgContLang;
-
if ( $val === '' ) {
$val = 'value';
}
if ( $val === '' ) {
$val = 'value';
}
- return $this->msg( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
+ return $this->msg(
+ MediaWikiServices::getInstance()->getContentLanguage()->lc( "exif-$tag-$val" ),
+ $arg,
+ $arg2
+ )->text();
}
/**
}
/**
@@
-1859,9
+1856,9
@@
class FormatMetadata extends ContextSource {
// drop all characters which are not valid in an XML tag name
// a bunch of non-ASCII letters would be valid but probably won't
// be used so we take the easy way
// drop all characters which are not valid in an XML tag name
// a bunch of non-ASCII letters would be valid but probably won't
// be used so we take the easy way
- $key = preg_replace( '/[^a-zA-z0-9_:.-]/', '', $key );
+ $key = preg_replace( '/[^a-zA-z0-9_:.
\
-]/', '', $key );
// drop characters which are invalid at the first position
// drop characters which are invalid at the first position
- $key = preg_replace( '/^[\d-.]+/', '', $key );
+ $key = preg_replace( '/^[\d
\
-.]+/', '', $key );
if ( $key == '' ) {
$key = '_';
if ( $key == '' ) {
$key = '_';