Source for file pages.php
Documentation is available at pages.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* MediaWiki API Pages class for the Joomla Platform.
* @package Joomla.Platform
* @param string $title Page title.
* @param int $section Section number.
* @param string $sectiontitle The title for a new section.
* @param string $text Page content.
* @param string $summary Title of the page you want to delete.
public function editPage($title, $section =
null, $sectiontitle =
null, $text =
null, $summary =
null)
$token =
$this->getToken($title, 'edit');
// Build the request path.
// Build the request data.
'sectiontitle' =>
$section,
* Method to delete a page.
* @param string $title Title of the page you want to delete.
* @param string $reason Reason for the deletion.
* @param string $watchlist Unconditionally add or remove the page from your watchlis.
* @param string $oldimage The name of the old image to delete.
public function deletePageByName($title, $reason =
null, $watchlist =
null, $oldimage =
null)
$token =
$this->getToken($title, 'delete');
// Build the request path.
$path =
'?action=delete';
// Build the request data.
'watchlist' =>
$watchlist,
* Method to delete a page.
* @param string $pageid Page ID of the page you want to delete.
* @param string $reason Reason for the deletion.
* @param string $watchlist Unconditionally add or remove the page from your watchlis.
* @param string $oldimage The name of the old image to delete.
public function deletePageByID($pageid, $reason =
null, $watchlist =
null, $oldimage =
null)
$token =
$this->getToken($pageid, 'delete');
// Build the request path.
$path =
'?action=delete';
// Build the request data.
'watchlist' =>
$watchlist,
* Method to restore certain revisions of a deleted page.
* @param string $title Title of the page you want to restore.
* @param string $reason Reason for restoring (optional).
* @param string $timestamp Timestamps of the revisions to restore.
* @param string $watchlist Unconditionally add or remove the page from your watchlist.
public function undeletePage($title, $reason =
null, $timestamp =
null, $watchlist =
null)
$token =
$this->getToken($title, 'undelete');
// Build the request path.
$path =
'?action=undelete';
// Build the request data.
'timestamp' =>
$timestamp,
'watchlist' =>
$watchlist,
* @param string $from Title of the page you want to move.
* @param string $to Title you want to rename the page to.
* @param string $reason Reason for the move (optional).
* @param string $movetalk Move the talk page, if it exists.
* @param string $movesubpages Move subpages, if applicable.
* @param boolean $noredirect Don't create a redirect.
* @param string $watchlist Unconditionally add or remove the page from your watchlist.
* @param boolean $ignorewarnings Ignore any warnings.
public function movePageByName($from, $to, $reason =
null, $movetalk =
null, $movesubpages =
null, $noredirect =
null,
$watchlist =
null, $ignorewarnings =
null)
$token =
$this->getToken($from, 'move');
// Build the request path.
// Build the request data.
'movesubpages' =>
$movesubpages,
'noredirect' =>
$noredirect,
'watchlist' =>
$watchlist,
'ignorewarnings' =>
$ignorewarnings
* @param int $fromid Page ID of the page you want to move.
* @param string $to Title you want to rename the page to.
* @param string $reason Reason for the move (optional).
* @param string $movetalk Move the talk page, if it exists.
* @param string $movesubpages Move subpages, if applicable.
* @param boolean $noredirect Don't create a redirect.
* @param string $watchlist Unconditionally add or remove the page from your watchlist.
* @param boolean $ignorewarnings Ignore any warnings.
public function movePageByID($fromid, $to, $reason =
null, $movetalk =
null, $movesubpages =
null, $noredirect =
null,
$watchlist =
null, $ignorewarnings =
null)
$token =
$this->getToken($fromid, 'move');
// Build the request path.
// Build the request data.
'movesubpages' =>
$movesubpages,
'noredirect' =>
$noredirect,
'watchlist' =>
$watchlist,
'ignorewarnings' =>
$ignorewarnings
* Method to undo the last edit to the page.
* @param string $title Title of the page you want to rollback.
* @param string $user Name of the user whose edits are to be rolled back.
* @param string $summary Custom edit summary. If not set, default summary will be used.
* @param string $markbot Mark the reverted edits and the revert as bot edits.
* @param string $watchlist Unconditionally add or remove the page from your watchlist.
public function rollback($title, $user, $summary =
null, $markbot =
null, $watchlist =
null)
$token =
$this->getToken($title, 'rollback');
// Build the request path.
$path =
'?action=rollback';
// Build the request data.
'watchlist' =>
$watchlist
* Method to change the protection level of a page.
* @param string $title Title of the page you want to (un)protect.
* @param string $protections Pipe-separated list of protection levels.
* @param string $expiry Expiry timestamps.
* @param string $reason Reason for (un)protecting (optional).
* @param string $cascade Enable cascading protection.
* @param string $watchlist Unconditionally add or remove the page from your watchlist.
public function changeProtection($title, $protections, $expiry =
null, $reason =
null, $cascade =
null, $watchlist =
null)
$token =
$this->getToken($title, 'unblock');
// Build the request path.
$path =
'?action=protect';
// Build the request data.
'protections' =>
$protections,
'watchlist' =>
$watchlist
* Method to get basic page information.
* @param array $titles Page titles to retrieve info.
* @param array $inprop Which additional properties to get.
* @param array $intoken Request a token to perform a data-modifying action on a page
* @param boolean $incontinue When more results are available, use this to continue.
public function getPageInfo(array $titles, array $inprop =
null, array $intoken =
null, $incontinue =
null)
$path =
'?action=query&prop=info';
// Append titles to the request.
$path .=
'&titles=' .
$this->buildParameter($titles);
* Method to get various properties defined in the page content.
* @param array $titles Page titles to retrieve properties.
* @param boolean $ppcontinue When more results are available, use this to continue.
* @param string $ppprop Page prop to look on the page for.
$path =
'?action=query&prop=pageprops';
// Append titles to the request.
$path .=
'&titles=' .
$this->buildParameter($titles);
$path .=
'&ppprop=' .
$ppprop;
* Method to get a list of revisions.
* @param array $titles Page titles to retrieve revisions.
* @param array $rvprop Which properties to get for each revision.
* @param boolean $rvparse Parse revision content.
* @param int $rvlimit Limit how many revisions will be returned.
public function getRevisions(array $titles, array $rvprop =
null, $rvparse =
null, $rvlimit =
null)
$path =
'?action=query&prop=revisions';
// Append titles to the request.
$path .=
'&titles=' .
$this->buildParameter($titles);
$path .=
'&rvlimit=' .
$rvlimit;
* Method to get all page templates from the given page.
* @param array $titles Page titles to retrieve templates.
* @param array $tlnamespace Show templates in this namespace(s) only.
* @param integer $tllimit How many templates to return.
* @param boolean $tlcontinue When more results are available, use this to continue.
* @param string $tltemplates Only list these templates.
* @param string $tldir The direction in which to list.
public function getPageTemplates(array $titles, array $tlnamespace =
null, $tllimit =
null, $tlcontinue =
null, $tltemplates =
null, $tldir =
null)
$path =
'?action=query&prop=templates';
// Append titles to the request.
$path .=
'&titles=' .
$this->buildParameter($titles);
$path .=
'&tllimit=' .
$tllimit;
$path .=
'&tltemplates=' .
$tltemplates;
$path .=
'&tldir=' .
$tldir;
* Method to get all pages that link to the given page.
* @param string $bltitle Title to search.
* @param integer $blpageid Pageid to search.
* @param boolean $blcontinue When more results are available, use this to continue.
* @param array $blnamespace The namespace to enumerate.
* @param string $blfilterredirect How to filter for redirects..
* @param integer $bllimit How many total pages to return.
* @param boolean $blredirect If linking page is a redirect, find all pages that link to that redirect as well.
public function getBackLinks($bltitle, $blpageid =
null, $blcontinue =
null, array $blnamespace =
null, $blfilterredirect =
null,
$bllimit =
null, $blredirect =
null)
$path =
'?action=query&list=backlinks';
$path .=
'&bltitle=' .
$bltitle;
$path .=
'&blpageid=' .
$blpageid;
if (isset
($blfilterredirect))
$path .=
'&blfilterredirect=' .
$blfilterredirect;
$path .=
'&bllimit=' .
$bllimit;
* Method to get all pages that link to the given interwiki link.
* @param string $iwbltitle Interwiki link to search for. Must be used with iwblprefix.
* @param string $iwblprefix Prefix for the interwiki.
* @param boolean $iwblcontinue When more results are available, use this to continue.
* @param integer $iwbllimit How many total pages to return.
* @param array $iwblprop Which properties to get.
public function getIWBackLinks($iwbltitle, $iwblprefix =
null, $iwblcontinue =
null, $iwbllimit =
null, array $iwblprop =
null)
$path =
'?action=query&list=iwbacklinks';
$path .=
'&iwbltitle=' .
$iwbltitle;
$path .=
'&iwblprefix=' .
$iwblprefix;
$path .=
'&iwblcontinue=';
$path .=
'&bllimit=' .
$iwbllimit;
* Method to get access token.
* @param string $user The User to get token.
* @param string $intoken The type of token.
public function getToken($user, $intoken)
// Build the request path.
$path =
'?action=query&prop=info&intoken=' .
$intoken .
'&titles=User:' .
$user;
return (string)
$this->validateResponse($response)->query->pages->page[$intoken .
'token'];
Documentation generated on Tue, 19 Nov 2013 15:10:06 +0100 by phpDocumentor 1.4.3