PHP 클래스 WikiFile, Wikimate

All properties pertain to the current revision of the file.
저자: Robert McLeod & Frans P. de Vries
파일 보기 프로젝트 열기: hamstar/Wikimate 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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