Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
index.html 0000666 00000000037 15077506434 0006560 0 ustar 00
sites.php 0000666 00000017223 15077506434 0006430 0 ustar 00 buildParameter($siprop);
}
if (isset($sifilteriw))
{
$path .= '&sifilteriw=' . $sifilteriw;
}
if ($sishowalldb)
{
$path .= '&sishowalldb=';
}
if ($sinumberingroup)
{
$path .= '&sinumberingroup=';
}
if (isset($siinlanguagecode))
{
$path .= '&siinlanguagecode=' . $this->buildParameter($siinlanguagecode);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get events from logs.
*
* @param array $leprop List of properties to get.
* @param string $letype Filter log actions to only this type.
* @param string $leaction Filter log actions to only this type.
* @param string $letitle Filter entries to those related to a page.
* @param string $leprefix Filter entries that start with this prefix.
* @param string $letag Filter entries with tag.
* @param string $leuser Filter entries made by the given user.
* @param string $lestart Starting timestamp.
* @param string $leend Ending timestamp.
* @param string $ledir Direction of enumeration.
* @param integer $lelimit Event limit to return.
*
* @return object
*
* @since 12.3
*/
public function getEvents(array $leprop = null, $letype = null, $leaction = null, $letitle = null, $leprefix = null, $letag = null,
$leuser = null, $lestart = null, $leend = null, $ledir = null, $lelimit = null)
{
// Build the request
$path = '?action=query&list=logevents';
if (isset($leprop))
{
$path .= '&leprop=' . $this->buildParameter($leprop);
}
if (isset($letype))
{
$path .= '&letype=' . $letype;
}
if (isset($leaction))
{
$path .= '&leaction=' . $leaction;
}
if (isset($letitle))
{
$path .= '&letitle=' . $letitle;
}
if (isset($leprefix))
{
$path .= '&leprefix=' . $leprefix;
}
if (isset($letag))
{
$path .= '&letag=' . $letag;
}
if (isset($leuser))
{
$path .= '&leuser=' . $leuser;
}
if (isset($lestart))
{
$path .= '&lestart=' . $lestart;
}
if (isset($leend))
{
$path .= '&leend=' . $leend;
}
if (isset($ledir))
{
$path .= '&ledir=' . $ledir;
}
if (isset($lelimit))
{
$path .= '&lelimit=' . $lelimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get recent changes on a site.
*
* @param string $rcstart Starting timestamp.
* @param string $rcend Ending timestamp.
* @param string $rcdir Direction of enumeration.
* @param array $rcnamespace Filter changes to only this namespace(s).
* @param string $rcuser Filter changes by this user.
* @param string $rcexcludeuser Filter changes to exclude changes by this user.
* @param string $rctag Filter changes by this tag.
* @param array $rcprop Filter log actions to only this type.
* @param array $rctoken Which token to obtain for each change.
* @param array $rcshow Filter changes by this criteria.
* @param string $rclimit Changes limit to return.
* @param string $rctype Filter event by type of changes.
* @param string $rctoponly Filter changes which are latest revision.
*
* @return object
*
* @since 12.3
*/
public function getRecentChanges($rcstart = null, $rcend = null, $rcdir = null, array $rcnamespace = null, $rcuser = null, $rcexcludeuser = null,
$rctag = null, array $rcprop = null, array $rctoken = null, array $rcshow = null, $rclimit = null, $rctype = null, $rctoponly = null)
{
// Build the request.
$path = '?action=query&list=recentchanges';
if (isset($rcstart))
{
$path .= '&rcstart=' . $rcstart;
}
if (isset($rcend))
{
$path .= '&rcend=' . $rcend;
}
if (isset($rcdir))
{
$path .= '&rcdir=' . $rcdir;
}
if (isset($rcnamespace))
{
$path .= '&rcnamespaces=' . $this->buildParameter($rcnamespace);
}
if (isset($rcuser))
{
$path .= '&rcuser=' . $rcuser;
}
if (isset($rcexcludeuser))
{
$path .= '&rcexcludeuser=' . $rcexcludeuser;
}
if (isset($rctag))
{
$path .= '&rctag=' . $rctag;
}
if (isset($rcprop))
{
$path .= '&rcprop=' . $this->buildParameter($rcprop);
}
if (isset($rctoken))
{
$path .= '&rctoken=' . $this->buildParameter($rctoken);
}
if (isset($rcshow))
{
$path .= '&rcshow=' . $this->buildParameter($rcshow);
}
if (isset($rclimit))
{
$path .= '&rclimit=' . $rclimit;
}
if (isset($rctype))
{
$path .= '&rctype=' . $rctype;
}
if (isset($rctoponly))
{
$path .= '&rctoponly=' . $rctoponly;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get protected titles on a site.
*
* @param array $ptnamespace Only list titles in this namespace.
* @param array $ptlevel Only list titles with these protection level.
* @param integer $ptlimit Limit of pages to return.
* @param string $ptdir Direction of enumeration.
* @param string $ptstart Starting timestamp.
* @param string $ptend Ending timestamp.
* @param array $ptprop List of properties to get.
*
* @return object
*
* @since 12.3
*/
public function getProtectedTitles(array $ptnamespace = null, array $ptlevel = null, $ptlimit = null, $ptdir = null, $ptstart = null,
$ptend = null, array $ptprop = null)
{
// Build the request.
$path = '?action=query&list=protectedtitles';
if (isset($ptnamespace))
{
$path .= '&ptnamespace=' . $this->buildParameter($ptnamespace);
}
if (isset($ptlevel))
{
$path .= '&ptlevel=' . $this->buildParameter($ptlevel);
}
if (isset($ptlimit))
{
$path .= '&ptlimit=' . $ptlimit;
}
if (isset($ptdir))
{
$path .= '&ptdir=' . $ptdir;
}
if (isset($ptstart))
{
$path .= '&ptstart=' . $ptstart;
}
if (isset($ptend))
{
$path .= '&ptend=' . $ptend;
}
if (isset($ptprop))
{
$path .= '&ptprop=' . $this->buildParameter($ptprop);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}
search.php 0000666 00000006351 15077506434 0006546 0 ustar 00 buildParameter($srnamespace);
}
if (isset($srwhat))
{
$path .= '&srwhat=' . $srwhat;
}
if (isset($srinfo))
{
$path .= '&srinfo=' . $this->buildParameter($srinfo);
}
if (isset($srprop))
{
$path .= '&srprop=' . $this->buildParameter($srprop);
}
if ($srredirects)
{
$path .= '&srredirects=';
}
if (isset($sroffest))
{
$path .= '&sroffest=' . $sroffest;
}
if (isset($srlimit))
{
$path .= '&srlimit=' . $srlimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to search the wiki using opensearch protocol.
*
* @param string $search Search string.
* @param integer $limit Maximum amount of results to return.
* @param array $namespace Namespaces to search.
* @param string $suggest Do nothing if $wgEnableOpenSearchSuggest is false.
* @param string $format Output format.
*
* @return object
*
* @since 12.3
*/
public function openSearch($search, $limit = null, array $namespace = null, $suggest = null, $format = null)
{
// Build the request.
$path = '?action=query&list=search';
if (isset($search))
{
$path .= '&search=' . $search;
}
if (isset($limit))
{
$path .= '&limit=' . $limit;
}
if (isset($namespace))
{
$path .= '&namespace=' . $this->buildParameter($namespace);
}
if (isset($suggest))
{
$path .= '&suggest=' . $suggest;
}
if (isset($format))
{
$path .= '&format=' . $format;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}
http.php 0000666 00000005144 15077506434 0006257 0 ustar 00 options = isset($options) ? $options : new JRegistry;
$this->transport = isset($transport) ? $transport : new JHttpTransportStream($this->options);
// Make sure the user agent string is defined.
$this->options->def('api.useragent', 'JMediawiki/1.0');
// Set the default timeout to 120 seconds.
$this->options->def('api.timeout', 120);
}
/**
* Method to send the GET command to the server.
*
* @param string $url Path to the resource.
* @param array $headers An array of name-value pairs to include in the header of the request.
*
* @return JHttpResponse
*
* @since 12.3
*/
public function get($url, array $headers = null)
{
// Look for headers set in the options.
$temp = (array) $this->options->get('headers');
foreach ($temp as $key => $val)
{
if (!isset($headers[$key]))
{
$headers[$key] = $val;
}
}
return $this->transport->request('GET', new JUri($url), null, $headers, $this->options->get('api.timeout'), $this->options->get('api.useragent'));
}
/**
* Method to send the POST command to the server.
*
* @param string $url Path to the resource.
* @param mixed $data Either an associative array or a string to be sent with the request.
* @param array $headers An array of name-value pairs to include in the header of the request.
*
* @return JHttpResponse
*
* @since 12.3
*/
public function post($url, $data, array $headers = null)
{
// Look for headers set in the options.
$temp = (array) $this->options->get('headers');
foreach ($temp as $key => $val)
{
if (!isset($headers[$key]))
{
$headers[$key] = $val;
}
}
return $this->transport->request('POST', new JUri($url), $data, $headers, $this->options->get('api.timeout'), $this->options->get('api.useragent'));
}
}
mediawiki.php 0000666 00000007701 15077506434 0007244 0 ustar 00 options = isset($options) ? $options : new JRegistry;
$this->client = isset($client) ? $client : new JMediawikiHttp($this->options);
}
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @return JMediaWikiObject MediaWiki API object (users, reviews, etc).
*
* @since 12.3
* @throws InvalidArgumentException
*/
public function __get($name)
{
$name = strtolower($name);
$class = 'JMediawiki' . ucfirst($name);
$accessible = array(
'categories',
'images',
'links',
'pages',
'search',
'sites',
'users'
);
if (class_exists($class) && in_array($name, $accessible))
{
if (!isset($this->$name))
{
$this->$name = new $class($this->options, $this->client);
}
return $this->$name;
}
throw new InvalidArgumentException(sprintf('Property %s is not accessible.', $name));
}
/**
* Get an option from the JMediawiki instance.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 12.3
*/
public function getOption($key)
{
return $this->options->get($key);
}
/**
* Set an option for the JMediawiki instance.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return JMediawiki This object for method chaining.
*
* @since 12.3
*/
public function setOption($key, $value)
{
$this->options->set($key, $value);
return $this;
}
}
pages.php 0000666 00000041415 15077506434 0006400 0 ustar 00 getToken($title, 'edit');
// Build the request path.
$path = '?action=edit';
// Build the request data.
$data = array(
'title' => $title,
'token' => $token,
'section' => $section,
'sectiontitle' => $section,
'text' => $text,
'summary' => $summary
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function deletePageByName($title, $reason = null, $watchlist = null, $oldimage = null)
{
// Get the token.
$token = $this->getToken($title, 'delete');
// Build the request path.
$path = '?action=delete';
// Build the request data.
$data = array(
'title' => $title,
'token' => $token,
'reason' => $reason,
'watchlist' => $watchlist,
'oldimage' => $oldimage
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function deletePageByID($pageid, $reason = null, $watchlist = null, $oldimage = null)
{
// Get the token.
$token = $this->getToken($pageid, 'delete');
// Build the request path.
$path = '?action=delete';
// Build the request data.
$data = array(
'pageid' => $pageid,
'token' => $token,
'reason' => $reason,
'watchlist' => $watchlist,
'oldimage' => $oldimage
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function undeletePage($title, $reason = null, $timestamp = null, $watchlist = null)
{
// Get the token.
$token = $this->getToken($title, 'undelete');
// Build the request path.
$path = '?action=undelete';
// Build the request data.
$data = array(
'title' => $title,
'token' => $token,
'reason' => $reason,
'timestamp' => $timestamp,
'watchlist' => $watchlist,
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* Method to move a page.
*
* @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.
*
* @return object
*
* @since 12.3
*/
public function movePageByName($from, $to, $reason = null, $movetalk = null, $movesubpages = null, $noredirect = null,
$watchlist =null, $ignorewarnings = null)
{
// Get the token.
$token = $this->getToken($from, 'move');
// Build the request path.
$path = '?action=move';
// Build the request data.
$data = array(
'from' => $from,
'to' => $reason,
'token' => $token,
'reason' => $reason,
'movetalk' => $movetalk,
'movesubpages' => $movesubpages,
'noredirect' => $noredirect,
'watchlist' => $watchlist,
'ignorewarnings' => $ignorewarnings
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* Method to move a page.
*
* @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.
*
* @return object
*
* @since 12.3
*/
public function movePageByID($fromid, $to, $reason = null, $movetalk = null, $movesubpages = null, $noredirect = null,
$watchlist =null, $ignorewarnings = null)
{
// Get the token.
$token = $this->getToken($fromid, 'move');
// Build the request path.
$path = '?action=move';
// Build the request data.
$data = array(
'fromid' => $fromid,
'to' => $reason,
'token' => $token,
'reason' => $reason,
'movetalk' => $movetalk,
'movesubpages' => $movesubpages,
'noredirect' => $noredirect,
'watchlist' => $watchlist,
'ignorewarnings' => $ignorewarnings
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function rollback($title, $user, $summary = null, $markbot = null, $watchlist = null)
{
// Get the token.
$token = $this->getToken($title, 'rollback');
// Build the request path.
$path = '?action=rollback';
// Build the request data.
$data = array(
'title' => $title,
'token' => $token,
'user' => $user,
'expiry' => $summary,
'markbot' => $markbot,
'watchlist' => $watchlist
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function changeProtection($title, $protections, $expiry = null, $reason = null, $cascade = null, $watchlist = null)
{
// Get the token.
$token = $this->getToken($title, 'unblock');
// Build the request path.
$path = '?action=protect';
// Build the request data.
$data = array(
'title' => $title,
'token' => $token,
'protections' => $protections,
'expiry' => $expiry,
'reason' => $reason,
'cascade' => $cascade,
'watchlist' => $watchlist
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function getPageInfo(array $titles, array $inprop = null, array $intoken = null, $incontinue = null)
{
// Build the request
$path = '?action=query&prop=info';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($inprop))
{
$path .= '&inprop=' . $this->buildParameter($inprop);
}
if (isset($intoken))
{
$path .= '&intoken=' . $this->buildParameter($intoken);
}
if ($incontinue)
{
$path .= '&incontinue=';
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function getPageProperties(array $titles, $ppcontinue = null, $ppprop = null)
{
// Build the request
$path = '?action=query&prop=pageprops';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if ($ppcontinue)
{
$path .= '&ppcontinue=';
}
if (isset($ppprop))
{
$path .= '&ppprop=' . $ppprop;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function getRevisions(array $titles, array $rvprop = null, $rvparse = null, $rvlimit = null)
{
// Build the request
$path = '?action=query&prop=revisions';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($rvprop))
{
$path .= '&rvprop=' . $this->buildParameter($rvprop);
}
if ($rvparse)
{
$path .= '&rvparse=';
}
if (isset($rvlimit))
{
$path .= '&rvlimit=' . $rvlimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function getPageTemplates(array $titles, array $tlnamespace = null, $tllimit = null, $tlcontinue = null, $tltemplates = null, $tldir = null)
{
// Build the request.
$path = '?action=query&prop=templates';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($tlnamespace))
{
$path .= '&tlnamespace=' . $this->buildParameter($tlnamespace);
}
if (isset($tllimit))
{
$path .= '&tllimit=' . $tllimit;
}
if ($tlcontinue)
{
$path .= '&tlcontinue=';
}
if (isset($tltemplates))
{
$path .= '&tltemplates=' . $tltemplates;
}
if (isset($tldir))
{
$path .= '&tldir=' . $tldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function getBackLinks($bltitle, $blpageid = null, $blcontinue = null, array $blnamespace = null, $blfilterredirect = null,
$bllimit = null, $blredirect = null)
{
// Build the request.
$path = '?action=query&list=backlinks';
if (isset($bltitle))
{
$path .= '&bltitle=' . $bltitle;
}
if (isset($blpageid))
{
$path .= '&blpageid=' . $blpageid;
}
if ($blcontinue)
{
$path .= '&blcontinue=';
}
if (isset($blnamespace))
{
$path .= '&blnamespace=' . $this->buildParameter($blnamespace);
}
if (isset($blfilterredirect))
{
$path .= '&blfilterredirect=' . $blfilterredirect;
}
if (isset($bllimit))
{
$path .= '&bllimit=' . $bllimit;
}
if ($blredirect)
{
$path .= '&blredirect=';
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* 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.
*
* @return object
*
* @since 12.3
*/
public function getIWBackLinks($iwbltitle, $iwblprefix = null, $iwblcontinue = null, $iwbllimit = null, array $iwblprop = null)
{
// Build the request
$path = '?action=query&list=iwbacklinks';
if (isset($iwbltitle))
{
$path .= '&iwbltitle=' . $iwbltitle;
}
if (isset($iwblprefix))
{
$path .= '&iwblprefix=' . $iwblprefix;
}
if ($iwblcontinue)
{
$path .= '&iwblcontinue=';
}
if (isset($iwbllimit))
{
$path .= '&bllimit=' . $iwbllimit;
}
if (isset($iwblprop))
{
$path .= '&iwblprop=' . $this->buildParameter($iwblprop);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get access token.
*
* @param string $user The User to get token.
* @param string $intoken The type of token.
*
* @return object
*
* @since 12.1
*/
public function getToken($user, $intoken)
{
// Build the request path.
$path = '?action=query&prop=info&intoken=' . $intoken . '&titles=User:' . $user;
// Send the request.
$response = $this->client->post($this->fetchUrl($path), null);
return (string) $this->validateResponse($response)->query->pages->page[$intoken . 'token'];
}
}
categories.php 0000666 00000022561 15077506434 0007427 0 ustar 00 buildParameter($titles);
if (isset($clprop))
{
$path .= '&clprop=' . $this->buildParameter($clprop);
}
if (isset($clshow))
{
$path .= '&$clshow=' . $this->buildParameter($clshow);
}
if (isset($cllimit))
{
$path .= '&cllimit=' . $cllimit;
}
if ($clcontinue)
{
$path .= '&clcontinue=';
}
if (isset($clcategories))
{
$path .= '&clcategories=' . $this->buildParameter($clcategories);
}
if (isset($cldir))
{
$path .= '&cldir=' . $cldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get information about all categories used.
*
* @param array $titles Page titles to retrieve categories.
*
* @return object
*
* @since 12.3
*/
public function getCategoriesUsed(array $titles)
{
// Build the request
$path = '?action=query&generator=categories&prop=info';
// Append titles to the request
$path .= '&titles=' . $this->buildParameter($titles);
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get information about the given categories.
*
* @param array $titles Page titles to retrieve categories.
* @param boolean $clcontinue Continue when more results are available.
*
* @return object
*
* @since 12.3
*/
public function getCategoriesInfo(array $titles, $clcontinue = false)
{
// Build the request.
$path = '?action=query&prop=categoryinfo';
// Append titles to the request
$path .= '&titles=' . $this->buildParameter($titles);
if ($clcontinue)
{
$path .= '&clcontinue=';
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get information about the pages within a category
*
* @param string $cmtitle The category title, must contain 'Category:' prefix, cannot be used together with $cmpageid
* @param string $cmpageid The category's page ID, cannot be used together with $cmtitle
* @param string $cmlimit Maximum number of pages to retrieve
* @param array $cmprop Array of properties to retrieve
* @param array $cmnamespace Namespaces to retrieve pages from
* @param array $cmtype Array of category members to include, ignored if $cmsort is set to 'timestamp'
* @param string $cmstart Timestamp to start listing from, only used if $cmsort is set to 'timestamp'
* @param string $cmend Timestamp to end listing at, only used if $cmsort is set to 'timestamp'
* @param string $cmstartsortkey Hexadecimal key to start listing from, only used if $cmsort is set to 'sortkey'
* @param string $cmendsortkey Hexadecimal key to end listing at, only used if $cmsort is set to 'sortkey'
* @param string $cmstartsortkeyprefix Hexadecimal key prefix to start listing from, only used if $cmsort is set to 'sortkey',
* overrides $cmstartsortkey
* @param string $cmendsortkeyprefix Hexadecimal key prefix to end listing before, only used if $cmsort is set to 'sortkey',
* overrides $cmendsortkey
* @param string $cmsort Property to sort by
* @param string $cmdir Direction to sort in
* @param string $cmcontinue Used to continue a previous request
*
* @return object
*
* @since 3.2.2 (CMS)
* @throws RuntimeException
*/
public function getCategoryMembers($cmtitle = null, $cmpageid = null, $cmlimit = null, array $cmprop = null, array $cmnamespace = null,
array $cmtype = null, $cmstart = null, $cmend = null, $cmstartsortkey = null, $cmendsortkey = null, $cmstartsortkeyprefix = null,
$cmendsortkeyprefix = null, $cmsort = null, $cmdir = null, $cmcontinue = null)
{
// Build the request.
$path = '?action=query&list=categorymembers';
// Make sure both $cmtitle and $cmpageid are not set
if (isset($cmtitle) && isset($cmpageid))
{
throw new RuntimeException('Both the $cmtitle and $cmpageid parameters cannot be set, please only use one of the two.');
}
if (isset($cmtitle))
{
// Verify that the Category: prefix exists
if (strpos($cmtitle, 'Category:') !== 0)
{
throw new RuntimeException('The $cmtitle parameter must include the Category: prefix.');
}
$path .= '&cmtitle=' . $cmtitle;
}
if (isset($cmpageid))
{
$path .= '&cmpageid=' . $cmpageid;
}
if (isset($cmlimit))
{
$path .= '&cmlimit=' . $cmlimit;
}
if (isset($cmprop))
{
$path .= '&cmprop=' . $this->buildParameter($cmprop);
}
if (isset($cmnamespace))
{
$path .= '&cmnamespace=' . $this->buildParameter($cmnamespace);
}
if (isset($cmtype))
{
$path .= '&cmtype=' . $this->buildParameter($cmtype);
}
if (isset($cmstart))
{
$path .= '&cmstart=' . $cmstart;
}
if (isset($cmend))
{
$path .= '&cmend=' . $cmend;
}
if (isset($cmstartsortkey))
{
$path .= '&cmstartsortkey=' . $cmstartsortkey;
}
if (isset($cmendsortkey))
{
$path .= '&cmendsortkey=' . $cmendsortkey;
}
if (isset($cmstartsortkeyprefix))
{
$path .= '&cmstartsortkeyprefix=' . $cmstartsortkeyprefix;
}
if (isset($cmendsortkeyprefix))
{
$path .= '&cmendsortkeyprefix=' . $cmendsortkeyprefix;
}
if (isset($cmsort))
{
$path .= '&cmsort=' . $cmsort;
}
if (isset($cmdir))
{
$path .= '&cmdir=' . $cmdir;
}
if (isset($cmcontinue))
{
$path .= '&cmcontinue=' . $cmcontinue;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to enumerate all categories.
*
* @param string $acfrom The category to start enumerating from.
* @param string $acto The category to stop enumerating at.
* @param string $acprefix Search for all category titles that begin with this value.
* @param string $acdir Direction to sort in.
* @param integer $acmin Minimum number of category members.
* @param integer $acmax Maximum number of category members.
* @param integer $aclimit How many categories to return.
* @param array $acprop Which properties to get.
*
* @return object
*
* @since 12.3
*/
public function enumerateCategories($acfrom = null, $acto = null, $acprefix = null, $acdir = null, $acmin = null,
$acmax = null, $aclimit = null, array $acprop = null)
{
// Build the request.
$path = '?action=query&list=allcategories';
if (isset($acfrom))
{
$path .= '&acfrom=' . $acfrom;
}
if (isset($acto))
{
$path .= '&acto=' . $acto;
}
if (isset($acprefix))
{
$path .= '&acprefix=' . $acprefix;
}
if (isset($acdir))
{
$path .= '&acdir=' . $acdir;
}
if (isset($acfrom))
{
$path .= '&acfrom=' . $acfrom;
}
if (isset($acmin))
{
$path .= '&acmin=' . $acmin;
}
if (isset($acmax))
{
$path .= '&acmax=' . $acmax;
}
if (isset($aclimit))
{
$path .= '&aclimit=' . $aclimit;
}
if (isset($acprop))
{
$path .= '&acprop=' . $this->buildParameter($acprop);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to list change tags.
*
* @param array $tgprop List of properties to get.
* @param string $tglimit The maximum number of tags to limit.
*
* @return object
*
* @since 12.3
*/
public function getChangeTags(array $tgprop = null, $tglimit = null)
{
// Build the request.
$path = '?action=query&list=tags';
if (isset($tgprop))
{
$path .= '&tgprop=' . $this->buildParameter($tgprop);
}
if (isset($tglimit))
{
$path .= '&tglimit=' . $tglimit;
}
// @TODO add support for $tgcontinue
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}
users.php 0000666 00000027156 15077506434 0006450 0 ustar 00 client->post($this->fetchUrl($path), null);
// Request path with login token.
$path = '?action=login&lgname=' . $lgname . '&lgpassword=' . $lgpassword . '&lgtoken=' . $this->validateResponse($response)->login['token'];
if (isset($lgdomain))
{
$path .= '&lgdomain=' . $lgdomain;
}
// Set the session cookies returned.
$headers = (array) $this->options->get('headers');
$headers['Cookie'] = !empty($headers['Cookie']) ? empty($headers['Cookie']) : '';
$headers['Cookie'] = $headers['Cookie'] . $response->headers['Set-Cookie'];
$this->options->set('headers', $headers);
// Send the request again with the token.
$response = $this->client->post($this->fetchUrl($path), null);
$response_body = $this->validateResponse($response);
$headers = (array) $this->options->get('headers');
$cookie_prefix = $response_body->login['cookieprefix'];
$cookie = $cookie_prefix . 'UserID=' . $response_body->login['lguserid'] . '; ' . $cookie_prefix
. 'UserName=' . $response_body->login['lgusername'];
$headers['Cookie'] = $headers['Cookie'] . '; ' . $response->headers['Set-Cookie'] . '; ' . $cookie;
$this->options->set('headers', $headers);
return $this->validateResponse($response);
}
/**
* Method to logout and clear session data.
*
* @return object
*
* @since 12.3
*/
public function logout()
{
// Build the request path.
$path = '?action=login';
// @TODO clear internal data as well
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get user information.
*
* @param array $ususers A list of users to obtain the same information for.
* @param array $usprop What pieces of information to include.
*
* @return object
*
* @since 12.3
*/
public function getUserInfo(array $ususers, array $usprop = null)
{
// Build the request path.
$path = '?action=query&list=users';
// Append users to the request.
$path .= '&ususers=' . $this->buildParameter($ususers);
if (isset($usprop))
{
$path .= '&usprop' . $this->buildParameter($usprop);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get current user information.
*
* @param array $uiprop What pieces of information to include.
*
* @return object
*
* @since 12.3
*/
public function getCurrentUserInfo(array $uiprop = null)
{
// Build the request path.
$path = '?action=query&meta=userinfo';
if (isset($uiprop))
{
$path .= '&uiprop' . $this->buildParameter($uiprop);
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get user contributions.
*
* @param string $ucuser The users to retrieve contributions for.
* @param string $ucuserprefix Retrieve contibutions for all users whose names begin with this value.
* @param integer $uclimit The users to retrieve contributions for.
* @param string $ucstart The start timestamp to return from.
* @param string $ucend The end timestamp to return to.
* @param boolean $uccontinue When more results are available, use this to continue.
* @param string $ucdir In which direction to enumerate.
* @param array $ucnamespace Only list contributions in these namespaces.
* @param array $ucprop Include additional pieces of information.
* @param array $ucshow Show only items that meet this criteria.
* @param string $uctag Only list revisions tagged with this tag.
* @param string $uctoponly Only list changes which are the latest revision
*
* @return object
*
* @since 12.3
*/
public function getUserContribs($ucuser = null, $ucuserprefix = null, $uclimit = null, $ucstart = null, $ucend = null, $uccontinue = null,
$ucdir = null, array $ucnamespace = null, array $ucprop = null, array $ucshow = null, $uctag = null, $uctoponly = null)
{
// Build the request path.
$path = '?action=query&list=usercontribs';
if (isset($ucuser))
{
$path .= '&ucuser=' . $ucuser;
}
if (isset($ucuserprefix))
{
$path .= '&ucuserprefix=' . $ucuserprefix;
}
if (isset($uclimit))
{
$path .= '&uclimit=' . $uclimit;
}
if (isset($ucstart))
{
$path .= '&ucstart=' . $ucstart;
}
if (isset($ucend))
{
$path .= '&ucend=' . $ucend;
}
if ($uccontinue)
{
$path .= '&uccontinue=';
}
if (isset($ucdir))
{
$path .= '&ucdir=' . $ucdir;
}
if (isset($ucnamespace))
{
$path .= '&ucnamespace=' . $this->buildParameter($ucnamespace);
}
if (isset($ucprop))
{
$path .= '&ucprop=' . $this->buildParameter($ucprop);
}
if (isset($ucshow))
{
$path .= '&ucshow=' . $this->buildParameter($ucshow);
}
if (isset($uctag))
{
$path .= '&uctag=' . $uctag;
}
if (isset($uctoponly))
{
$path .= '&uctoponly=' . $uctoponly;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to block a user.
*
* @param string $user Username, IP address or IP range you want to block.
* @param string $expiry Relative expiry time, Default: never.
* @param string $reason Reason for block (optional).
* @param boolean $anononly Block anonymous users only.
* @param boolean $nocreate Prevent account creation.
* @param boolean $autoblock Automatically block the last used IP address, and any subsequent IP addresses they try to login from.
* @param boolean $noemail Prevent user from sending e-mail through the wiki.
* @param boolean $hidename Hide the username from the block log.
* @param boolean $allowusertalk Allow the user to edit their own talk page.
* @param boolean $reblock If the user is already blocked, overwrite the existing block.
* @param boolean $watchuser Watch the user/IP's user and talk pages.
*
* @return object
*
* @since 12.3
*/
public function blockUser($user, $expiry = null, $reason = null, $anononly = null, $nocreate = null, $autoblock = null, $noemail = null,
$hidename = null, $allowusertalk = null, $reblock = null, $watchuser = null)
{
// Get the token.
$token = $this->getToken($user, 'block');
// Build the request path.
$path = '?action=unblock';
// Build the request data.
$data = array(
'user' => $user,
'token' => $token,
'expiry' => $expiry,
'reason' => $reason,
'anononly' => $anononly,
'nocreate' => $nocreate,
'autoblock' => $autoblock,
'noemail' => $noemail,
'hidename' => $hidename,
'allowusetalk' => $allowusertalk,
'reblock' => $reblock,
'watchuser' => $watchuser
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* Method to unblock a user.
*
* @param string $user Username, IP address or IP range you want to unblock.
* @param string $reason Reason for unblock (optional).
*
* @return object
*
* @since 12.3
*/
public function unBlockUserByName($user, $reason = null)
{
// Get the token.
$token = $this->getToken($user, 'unblock');
// Build the request path.
$path = '?action=unblock';
// Build the request data.
$data = array(
'user' => $user,
'token' => $token,
'reason' => $reason,
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* Method to unblock a user.
*
* @param int $id Username, IP address or IP range you want to unblock.
* @param string $reason Reason for unblock (optional).
*
* @return object
*
* @since 12.3
*/
public function unBlockUserByID($id, $reason = null)
{
// Get the token.
$token = $this->getToken($id, 'unblock');
// Build the request path.
$path = '?action=unblock';
// Build the request data.
// TODO: $data doesn't seem to be used!
$data = array(
'id' => $id,
'token' => $token,
'reason' => $reason,
);
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to assign a user to a group.
*
* @param string $username User name.
* @param array $add Add the user to these groups.
* @param array $remove Remove the user from these groups.
* @param string $reason Reason for the change.
*
* @return object
*
* @since 12.3
*/
public function assignGroup($username, $add = null, $remove = null, $reason = null)
{
// Get the token.
$token = $this->getToken($username, 'unblock');
// Build the request path.
$path = '?action=userrights';
// Build the request data.
$data = array(
'username' => $username,
'token' => $token,
'add' => $add,
'remove' => $remove,
'reason' => $reason
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* Method to email a user.
*
* @param string $target User to send email to.
* @param string $subject Subject header.
* @param string $text Mail body.
* @param boolean $ccme Send a copy of this mail to me.
*
* @return object
*
* @since 12.3
*/
public function emailUser($target, $subject = null, $text = null, $ccme = null)
{
// Get the token.
$token = $this->getToken($target, 'emailuser');
// Build the request path.
$path = '?action=emailuser';
// Build the request data.
$data = array(
'target' => $target,
'token' => $token,
'subject' => $subject,
'text' => $text,
'ccme' => $ccme
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
return $this->validateResponse($response);
}
/**
* Method to get access token.
*
* @param string $user The User to get token.
* @param string $intoken The type of token.
*
* @return object
*
* @since 12.3
*/
public function getToken($user, $intoken)
{
// Build the request path.
$path = '?action=query&prop=info&intoken=' . $intoken . '&titles=User:' . $user;
// Send the request.
$response = $this->client->post($this->fetchUrl($path), null);
return (string) $this->validateResponse($response)->query->pages->page[$intoken . 'token'];
}
}
object.php 0000666 00000005232 15077506434 0006544 0 ustar 00 options = isset($options) ? $options : new JRegistry;
$this->client = isset($client) ? $client : new JMediawikiHttp($this->options);
}
/**
* Method to build and return a full request URL for the request.
*
* @param string $path URL to inflect
*
* @return string The request URL.
*
* @since 12.3
*/
protected function fetchUrl($path)
{
// Append the path with output format
$path .= '&format=xml';
$uri = new JUri($this->options->get('api.url') . '/api.php' . $path);
if ($this->options->get('api.username', false))
{
$uri->setUser($this->options->get('api.username'));
}
if ($this->options->get('api.password', false))
{
$uri->setPass($this->options->get('api.password'));
}
return (string) $uri;
}
/**
* Method to build request parameters from a string array.
*
* @param array $params string array that contains the parameters
*
* @return string request parameter
*
* @since 12.3
*/
public function buildParameter(array $params)
{
$path = '';
foreach ($params as $param)
{
$path .= $param;
if (next($params) == true)
{
$path .= '|';
}
}
return $path;
}
/**
* Method to validate response for errors
*
* @param JHttpresponse $response reponse from the mediawiki server
*
* @return Object
*
* @since 12.3
*/
public function validateResponse($response)
{
$xml = simplexml_load_string($response->body);
if (isset($xml->warnings))
{
throw new DomainException($xml->warnings->info);
}
if (isset($xml->error))
{
throw new DomainException($xml->error['info']);
}
return $xml;
}
}
links.php 0000666 00000020025 15077506434 0006413 0 ustar 00 buildParameter($titles);
if (isset($plnamespace))
{
$path .= '&plnamespace=' . $this->buildParameter($plnamespace);
}
if (isset($pllimit))
{
$path .= '&pllimit=' . $pllimit;
}
if (isset($plcontinue))
{
$path .= '&plcontinue=' . $plcontinue;
}
if (isset($pltitles))
{
$path .= '&pltitles=' . $this->buildParameter($pltitles);
}
if (isset($pldir))
{
$path .= '&pldir=' . $pldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return info about the link pages.
*
* @param array $titles Page titles to retrieve links.
*
* @return object
*
* @since 12.3
*/
public function getLinksUsed(array $titles)
{
// Build the request.
$path = '?action=query&generator=links&prop=info';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all interwiki links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param boolean $iwurl Whether to get the full url.
* @param integer $iwlimit Number of interwiki links to return.
* @param boolean $iwcontinue When more results are available, use this to continue.
* @param string $iwprefix Prefix for the interwiki.
* @param string $iwtitle Interwiki link to search for.
* @param string $iwdir The direction in which to list.
*
* @return object
*
* @since 12.3
*/
public function getIWLinks(array $titles, $iwurl = false, $iwlimit = null, $iwcontinue = false, $iwprefix = null, $iwtitle = null, $iwdir = null)
{
// Build the request.
$path = '?action=query&prop=links';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if ($iwurl)
{
$path .= '&iwurl=';
}
if (isset($iwlimit))
{
$path .= '&iwlimit=' . $iwlimit;
}
if ($iwcontinue)
{
$path .= '&iwcontinue=';
}
if (isset($iwprefix))
{
$path .= '&iwprefix=' . $iwprefix;
}
if (isset($iwtitle))
{
$path .= '&iwtitle=' . $iwtitle;
}
if (isset($iwdir))
{
$path .= '&iwdir=' . $iwdir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all interlanguage links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param integer $lllimit Number of langauge links to return.
* @param boolean $llcontinue When more results are available, use this to continue.
* @param string $llurl Whether to get the full URL.
* @param string $lllang Language code.
* @param string $lltitle Link to search for.
* @param string $lldir The direction in which to list.
*
* @return object
*
* @since 12.3
*/
public function getLangLinks(array $titles, $lllimit = null, $llcontinue = false, $llurl = null, $lllang = null, $lltitle = null, $lldir = null)
{
// Build the request.
$path = '?action=query&prop=langlinks';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($lllimit))
{
$path .= '&lllimit=' . $lllimit;
}
if ($llcontinue)
{
$path .= '&llcontinue=';
}
if (isset($llurl))
{
$path .= '&llurl=' . $llurl;
}
if (isset($lllang))
{
$path .= '&lllang=' . $lllang;
}
if (isset($lltitle))
{
$path .= '&lltitle=' . $lltitle;
}
if (isset($lldir))
{
$path .= '&lldir=' . $lldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all external urls from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param integer $ellimit Number of links to return.
* @param string $eloffset When more results are available, use this to continue.
* @param string $elprotocol Protocol of the url.
* @param string $elquery Search string without protocol.
*
* @return object
*
* @since 12.3
*/
public function getExtLinks(array $titles, $ellimit = null, $eloffset = null, $elprotocol = null, $elquery = null)
{
// Build the request.
$path = '?action=query&prop=extlinks';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($ellimit))
{
$path .= '&ellimit=' . $ellimit;
}
if (isset($eloffset))
{
$path .= '&eloffset=' . $eloffset;
}
if (isset($elprotocol))
{
$path .= '&elprotocol=' . $elprotocol;
}
if (isset($elquery))
{
$path .= '&elquery=' . $elquery;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to enumerate all links that point to a given namespace.
*
* @param boolean $alcontinue When more results are available, use this to continue.
* @param string $alfrom Start listing at this title. The title need not exist.
* @param string $alto The page title to stop enumerating at.
* @param string $alprefix Search for all page titles that begin with this value.
* @param string $alunique Only show unique links.
* @param array $alprop What pieces of information to include.
* @param string $alnamespace The namespace to enumerate.
* @param integer $allimit Number of links to return.
*
* @return object
*
* @since 12.3
*/
public function enumerateLinks($alcontinue = false, $alfrom = null, $alto = null, $alprefix = null, $alunique = null, array $alprop = null,
$alnamespace = null, $allimit = null)
{
// Build the request.
$path = '?action=query&meta=siteinfo';
if ($alcontinue)
{
$path .= '&alcontinue=';
}
if (isset($alfrom))
{
$path .= '&alfrom=' . $alfrom;
}
if (isset($alto))
{
$path .= '&alto=' . $alto;
}
if (isset($alprefix))
{
$path .= '&alprefix=' . $alprefix;
}
if (isset($alunique))
{
$path .= '&alunique=' . $alunique;
}
if (isset($alprop))
{
$path .= '&alprop=' . $this->buildParameter($alprop);
}
if (isset($alnamespace))
{
$path .= '&alnamespace=' . $alnamespace;
}
if (isset($allimit))
{
$path .= '&allimit=' . $allimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}
images.php 0000666 00000014370 15077506434 0006546 0 ustar 00 buildParameter($titles);
if (isset($imagelimit))
{
$path .= '&imagelimit=' . $imagelimit;
}
if ($imagecontinue)
{
$path .= '&imagecontinue=';
}
if (isset($imimages))
{
$path .= '&imimages=' . $imimages;
}
if (isset($imdir))
{
$path .= '&imdir=' . $imdir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get all images contained on the given page(s).
*
* @param array $titles Page titles to retrieve links.
*
* @return object
*
* @since 12.3
*/
public function getImagesUsed(array $titles)
{
// Build the request.
$path = '?action=query&generator=images&prop=info';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to get all image information and upload history.
*
* @param array $liprop What image information to get.
* @param integer $lilimit How many image revisions to return.
* @param string $listart Timestamp to start listing from.
* @param string $liend Timestamp to stop listing at.
* @param integer $liurlwidth URL to an image scaled to this width will be returned..
* @param integer $liurlheight URL to an image scaled to this height will be returned.
* @param string $limetadataversion Version of metadata to use.
* @param string $liurlparam A handler specific parameter string.
* @param boolean $licontinue When more results are available, use this to continue.
*
* @return object
*
* @since 12.3
*/
public function getImageInfo(array $liprop = null, $lilimit = null, $listart = null, $liend = null, $liurlwidth = null,
$liurlheight = null, $limetadataversion = null, $liurlparam = null, $licontinue = null)
{
// Build the request.
$path = '?action=query&prop=imageinfo';
if (isset($liprop))
{
$path .= '&liprop=' . $this->buildParameter($liprop);
}
if (isset($lilimit))
{
$path .= '&lilimit=' . $lilimit;
}
if (isset($listart))
{
$path .= '&listart=' . $listart;
}
if (isset($liend))
{
$path .= '&liend=' . $liend;
}
if (isset($liurlwidth))
{
$path .= '&liurlwidth=' . $liurlwidth;
}
if (isset($liurlheight))
{
$path .= '&liurlheight=' . $liurlheight;
}
if (isset($limetadataversion))
{
$path .= '&limetadataversion=' . $limetadataversion;
}
if (isset($liurlparam))
{
$path .= '&liurlparam=' . $liurlparam;
}
if ($licontinue)
{
$path .= '&alcontinue=';
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to enumerate all images.
*
* @param string $aifrom The image title to start enumerating from.
* @param string $aito The image title to stop enumerating at.
* @param string $aiprefix Search for all image titles that begin with this value.
* @param integer $aiminsize Limit to images with at least this many bytes.
* @param integer $aimaxsize Limit to images with at most this many bytes.
* @param integer $ailimit How many images in total to return.
* @param string $aidir The direction in which to list.
* @param string $aisha1 SHA1 hash of image.
* @param string $aisha1base36 SHA1 hash of image in base 36.
* @param array $aiprop What image information to get.
* @param string $aimime What MIME type to search for.
*
* @return object
*
* @since 12.3
*/
public function enumerateImages($aifrom = null, $aito = null, $aiprefix = null, $aiminsize = null, $aimaxsize = null, $ailimit = null,
$aidir = null, $aisha1 = null, $aisha1base36 = null, array $aiprop = null, $aimime = null)
{
// Build the request.
$path = '?action=query&list=allimages';
if (isset($aifrom))
{
$path .= '&aifrom=' . $aifrom;
}
if (isset($aito))
{
$path .= '&aito=' . $aito;
}
if (isset($aiprefix))
{
$path .= '&aiprefix=' . $aiprefix;
}
if (isset($aiminsize))
{
$path .= '&aiminsize=' . $aiminsize;
}
if (isset($aimaxsize))
{
$path .= '&aimaxsize=' . $aimaxsize;
}
if (isset($ailimit))
{
$path .= '&ailimit=' . $ailimit;
}
if (isset($aidir))
{
$path .= '&aidir=' . $aidir;
}
if (isset($aisha1))
{
$path .= '&aisha1=' . $aisha1;
}
if (isset($aisha1base36))
{
$path .= '&$aisha1base36=' . $aisha1base36;
}
if (isset($aiprop))
{
$path .= '&aiprop=' . $this->buildParameter($aiprop);
}
if (isset($aimime))
{
$path .= '&aimime=' . $aimime;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}