PHP Class Wikimate, Wikimate

Author: Robert McLeod
Show file Open project: hamstar/Wikimate Class Usage Examples

Protected Properties

Property Type Description
$api
$debugMode
$error
$password
$session Requests_Session
$useragent
$username

Public Methods

Method Description
__construct ( $api ) : Wikimate Create a new Wikimate object.
debugCurlConfig ( boolean $echo = false ) : mixed Used to return or print the curl settings, but now prints an error and returns Wikimate::debugRequestsConfig().
debugRequestsConfig ( boolean $echo = false ) : boolean Get or print the Requests configuration.
delete ( array $array ) : array Perfoms a delete query to the wiki API.
download ( string $url ) : mixed Downloads data from the given URL.
edit ( array $array ) : array Perfoms an edit query to the wiki API.
getError ( ) : mixed Returns the latest error if there is one.
getFile ( string $filename ) : WikiFile Returns a WikiFile object populated with the file data.
getPage ( string $title ) : WikiPage Returns a WikiPage object populated with the page data.
login ( string $username, string $password, string $domain = null ) : boolean Logs in to the wiki.
parse ( array $array ) : array Performs a parse query to the wiki API.
query ( array $array ) : array Performs a query to the wiki API with the given details.
setDebugMode ( boolean $b ) : Wikimate Sets the debug mode.
upload ( array $array ) : array Uploads a file to the wiki API.

Protected Methods

Method Description
initRequests ( ) : void Set up a Requests_Session with appropriate user agent.

Method Details

__construct() public method

Create a new Wikimate object.
public __construct ( $api ) : Wikimate
return Wikimate

debugCurlConfig() public method

Used to return or print the curl settings, but now prints an error and returns Wikimate::debugRequestsConfig().
Deprecation: Since version 0.10.0
public debugCurlConfig ( boolean $echo = false ) : mixed
$echo boolean True to echo the configuration
return mixed Array of config if $echo is false, (boolean) true if echo is true

debugRequestsConfig() public method

Get or print the Requests configuration.
public debugRequestsConfig ( boolean $echo = false ) : boolean
$echo boolean Whether to echo the options
return boolean Options if $echo is false

delete() public method

Perfoms a delete query to the wiki API.
public delete ( array $array ) : array
$array array Array of details to be passed in the query
return array Unserialized php output from the wiki API

download() public method

Downloads data from the given URL.
public download ( string $url ) : mixed
$url string The URL to download from
return mixed The downloaded data (string), or null if error

edit() public method

Perfoms an edit query to the wiki API.
public edit ( array $array ) : array
$array array Array of details to be passed in the query
return array Unserialized php output from the wiki API

getError() public method

Returns the latest error if there is one.
public getError ( ) : mixed
return mixed The error array, or null if no error

getFile() public method

Returns a WikiFile object populated with the file data.
public getFile ( string $filename ) : WikiFile
$filename string The name of the wiki file
return WikiFile The file object

getPage() public method

Returns a WikiPage object populated with the page data.
public getPage ( string $title ) : WikiPage
$title string The name of the wiki article
return WikiPage The page object

initRequests() protected method

Set up a Requests_Session with appropriate user agent.
protected initRequests ( ) : void
return void

login() public method

Logs in to the wiki.
public login ( string $username, string $password, string $domain = null ) : boolean
$username string The user name
$password string The user password
$domain string The domain (optional)
return boolean True if logged in

parse() public method

Performs a parse query to the wiki API.
public parse ( array $array ) : array
$array array Array of details to be passed in the query
return array Unserialized php output from the wiki API

query() public method

Performs a query to the wiki API with the given details.
public query ( array $array ) : array
$array array Array of details to be passed in the query
return array Unserialized php output from the wiki API

setDebugMode() public method

Sets the debug mode.
public setDebugMode ( boolean $b ) : Wikimate
$b boolean True to turn debugging on
return Wikimate This object

upload() public method

Uploads a file to the wiki API.
public upload ( array $array ) : array
$array array Array of details to be used in the upload
return array Unserialized php output from the wiki API

Property Details

$api protected property

protected $api

$debugMode protected property

protected $debugMode

$error protected property

protected $error

$password protected property

protected $password

$session protected property

protected Requests_Session $session
return Requests_Session

$useragent protected property

protected $useragent

$username protected property

protected $username