Go to the documentation of this file.
56 if ( $val !==
'True' && $val !==
'False' ) {
57 wfDebugLog(
'XMP', __METHOD__ .
" Expected True or False but got $val" );
74 if ( !preg_match(
'/^(?:-?\d+)\/(?:\d+[1-9]|[1-9]\d*)$/D', $val ) ) {
75 wfDebugLog(
'XMP', __METHOD__ .
" Expected rational but got $val" );
95 if ( !preg_match(
'/^[-+]?\d*(?:\.?\d*)$/D', $val )
96 || !is_numeric( $val )
98 wfDebugLog(
'XMP', __METHOD__ .
" Expected rating but got $val" );
108 wfDebugLog(
'XMP', __METHOD__ .
" Rating too low, setting to -1 (Rejected)" );
114 wfDebugLog(
'XMP', __METHOD__ .
" Rating too high, setting to 5" );
130 if ( !$standalone ) {
134 if ( !preg_match(
'/^[-+]?\d+$/D', $val ) ) {
135 wfDebugLog(
'XMP', __METHOD__ .
" Expected integer but got $val" );
149 if ( !$standalone ) {
156 if ( isset( $info[
'rangeLow'] )
157 && isset( $info[
'rangeHigh'] )
158 && is_numeric( $val )
159 && ( intval( $val ) <= $info[
'rangeHigh'] )
160 && ( intval( $val ) >= $info[
'rangeLow'] )
165 if ( !isset( $info[
'choices'][$val] ) && !$inRange ) {
166 wfDebugLog(
'XMP', __METHOD__ .
" Expected closed choice, but got $val" );
183 if ( !( isset( $val[
'Fired'] )
184 && isset( $val[
'Function'] )
185 && isset( $val[
'Mode'] )
186 && isset( $val[
'RedEyeMode'] )
187 && isset( $val[
'Return'] )
189 wfDebugLog(
'XMP', __METHOD__ .
" Flash structure did not have all the required components" );
192 $val = (
"\0" | ( $val[
'Fired'] ===
'True' )
193 | ( intval( $val[
'Return'] ) << 1 )
194 | ( intval( $val[
'Mode'] ) << 3 )
195 | ( ( $val[
'Function'] ===
'True' ) << 5 )
196 | ( ( $val[
'RedEyeMode'] ===
'True' ) << 6 ) );
213 if ( !$standalone ) {
217 if ( !preg_match(
'/^[-A-Za-z0-9]{2,}$/D', $val ) ) {
219 wfDebugLog(
'XMP', __METHOD__ .
" Expected Lang code but got $val" );
242 if ( !$standalone ) {
250 '/^([0-3]\d{3})(?:-([01]\d)(?:-([0-3]\d)(?:T([0-2]\d):([0-6]\d)(?::([0-6]\d)(?:\.\d+)?)?([-+]\d{2}:\d{2}|Z)?)?)?)?$/D',
255 wfDebugLog(
'XMP', __METHOD__ .
" Expected date but got $val" );
272 if (
$res[1] ===
'0000' ) {
273 wfDebugLog(
'XMP', __METHOD__ .
" Invalid date (year 0): $val" );
279 if ( !isset(
$res[4] ) ) {
282 if ( isset(
$res[2] ) ) {
283 $val .=
':' .
$res[2];
285 if ( isset(
$res[3] ) ) {
286 $val .=
':' .
$res[3];
292 if ( !isset(
$res[7] ) ||
$res[7] ===
'Z' ) {
296 if ( isset(
$res[6] ) &&
$res[6] !==
'' ) {
297 $val .=
':' .
$res[6];
304 $stripSeconds =
false;
305 if ( !isset(
$res[6] ) ||
$res[6] ===
'' ) {
307 $stripSeconds =
true;
316 $offset = intval( substr(
$res[7], 1, 2 ) ) * 60 * 60;
317 $offset += intval( substr(
$res[7], 4, 2 ) ) * 60;
318 if ( substr(
$res[7], 0, 1 ) ===
'-' ) {
323 if ( $stripSeconds ) {
325 $val = substr( $val, 0, -3 );
343 if ( !$standalone ) {
349 '/(\d{1,3}),(\d{1,2}),(\d{1,2})([NWSE])/D',
352 $coord = intval( $m[1] );
353 $coord += intval( $m[2] ) * ( 1 / 60 );
354 $coord += intval( $m[3] ) * ( 1 / 3600 );
355 if ( $m[4] ===
'S' || $m[4] ===
'W' ) {
361 } elseif ( preg_match(
362 '/(\d{1,3}),(\d{1,2}(?:.\d*)?)([NWSE])/D',
365 $coord = intval( $m[1] );
366 $coord += floatval( $m[2] ) * ( 1 / 60 );
367 if ( $m[3] ===
'S' || $m[3] ===
'W' ) {
375 .
" Expected GPSCoordinate, but got $val." );
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
static validateBoolean( $info, &$val, $standalone)
Function to validate boolean properties ( True or False )
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.
static validateFlash( $info, &$val, $standalone)
function to validate and modify flash structure
const TS_EXIF
An Exif timestamp (YYYY:MM:DD HH:MM:SS)
static validateRational( $info, &$val, $standalone)
function to validate rational properties ( 12/10 )
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static validateClosed( $info, &$val, $standalone)
function to validate properties with a fixed number of allowed choices.
static validateLangCode( $info, &$val, $standalone)
function to validate LangCode properties ( en-GB, etc )
This contains some static methods for validating XMP properties.
static validateInteger( $info, &$val, $standalone)
function to validate integers
static validateRating( $info, &$val, $standalone)
function to validate rating properties -1, 0-5
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
static validateDate( $info, &$val, $standalone)
function to validate date properties, and convert to (partial) Exif format.
static validateGPS( $info, &$val, $standalone)
function to validate, and more importantly translate the XMP DMS form of gps coords to the decimal fo...