[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Formatting of image metadata values into human readable form. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Author: | Ævar Arnfjörð Bjarmason <[email protected]> |
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 |
File Size: | 1872 lines (50 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
FormatMetadata:: (23 methods):
setSingleLanguage()
getFormattedData()
makeFormattedData()
flattenArrayContentLang()
flattenArray()
flattenArrayReal()
langItem()
exifMsg()
formatNum()
formatFraction()
gcd()
convertNewsCode()
formatCoords()
collapseContactInfo()
getVisibleFields()
fetchExtendedMetadata()
getExtendedMetadataFromFile()
getExtendedMetadataFromHook()
resolveMultilangValue()
resolveMultilangMetadata()
sanitizeArrayForXml()
sanitizeKeyForXml()
getPriorityLanguages()
Class: FormatMetadata - X-Ref
Format Image metadata values into a human readable form.setSingleLanguage( $val ) X-Ref |
Trigger only outputting single language for multilanguage fields param: bool $val |
getFormattedData( $tags, $context = false ) X-Ref |
Numbers given by Exif user agents are often magical, that is they should be replaced by a detailed explanation depending on their value which most of the time are plain integers. This function formats Exif (and other metadata) values into human readable form. This is the usual entry point for this class. param: array $tags The Exif data to format ( as returned by param: bool|IContextSource $context Context to use (optional) return: array |
makeFormattedData( $tags ) X-Ref |
Numbers given by Exif user agents are often magical, that is they should be replaced by a detailed explanation depending on their value which most of the time are plain integers. This function formats Exif (and other metadata) values into human readable form. param: array $tags The Exif data to format ( as returned by return: array |
flattenArrayContentLang( $vals, $type = 'ul',$noHtml = false, $context = false) X-Ref |
Flatten an array, using the content language for any messages. param: array $vals Array of values param: string $type Type of array (either lang, ul, ol). param: bool $noHtml If to avoid returning anything resembling HTML. param: bool|IContextSource $context return: string Single value (in wiki-syntax). |
flattenArray( $vals, $type = 'ul', $noHtml = false, $context = false ) X-Ref |
Flatten an array, using the user language for any messages. param: array $vals Array of values param: string $type Type of array (either lang, ul, ol). param: bool $noHtml If to avoid returning anything resembling HTML. param: bool|IContextSource $context return: string Single value (in wiki-syntax). |
flattenArrayReal( $vals, $type = 'ul', $noHtml = false ) X-Ref |
A function to collapse multivalued tags into a single value. This turns an array of (for example) authors into a bulleted list. This is public on the basis it might be useful outside of this class. param: array $vals Array of values param: string $type Type of array (either lang, ul, ol). param: bool $noHtml If to avoid returning anything resembling HTML. return: string Single value (in wiki-syntax). |
langItem( $value, $lang, $default = false, $noHtml = false ) X-Ref |
No description |
exifMsg( $tag, $val, $arg = null, $arg2 = null ) X-Ref |
Convenience function for getFormattedData() param: string $tag The tag name to pass on param: string $val The value of the tag param: string $arg An argument to pass ($1) param: string $arg2 A 2nd argument to pass ($2) return: string The text content of "exif-$tag-$val" message in lower case |
formatNum( $num, $round = false ) X-Ref |
Format a number, convert numbers from fractions into floating point numbers, joins arrays of numbers with commas. param: mixed $num The value to format param: float|int|bool $round Digits to round to or false. return: mixed A floating point number or whatever we were fed |
formatFraction( $num ) X-Ref |
Format a rational number, reducing fractions param: mixed $num The value to format return: mixed A floating point number or whatever we were fed |
gcd( $a, $b ) X-Ref |
Calculate the greatest common divisor of two integers. param: int $a Numerator param: int $b Denominator return: int |
convertNewsCode( $val ) X-Ref |
Fetch the human readable version of a news code. A news code is an 8 digit code. The first two digits are a general classification, so we just translate that. Note, leading 0's are significant, so this is a string, not an int. param: string $val The 8 digit news code. return: string The human readable form |
formatCoords( $coord, $type ) X-Ref |
Format a coordinate value, convert numbers from floating point into degree minute second representation. param: int $coord Degrees, minutes and seconds param: string $type Latitude or longitude (for if its a NWS or E) return: mixed A floating point number or whatever we were fed |
collapseContactInfo( $vals ) X-Ref |
Format the contact info field into a single value. This function might be called from JpegHandler::convertMetadataVersion which is why it is public. param: array $vals Array with fields of the ContactInfo return: string HTML-ish looking wikitext |
getVisibleFields() X-Ref |
Get a list of fields that are visible by default. return: array |
fetchExtendedMetadata( File $file ) X-Ref |
Get an array of extended metadata. (See the imageinfo API for format.) param: File $file File to use return: array [<property name> => ['value' => <value>]], or [] on error |
getExtendedMetadataFromFile( File $file ) X-Ref |
Get file-based metadata in standardized format. Note that for a remote file, this might return metadata supplied by extensions. param: File $file File to use return: array [<property name> => ['value' => <value>]], or [] on error |
getExtendedMetadataFromHook( File $file, array $extendedMetadata,&$maxCacheTime) X-Ref |
Get additional metadata from hooks in standardized format. param: File $file File to use param: array $extendedMetadata param: int $maxCacheTime Hook handlers might use this parameter to override cache time return: array [<property name> => ['value' => <value>]], or [] on error |
resolveMultilangValue( $value ) X-Ref |
Turns an XMP-style multilang array into a single value. If the value is not a multilang array, it is returned unchanged. See mediawiki.org/wiki/Manual:File_metadata_handling#Multi-language_array_format param: mixed $value return: mixed Value in best language, null if there were no languages at all |
resolveMultilangMetadata( &$metadata ) X-Ref |
Takes an array returned by the getExtendedMetadata* functions, and resolves multi-language values in it. param: array $metadata |
sanitizeArrayForXml( &$arr ) X-Ref |
Makes sure the given array is a valid API response fragment (can be transformed into XML) param: array $arr |
sanitizeKeyForXml( $key ) X-Ref |
Turns a string into a valid XML identifier. Used to ensure that keys of an associative array in the API response do not break the XML formatter. param: string $key return: string |
getPriorityLanguages() X-Ref |
Returns a list of languages (first is best) to use when formatting multilang fields, based on user and site preferences. return: array |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |