Go to the documentation of this file.
40 static function parse( $rawData ) {
41 $parsed = iptcparse( $rawData );
43 if ( !is_array( $parsed ) ) {
49 if ( isset( $parsed[
'1#090'] ) && isset( $parsed[
'1#090'][0] ) ) {
57 unset( $parsed[
'1#090'] );
60 foreach ( $parsed
as $tag => $val ) {
61 if ( isset( $val[0] ) && trim( $val[0] ) ==
'' ) {
62 wfDebugLog(
'iptc',
"IPTC tag $tag had only whitespace as its value." );
81 if ( isset( $parsed[
'2#085'] ) ) {
88 for ( $i = 0; $i < $titleCount; $i++ ) {
89 if ( isset( $bylines[$i] ) ) {
92 $bylines[$i] =
$titles[$i] .
', ' . $bylines[$i];
95 $data[
'Artist'] = $bylines;
167 if ( count( $software ) !== 1 ) {
171 wfDebugLog(
'iptc',
'IPTC: Wrong count on 2:65 Software field' );
175 if ( isset( $parsed[
'2#070'] ) ) {
178 unset( $parsed[
'2#070'] );
179 $data[
'Software'] =
array(
array( $software[0], $softwareVersion[0] ) );
181 $data[
'Software'] = $software;
225 if ( isset( $parsed[
'2#060'] ) ) {
226 $time = $parsed[
'2#060'];
239 if ( isset( $parsed[
'2#063'] ) ) {
240 $time = $parsed[
'2#063'];
252 if ( isset( $parsed[
'2#035'] ) ) {
253 $time = $parsed[
'2#035'];
265 if ( isset( $parsed[
'2#038'] ) ) {
266 $time = $parsed[
'2#038'];
280 if ( strlen( $val[0] ) == 2 ) {
282 $versionValue = ord( substr( $val[0], 0, 1 ) ) * 256;
283 $versionValue += ord( substr( $val[0], 1, 1 ) );
284 $data[
'iimVersion'] = $versionValue;
298 $con = self::ConvIPTC( $val, $c );
299 if ( strlen( $con[0] ) < 5 ) {
305 $extracted = substr( $con[0], 4 );
306 $data[
'IntellectualGenre'] = $extracted;
315 foreach ( $codes
as $ic ) {
316 $fields = explode(
':', $ic, 3 );
318 if ( count( $fields ) < 2 || $fields[0] !==
'IPTC' ) {
320 .
'Invalid 2:12 - ' . $ic );
323 $data[
'SubjectNewsCode'] = $fields[1];
342 wfDebugLog(
'iptc',
"Unsupported iptc tag: $tag. Value: " . implode(
',', $val ) );
360 if ( count( $date ) === 1 ) {
368 if ( count(
$time ) === 1 ) {
372 $time =
'000000+0000';
376 if ( !( preg_match(
'/\d\d\d\d\d\d[-+]\d\d\d\d/',
$time )
377 && preg_match(
'/\d\d\d\d\d\d\d\d/', $date )
378 && substr( $date, 0, 4 ) !==
'0000'
379 && substr( $date, 4, 2 ) !==
'00'
380 && substr( $date, 6, 2 ) !==
'00'
387 wfDebugLog(
'iptc',
"IPTC: invalid time ( $time ) or date ( $date )" );
393 if ( $unixTS ===
false ) {
394 wfDebugLog(
'iptc',
"IPTC: can't convert date to TS_UNIX: $date $time." );
399 $tz = ( intval( substr(
$time, 7, 2 ) ) * 60 * 60 )
400 + ( intval( substr(
$time, 9, 2 ) ) * 60 );
402 if ( substr(
$time, 6, 1 ) ===
'-' ) {
407 if ( $finalTimestamp ===
false ) {
408 wfDebugLog(
'iptc',
"IPTC: can't make final timestamp. Date: " . ( $unixTS + $tz ) );
414 return substr( $finalTimestamp, 0, 10 );
416 return $finalTimestamp;
427 private static function convIPTC( $data, $charset ) {
428 if ( is_array( $data ) ) {
429 foreach ( $data
as &$val ) {
449 $data = iconv( $charset,
"UTF-8//IGNORE", $data );
451 if ( $data ===
false ) {
453 wfDebugLog(
'iptc', __METHOD__ .
" Error converting iptc data charset $charset to utf-8" );
460 if ( $data === $oldData ) {
467 return trim( $data );
555 $c =
"CSA_Z243.4-1985-1";
558 $c =
"CSA_Z243.4-1985-2";
562 case "\x1b&@\x1b\$B":
563 case "\x1b&@\x1b\$(B":
564 $c =
"JIS_C6226-1983";
596 wfDebugLog(
'iptc', __METHOD__ .
'Unknown charset in iptc 1:90: ' . bin2hex( $tag ) );
see documentation in includes Linker php for Linker::makeImageLink & $time
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
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
const TS_EXIF
An Exif timestamp (YYYY:MM:DD HH:MM:SS)
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
static convIPTCHelper( $data, $charset)
Helper function of a helper function to convert charset for iptc values.
Class for some IPTC functions.
static timeHelper( $date, $time, $c)
Convert an iptc date and time tags into the exif format.
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
wfRestoreWarnings()
Restore error level to previous value.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static parse( $rawData)
This takes the results of iptcparse() and puts it into a form that can be handled by mediawiki.
static getCharset( $tag)
take the value of 1:90 tag and returns a charset
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
static convIPTC( $data, $charset)
Helper function to convert charset for iptc values.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
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
static quickIsNFCVerify(&$string)
Returns true if the string is definitely in NFC.