/wikipediaapi.h.php

Description

wikipediaapi.h.php

(C) Copyright 2012 Compdigitec. All rights reserved.

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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Classes
Class Description
wpapicurl A Wikipedia API object
wpapierrclass Wikipedia API error class
Constants
MINECRAFTWIKI = 'http://www.minecraftwiki.net/api.php' (line 27)
WIKIA = 'http://www.wikia.com/api.php' (line 26)
WIKIPEDIA = 'http://en.wikipedia.org/w/api.php' (line 25)

Shortcuts to most common wikis

WIKITRAVEL = 'http://wikitravel.org/wiki/en/api.php' (line 28)
Functions
wikipedia_api_block (line 487)

Blocks a wiki user

Blocks/unblocks a wiki user. Requires a (un)block token from wikipedia_api_blocktoken

  • return: Error status
wpapierrclass wikipedia_api_block (wpapicurl $wac, string $token, string $user, [string $reason = ""], [string $expiry = "never"], [Array $addoptions = array()])
  • wpapicurl $wac: WikipediaAPI object
  • string $token: Block token
  • string $user: The user to block
  • string $reason: Reason for (un)blocking user
  • string $expiry: Expiry timestamp
  • Array $addoptions: Additional options, including: anononly: Block only anonymous edits nocreate: Block account creation from user's IP autoblock: Automatically block any IP addresses used by this user, past and future noemail: Block e-mail
wikipedia_api_blocktoken (line 458)

Gets a block/unblock token required to (un)block a user in wikipedia_api_block

  • return: The block token
string wikipedia_api_blocktoken (wpapicurl $wac, string $user, [bool $block = true])
  • wpapicurl $wac: A WikipediaAPI object
  • string $user: The user to be (un)blocked (E.g. for User:Example $user would be "Example"
  • bool $block: True to block, false to unblock
wikipedia_api_checklogin (line 190)

Checks to see if we are logged in

  • return: Returns true if logged in, false if not
bool wikipedia_api_checklogin (wpapicurl $wac)
wikipedia_api_converterr (line 144)

Coverts MediaWiki errors to wpapierrclass errors - not to be used directly.

int wikipedia_api_converterr (string $error)
  • string $error: MediaWiki error
wikipedia_api_delete (line 380)

Deletes a wiki page

Deletes a wiki page. Requires a delete token from wikipedia_api_deletetoken

  • return: Error status
wpapierrclass wikipedia_api_delete (wpapicurl $wac, string $token, string $title, [string $reason = ""])
  • wpapicurl $wac: WikipediaAPI object
  • string $token: Delete token
  • string $title: The page to delete
  • string $reason: Reason for deleting page
wikipedia_api_deletetoken (line 362)

Gets a delete token required to move the page in wikipedia_api_delete

  • return: The delete token
string wikipedia_api_deletetoken (wpapicurl $wac, [string $title = "Sandbox"])
  • wpapicurl $wac: A WikipediaAPI object
  • string $title: The page to be deleted
wikipedia_api_edit (line 333)

Edits a wiki page

Edits a wiki page. Requires an edit token, which can be obtained with wikipedia_api_edittoken.

  • return: Error status
wpapierrclass wikipedia_api_edit (wpapicurl $wac, string $token, string $t, string $c, [string $summary = ""], [bool $minor = false])
  • wpapicurl $wac: WikipediaAPI object
  • string $token: Edit token (obtained at wikipedia_api_edittoken
  • string $t: The page to edit
  • string $c: New page contents
  • string $summary: Edit summary
  • bool $minor: If true, sets as minor edit
wikipedia_api_editcount (line 269)

Get the edit count for the current user

Gets the edit count for the currently logged in user. If you did not log in yet, it returns zero.

  • return: The edit count for the user
int wikipedia_api_editcount (wpapicurl $wac)
wikipedia_api_edittoken (line 312)

Gets an edit token required to edit the page in wikipedia_api_edit

  • return: The edit token
string wikipedia_api_edittoken (wpapicurl $wac, [string $title = "Main Page"])
  • wpapicurl $wac: A WikipediaAPI object
  • string $title: The page to be edited
wikipedia_api_getpage (line 284)

Gets the contents of a page

  • return: The page contents
string wikipedia_api_getpage (wpapicurl $wac, string $title)
  • wpapicurl $wac: A WikipediaAPI object
  • string $title: Title of the page
wikipedia_api_getpagecreator (line 298)

Get page creator

  • return: The page author
string wikipedia_api_getpagecreator (wpapicurl $wac, string $title)
  • wpapicurl $wac: A WikipediaAPI object
  • string $title: Title of the page
wikipedia_api_init (line 201)

Initalizes a WikipediaAPI object

  • return: A new WikipediaAPI object
wpapicurl wikipedia_api_init ([string $wiki = WIKIPEDIA])
  • string $wiki: An URL to the api.php of the wiki to use (defaults to English Wikipedia)
wikipedia_api_login (line 214)

Login to the wiki

  • return: Returns an error class (use strval to get error)
wpapierrclass wikipedia_api_login (wpapicurl $wac, string $user, string $pass)
  • wpapicurl $wac: A WikipediaAPI object
  • string $user: The username
  • string $pass: The password
wikipedia_api_logout (line 253)

Log out of the wiki

void wikipedia_api_logout (wpapicurl $wac)
wikipedia_api_move (line 424)

Moves a wiki page

Moves a wiki page. Requires a move token from wikipedia_api_movetoken

  • return: Error status
wpapierrclass wikipedia_api_move (wpapicurl $wac, string $token, string $from, string $to, [string $reason = "moving page"])
  • wpapicurl $wac: WikipediaAPI object
  • string $token: Move token
  • string $from: The page to move
  • string $to: Destination
  • string $reason: Reason for moving page
wikipedia_api_movetoken (line 404)

Gets an move token required to move the page in wikipedia_api_move

  • return: The move token
string wikipedia_api_movetoken (wpapicurl $wac, [string $title = "Main Page"])
  • wpapicurl $wac: A WikipediaAPI object
  • string $title: The page to be moved
wikipedia_api_recentchanges (line 439)

Get the list of recent changes

  • return: List of recent changes (in SimpleXML Format)
Array wikipedia_api_recentchanges (wpapicurl $wac, [int $limit = 1])
  • int $limit: How many recent changes to display
  • wpapicurl $wac: WikipediaAPI object

Documentation generated on Fri, 27 Jan 2012 23:26:04 -0500 by phpDocumentor 1.4.3