Source for file sites.php

Documentation is available at sites.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  MediaWiki
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * MediaWiki API Sites class for the Joomla Platform.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  MediaWiki
  17.  * @since       12.3
  18.  */
  19. {
  20.     /**
  21.      * Method to get site information.
  22.      *
  23.      * @param   array    $siprop            The sysinfo properties to get.
  24.      * @param   string   $sifilteriw        Only local or only non local entries to return.
  25.      * @param   boolean  $sishowalldb       List all database servers.
  26.      * @param   boolean  $sinumberingroup   List the number of users in usergroups.
  27.      * @param   array    $siinlanguagecode  Language code for localized languages.
  28.      *
  29.      * @return  object 
  30.      *
  31.      * @since   12.3
  32.      */
  33.     public function getSiteInfo(array $siprop null$sifilteriw null$sishowalldb false$sinumberingroup falsearray $siinlanguagecode null)
  34.     {
  35.         // Build the request.
  36.         $path '?action=query&meta=siteinfo';
  37.  
  38.         if (isset($siprop))
  39.         {
  40.             $path .= '&siprop=' $this->buildParameter($siprop);
  41.         }
  42.  
  43.         if (isset($sifilteriw))
  44.         {
  45.             $path .= '&sifilteriw=' $sifilteriw;
  46.         }
  47.  
  48.         if ($sishowalldb)
  49.         {
  50.             $path .= '&sishowalldb=';
  51.         }
  52.  
  53.         if ($sinumberingroup)
  54.         {
  55.             $path .= '&sinumberingroup=';
  56.         }
  57.  
  58.         if (isset($siinlanguagecode))
  59.         {
  60.             $path .= '&siinlanguagecode=' $this->buildParameter($siinlanguagecode);
  61.         }
  62.  
  63.         // Send the request.
  64.         $response $this->client->get($this->fetchUrl($path));
  65.  
  66.         return $this->validateResponse($response);
  67.     }
  68.  
  69.     /**
  70.      * Method to get events from logs.
  71.      *
  72.      * @param   array    $leprop    List of properties to get.
  73.      * @param   string   $letype    Filter log actions to only this type.
  74.      * @param   string   $leaction  Filter log actions to only this type.
  75.      * @param   string   $letitle   Filter entries to those related to a page.
  76.      * @param   string   $leprefix  Filter entries that start with this prefix.
  77.      * @param   string   $letag     Filter entries with tag.
  78.      * @param   string   $leuser    Filter entries made by the given user.
  79.      * @param   string   $lestart   Starting timestamp.
  80.      * @param   string   $leend     Ending timestamp.
  81.      * @param   string   $ledir     Direction of enumeration.
  82.      * @param   integer  $lelimit   Event limit to return.
  83.      *
  84.      * @return  object 
  85.      *
  86.      * @since   12.3
  87.      */
  88.     public function getEvents(array $leprop null$letype null$leaction null$letitle null$leprefix null$letag null,
  89.         $leuser null$lestart null$leend null$ledir null$lelimit null)
  90.     {
  91.         // Build the request
  92.         $path '?action=query&list=logevents';
  93.  
  94.         if (isset($leprop))
  95.         {
  96.             $path .= '&leprop=' $this->buildParameter($leprop);
  97.         }
  98.  
  99.         if (isset($letype))
  100.         {
  101.             $path .= '&letype=' $letype;
  102.         }
  103.  
  104.         if (isset($leaction))
  105.         {
  106.             $path .= '&leaction=' $leaction;
  107.         }
  108.  
  109.         if (isset($letitle))
  110.         {
  111.             $path .= '&letitle=' $letitle;
  112.         }
  113.  
  114.         if (isset($leprefix))
  115.         {
  116.             $path .= '&leprefix=' $leprefix;
  117.         }
  118.  
  119.         if (isset($letag))
  120.         {
  121.             $path .= '&letag=' $letag;
  122.         }
  123.  
  124.         if (isset($leuser))
  125.         {
  126.             $path .= '&leuser=' $leuser;
  127.         }
  128.  
  129.         if (isset($lestart))
  130.         {
  131.             $path .= '&lestart=' $lestart;
  132.         }
  133.  
  134.         if (isset($leend))
  135.         {
  136.             $path .= '&leend=' $leend;
  137.         }
  138.  
  139.         if (isset($ledir))
  140.         {
  141.             $path .= '&ledir=' $ledir;
  142.         }
  143.  
  144.         if (isset($lelimit))
  145.         {
  146.             $path .= '&lelimit=' $lelimit;
  147.         }
  148.  
  149.         // Send the request.
  150.         $response $this->client->get($this->fetchUrl($path));
  151.  
  152.         return $this->validateResponse($response);
  153.     }
  154.  
  155.     /**
  156.      * Method to get recent changes on a site.
  157.      *
  158.      * @param   string  $rcstart        Starting timestamp.
  159.      * @param   string  $rcend          Ending timestamp.
  160.      * @param   string  $rcdir          Direction of enumeration.
  161.      * @param   array   $rcnamespace    Filter changes to only this namespace(s).
  162.      * @param   string  $rcuser         Filter changes by this user.
  163.      * @param   string  $rcexcludeuser  Filter changes to exclude changes by this user.
  164.      * @param   string  $rctag          Filter changes by this tag.
  165.      * @param   array   $rcprop         Filter log actions to only this type.
  166.      * @param   array   $rctoken        Which token to obtain for each change.
  167.      * @param   array   $rcshow         Filter changes by this criteria.
  168.      * @param   string  $rclimit        Changes limit to return.
  169.      * @param   string  $rctype         Filter event by type of changes.
  170.      * @param   string  $rctoponly      Filter changes which are latest revision.
  171.      *
  172.      * @return  object 
  173.      *
  174.      * @since   12.3
  175.      */
  176.     public function getRecentChanges($rcstart null$rcend null$rcdir nullarray $rcnamespace null$rcuser null$rcexcludeuser null,
  177.         $rctag nullarray $rcprop nullarray $rctoken nullarray $rcshow null$rclimit null$rctype null$rctoponly null)
  178.     {
  179.         // Build the request.
  180.         $path '?action=query&list=recentchanges';
  181.  
  182.         if (isset($rcstart))
  183.         {
  184.             $path .= '&rcstart=' $rcstart;
  185.         }
  186.  
  187.         if (isset($rcend))
  188.         {
  189.             $path .= '&rcend=' $rcend;
  190.         }
  191.  
  192.         if (isset($rcdir))
  193.         {
  194.             $path .= '&rcdir=' $rcdir;
  195.         }
  196.  
  197.         if (isset($rcnamespace))
  198.         {
  199.             $path .= '&rcnamespaces=' $this->buildParameter($rcnamespace);
  200.         }
  201.  
  202.         if (isset($rcuser))
  203.         {
  204.             $path .= '&rcuser=' $rcuser;
  205.         }
  206.  
  207.         if (isset($rcexcludeuser))
  208.         {
  209.             $path .= '&rcexcludeuser=' $rcexcludeuser;
  210.         }
  211.  
  212.         if (isset($rctag))
  213.         {
  214.             $path .= '&rctag=' $rctag;
  215.         }
  216.  
  217.         if (isset($rcprop))
  218.         {
  219.             $path .= '&rcprop=' $this->buildParameter($rcprop);
  220.         }
  221.  
  222.         if (isset($rctoken))
  223.         {
  224.             $path .= '&rctoken=' $this->buildParameter($rctoken);
  225.         }
  226.  
  227.         if (isset($rcshow))
  228.         {
  229.             $path .= '&rcshow=' $this->buildParameter($rcshow);
  230.         }
  231.  
  232.         if (isset($rclimit))
  233.         {
  234.             $path .= '&rclimit=' $rclimit;
  235.         }
  236.  
  237.         if (isset($rctype))
  238.         {
  239.             $path .= '&rctype=' $rctype;
  240.         }
  241.  
  242.         if (isset($rctoponly))
  243.         {
  244.             $path .= '&rctoponly=' $rctoponly;
  245.         }
  246.  
  247.         // Send the request.
  248.         $response $this->client->get($this->fetchUrl($path));
  249.  
  250.         return $this->validateResponse($response);
  251.     }
  252.  
  253.     /**
  254.      * Method to get protected titles on a site.
  255.      *
  256.      * @param   array    $ptnamespace  Only list titles in this namespace.
  257.      * @param   array    $ptlevel      Only list titles with these protection level.
  258.      * @param   integer  $ptlimit      Limit of pages to return.
  259.      * @param   string   $ptdir        Direction of enumeration.
  260.      * @param   string   $ptstart      Starting timestamp.
  261.      * @param   string   $ptend        Ending timestamp.
  262.      * @param   array    $ptprop       List of properties to get.
  263.      *
  264.      * @return  object 
  265.      *
  266.      * @since   12.3
  267.      */
  268.     public function getProtectedTitles(array $ptnamespace nullarray $ptlevel null$ptlimit null$ptdir null$ptstart null,
  269.         $ptend nullarray $ptprop null)
  270.     {
  271.         // Build the request.
  272.         $path '?action=query&list=protectedtitles';
  273.  
  274.         if (isset($ptnamespace))
  275.         {
  276.             $path .= '&ptnamespace=' $this->buildParameter($ptnamespace);
  277.         }
  278.  
  279.         if (isset($ptlevel))
  280.         {
  281.             $path .= '&ptlevel=' $this->buildParameter($ptlevel);
  282.         }
  283.  
  284.         if (isset($ptlimit))
  285.         {
  286.             $path .= '&ptlimit=' $ptlimit;
  287.         }
  288.  
  289.         if (isset($ptdir))
  290.         {
  291.             $path .= '&ptdir=' $ptdir;
  292.         }
  293.  
  294.         if (isset($ptstart))
  295.         {
  296.             $path .= '&ptstart=' $ptstart;
  297.         }
  298.  
  299.         if (isset($ptend))
  300.         {
  301.             $path .= '&ptend=' $ptend;
  302.         }
  303.  
  304.         if (isset($ptprop))
  305.         {
  306.             $path .= '&ptprop=' $this->buildParameter($ptprop);
  307.         }
  308.  
  309.         // Send the request.
  310.         $response $this->client->get($this->fetchUrl($path));
  311.  
  312.         return $this->validateResponse($response);
  313.     }
  314. }

Documentation generated on Tue, 19 Nov 2013 15:13:57 +0100 by phpDocumentor 1.4.3