PHP Класс WikiFile, Wikimate

All properties pertain to the current revision of the file.
Автор: Robert McLeod & Frans P. de Vries
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$edittoken
$error
$exists
$filename
$history
$info
$invalid
$wikimate

Открытые методы

Метод Описание
__construct ( string $filename, Wikimate $wikimate ) Constructs a WikiFile object from the filename given and associate with the passed Wikimate object.
__destruct ( ) : Forget all object properties.
delete ( string $reason = null, string $archivename = null ) : boolean Delete the file, or only an older revision of it.
destroy ( ) Alias of self::__destruct().
downloadData ( ) : mixed Downloads and returns the current file's contents, or null if an error occurs.
downloadFile ( string $path ) : boolean Downloads the current file's contents and writes it to the given path.
exists ( ) : boolean Returns the file existence status.
getArchivename ( mixed $revision ) : mixed Returns the archive name of the specified file revision.
getAspectRatio ( ) : float Returns the aspect ratio of this image, or 0 if file is not an image (and thus has no dimensions).
getBitDepth ( ) : integer Returns the bit depth of this file.
getCanonicalTitle ( ) : string Returns the canonical title of this file.
getComment ( ) : string Returns the edit comment of this file.
getCommonMetadata ( ) : array Returns the common metadata of this file.
getDescriptionUrl ( ) : string Returns the description URL of this file.
getError ( ) : mixed Returns the latest error if there is one.
getExtendedMetadata ( ) : array Returns the extended metadata of this file.
getFilename ( ) : string Returns the name of this file.
getHeight ( ) : integer Returns the height of this file.
getHistory ( boolean $refresh = false, integer $limit = null, string $startts = null, string $endts = null ) : mixed Returns the revision history of this file with all properties.
getInfo ( boolean $refresh = false, array $history = null ) : mixed Gets the information of the file. If refresh is true, then this method will query the wiki API again for the file details.
getMediaType ( ) : string Returns the media type of this file.
getMetadata ( ) : array Returns the Exif metadata of this file.
getMime ( ) : string Returns the MIME type of this file.
getParsedComment ( ) : string Returns the parsed edit comment of this file.
getRevision ( mixed $revision ) : mixed Returns the properties of the specified file revision.
getSha1 ( ) : string Returns the SHA-1 hash of this file.
getSize ( ) : integer Returns the size of this file.
getThumbMime ( ) : string Returns the MIME type of this file's thumbnail, or null if property not available.
getTimestamp ( ) : string Returns the timestamp of this file.
getUrl ( ) : string Returns the URL of this file.
getUser ( ) : string Returns the user who uploaded this file.
getUserId ( ) : integer Returns the ID of the user who uploaded this file.
getWidth ( ) : integer Returns the width of this file.
uploadData ( string $data, string $comment, string $text = null, boolean $overwrite = false ) : boolean Uploads the given contents to the current file.
uploadFile ( string $path, string $comment, string $text = null, boolean $overwrite = false ) : boolean Reads contents from the given path and uploads it to the current file.
uploadFromUrl ( string $url, string $comment, string $text = null, boolean $overwrite = false ) : boolean Uploads file contents from the given URL to the current file.

Приватные методы

Метод Описание
uploadCommon ( array $params, string $comment, string $text = null, boolean $overwrite = false ) : boolean Uploads to the current file using the given parameters.

Описание методов

__construct() публичный Метод

Constructs a WikiFile object from the filename given and associate with the passed Wikimate object.
public __construct ( string $filename, Wikimate $wikimate )
$filename string Name of the wiki file
$wikimate Wikimate Wikimate object

__destruct() публичный Метод

Forget all object properties.
public __destruct ( ) :
Результат

delete() публичный Метод

Delete the file, or only an older revision of it.
public delete ( string $reason = null, string $archivename = null ) : boolean
$reason string Reason for the deletion
$archivename string The archive name of the older revision
Результат boolean True if file (revision) was deleted successfully

destroy() публичный Метод

Alias of self::__destruct().
public destroy ( )

downloadData() публичный Метод

Downloads and returns the current file's contents, or null if an error occurs.
public downloadData ( ) : mixed
Результат mixed Contents (string), or null if error

downloadFile() публичный Метод

Downloads the current file's contents and writes it to the given path.
public downloadFile ( string $path ) : boolean
$path string The file path to write to
Результат boolean True if path was written successfully

exists() публичный Метод

Returns the file existence status.
public exists ( ) : boolean
Результат boolean True if file exists

getArchivename() публичный Метод

Revision can be the following: - revision timestamp (string, e.g. "2001-01-15T14:56:00Z") - revision index (int, e.g. 3) The most recent revision has index 0, and it increments towards older revisions. A timestamp must be in ISO 8601 format.
public getArchivename ( mixed $revision ) : mixed
$revision mixed The index or timestamp of the revision
Результат mixed The archive name (string), or null if not found

getAspectRatio() публичный Метод

Returns the aspect ratio of this image, or 0 if file is not an image (and thus has no dimensions).
public getAspectRatio ( ) : float
Результат float The aspect ratio of this image, or 0 if no dimensions

getBitDepth() публичный Метод

Returns the bit depth of this file.
public getBitDepth ( ) : integer
Результат integer The bit depth of this file

getCanonicalTitle() публичный Метод

Returns the canonical title of this file.
public getCanonicalTitle ( ) : string
Результат string The canonical title of this file

getComment() публичный Метод

Returns the edit comment of this file.
public getComment ( ) : string
Результат string The edit comment of this file

getCommonMetadata() публичный Метод

Returns the common metadata of this file.
public getCommonMetadata ( ) : array
Результат array The common metadata of this file

getDescriptionUrl() публичный Метод

Returns the description URL of this file.
public getDescriptionUrl ( ) : string
Результат string The description URL of this file

getError() публичный Метод

Returns the latest error if there is one.
public getError ( ) : mixed
Результат mixed The error array, or null if no error

getExtendedMetadata() публичный Метод

Returns the extended metadata of this file.
public getExtendedMetadata ( ) : array
Результат array The extended metadata of this file

getFilename() публичный Метод

Returns the name of this file.
public getFilename ( ) : string
Результат string The name of this file

getHeight() публичный Метод

Returns the height of this file.
public getHeight ( ) : integer
Результат integer The height of this file

getHistory() публичный Метод

The initial history at object creation contains only the current revision of the file. To obtain more revisions, set $refresh to true and also optionally set $limit and the timestamps. The maximum limit is 500 for user accounts and 5000 for bot accounts. Timestamps can be in several formats as described here: https://www.mediawiki.org/w/api.php?action=help&modules=main#main.2Fdatatypes
public getHistory ( boolean $refresh = false, integer $limit = null, string $startts = null, string $endts = null ) : mixed
$refresh boolean True to query the wiki API again
$limit integer The number of file revisions to return (the maximum number by default)
$startts string The start timestamp of the listing (optional)
$endts string The end timestamp of the listing (optional)
Результат mixed The array of selected file revisions, or null if error

getInfo() публичный Метод

Gets the information of the file. If refresh is true, then this method will query the wiki API again for the file details.
public getInfo ( boolean $refresh = false, array $history = null ) : mixed
$refresh boolean True to query the wiki API again
$history array An optional array of revision history parameters
Результат mixed The info of the file (array), or null if error

getMediaType() публичный Метод

Returns the media type of this file.
public getMediaType ( ) : string
Результат string The media type of this file

getMetadata() публичный Метод

Returns the Exif metadata of this file.
public getMetadata ( ) : array
Результат array The metadata of this file

getMime() публичный Метод

Returns the MIME type of this file.
public getMime ( ) : string
Результат string The MIME type of this file

getParsedComment() публичный Метод

Returns the parsed edit comment of this file.
public getParsedComment ( ) : string
Результат string The parsed edit comment of this file

getRevision() публичный Метод

Revision can be the following: - revision timestamp (string, e.g. "2001-01-15T14:56:00Z") - revision index (int, e.g. 3) The most recent revision has index 0, and it increments towards older revisions. A timestamp must be in ISO 8601 format.
public getRevision ( mixed $revision ) : mixed
$revision mixed The index or timestamp of the revision
Результат mixed The properties (array), or null if not found

getSha1() публичный Метод

Returns the SHA-1 hash of this file.
public getSha1 ( ) : string
Результат string The SHA-1 hash of this file

getSize() публичный Метод

Returns the size of this file.
public getSize ( ) : integer
Результат integer The size of this file

getThumbMime() публичный Метод

Returns the MIME type of this file's thumbnail, or null if property not available.
public getThumbMime ( ) : string
Результат string The MIME type of this file's thumbnail, or null if unavailable

getTimestamp() публичный Метод

Returns the timestamp of this file.
public getTimestamp ( ) : string
Результат string The timestamp of this file

getUrl() публичный Метод

Returns the URL of this file.
public getUrl ( ) : string
Результат string The URL of this file

getUser() публичный Метод

Returns the user who uploaded this file.
public getUser ( ) : string
Результат string The user of this file

getUserId() публичный Метод

Returns the ID of the user who uploaded this file.
public getUserId ( ) : integer
Результат integer The user ID of this file

getWidth() публичный Метод

Returns the width of this file.
public getWidth ( ) : integer
Результат integer The width of this file

uploadData() публичный Метод

$text is only used for the page contents of a new file, not an existing one (update that via WikiPage::setText()). If no $text is specified, $comment will be used as new page text.
public uploadData ( string $data, string $comment, string $text = null, boolean $overwrite = false ) : boolean
$data string The data to upload
$comment string Upload comment for the file
$text string The article text for the file page
$overwrite boolean True to overwrite existing file
Результат boolean True if uploading was successful

uploadFile() публичный Метод

$text is only used for the page contents of a new file, not an existing one (update that via WikiPage::setText()). If no $text is specified, $comment will be used as new page text.
public uploadFile ( string $path, string $comment, string $text = null, boolean $overwrite = false ) : boolean
$path string The file path to upload
$comment string Upload comment for the file
$text string The article text for the file page
$overwrite boolean True to overwrite existing file
Результат boolean True if uploading was successful

uploadFromUrl() публичный Метод

$text is only used for the page contents of a new file, not an existing one (update that via WikiPage::setText()). If no $text is specified, $comment will be used as new page text.
public uploadFromUrl ( string $url, string $comment, string $text = null, boolean $overwrite = false ) : boolean
$url string The URL from which to upload
$comment string Upload comment for the file
$text string The article text for the file page
$overwrite boolean True to overwrite existing file
Результат boolean True if uploading was successful

Описание свойств

$edittoken защищенное свойство

protected $edittoken

$error защищенное свойство

protected $error

$exists защищенное свойство

protected $exists

$filename защищенное свойство

protected $filename

$history защищенное свойство

protected $history

$info защищенное свойство

protected $info

$invalid защищенное свойство

protected $invalid

$wikimate защищенное свойство

protected $wikimate