Source for file images.php

Documentation is available at images.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 Images class for the Joomla Platform.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  MediaWiki
  17.  * @since       12.3
  18.  */
  19. {
  20.  
  21.     /**
  22.      * Method to get all images contained on the given page(s).
  23.      *
  24.      * @param   array    $titles         Page titles to retrieve images.
  25.      * @param   integer  $imagelimit     How many images to return.
  26.      * @param   boolean  $imagecontinue  When more results are available, use this to continue.
  27.      * @param   integer  $imimages       Only list these images.
  28.      * @param   string   $imdir          The direction in which to list.
  29.      *
  30.      * @return  object 
  31.      *
  32.      * @since   12.3
  33.      */
  34.     public function getImages(array $titles$imagelimit null$imagecontinue null$imimages null$imdir null)
  35.     {
  36.         // Build the request.
  37.         $path '?action=query&prop=images';
  38.  
  39.         // Append titles to the request.
  40.         $path .= '&titles=' $this->buildParameter($titles);
  41.  
  42.         if (isset($imagelimit))
  43.         {
  44.             $path .= '&imagelimit=' $imagelimit;
  45.         }
  46.  
  47.         if ($imagecontinue)
  48.         {
  49.             $path .= '&imagecontinue=';
  50.         }
  51.  
  52.         if (isset($imimages))
  53.         {
  54.             $path .= '&imimages=' $imimages;
  55.         }
  56.  
  57.         if (isset($imdir))
  58.         {
  59.             $path .= '&imdir=' $imdir;
  60.         }
  61.  
  62.         // Send the request.
  63.         $response $this->client->get($this->fetchUrl($path));
  64.  
  65.         return $this->validateResponse($response);
  66.     }
  67.  
  68.     /**
  69.      * Method to get all images contained on the given page(s).
  70.      *
  71.      * @param   array  $titles  Page titles to retrieve links.
  72.      *
  73.      * @return  object 
  74.      *
  75.      * @since   12.3
  76.      */
  77.     public function getImagesUsed(array $titles)
  78.     {
  79.         // Build the request.
  80.         $path '?action=query&generator=images&prop=info';
  81.  
  82.         // Append titles to the request.
  83.         $path .= '&titles=' $this->buildParameter($titles);
  84.  
  85.         // Send the request.
  86.         $response $this->client->get($this->fetchUrl($path));
  87.  
  88.         return $this->validateResponse($response);
  89.     
  90.  
  91.     /**
  92.      * Method to get all image information and upload history.
  93.      *
  94.      * @param   array    $liprop             What image information to get.
  95.      * @param   integer  $lilimit            How many image revisions to return.
  96.      * @param   string   $listart            Timestamp to start listing from.
  97.      * @param   string   $liend              Timestamp to stop listing at.
  98.      * @param   integer  $liurlwidth         URL to an image scaled to this width will be returned..
  99.      * @param   integer  $liurlheight        URL to an image scaled to this height will be returned.
  100.      * @param   string   $limetadataversion  Version of metadata to use.
  101.      * @param   string   $liurlparam         A handler specific parameter string.
  102.      * @param   boolean  $licontinue         When more results are available, use this to continue.
  103.      *
  104.      * @return  object 
  105.      *
  106.      * @since   12.3
  107.      */
  108.     public function getImageInfo(array $liprop null$lilimit null$listart null$liend null$liurlwidth null,
  109.         $liurlheight null$limetadataversion null$liurlparam null$licontinue null)
  110.     {
  111.         // Build the request.
  112.         $path '?action=query&prop=imageinfo';
  113.  
  114.         if (isset($liprop))
  115.         {
  116.             $path .= '&liprop=' $this->buildParameter($liprop);
  117.         }
  118.  
  119.         if (isset($lilimit))
  120.         {
  121.             $path .= '&lilimit=' $lilimit;
  122.         }
  123.  
  124.         if (isset($listart))
  125.         {
  126.             $path .= '&listart=' $listart;
  127.         }
  128.  
  129.         if (isset($liend))
  130.         {
  131.             $path .= '&liend=' $liend;
  132.         }
  133.  
  134.         if (isset($liurlwidth))
  135.         {
  136.             $path .= '&liurlwidth=' $liurlwidth;
  137.         }
  138.  
  139.         if (isset($liurlheight))
  140.         {
  141.             $path .= '&liurlheight=' $liurlheight;
  142.         }
  143.  
  144.         if (isset($limetadataversion))
  145.         {
  146.             $path .= '&limetadataversion=' $limetadataversion;
  147.         }
  148.  
  149.         if (isset($liurlparam))
  150.         {
  151.             $path .= '&liurlparam=' $liurlparam;
  152.         }
  153.  
  154.         if ($licontinue)
  155.         {
  156.             $path .= '&alcontinue=';
  157.         }
  158.  
  159.         // Send the request.
  160.         $response $this->client->get($this->fetchUrl($path));
  161.  
  162.         return $this->validateResponse($response);
  163.     }
  164.  
  165.     /**
  166.      * Method to enumerate all images.
  167.      *
  168.      * @param   string   $aifrom        The image title to start enumerating from.
  169.      * @param   string   $aito          The image title to stop enumerating at.
  170.      * @param   string   $aiprefix      Search for all image titles that begin with this value.
  171.      * @param   integer  $aiminsize     Limit to images with at least this many bytes.
  172.      * @param   integer  $aimaxsize     Limit to images with at most this many bytes.
  173.      * @param   integer  $ailimit       How many images in total to return.
  174.      * @param   string   $aidir         The direction in which to list.
  175.      * @param   string   $aisha1        SHA1 hash of image.
  176.      * @param   string   $aisha1base36  SHA1 hash of image in base 36.
  177.      * @param   array    $aiprop        What image information to get.
  178.      * @param   string   $aimime        What MIME type to search for.
  179.      *
  180.      * @return  object 
  181.      *
  182.      * @since   12.3
  183.      */
  184.     public function enumerateImages($aifrom null$aito null$aiprefix null$aiminsize null$aimaxsize null$ailimit null,
  185.         $aidir null$aisha1 null$aisha1base36 nullarray $aiprop null$aimime null)
  186.     {
  187.         // Build the request.
  188.         $path '?action=query&list=allimages';
  189.  
  190.         if (isset($aifrom))
  191.         {
  192.             $path .= '&aifrom=' $aifrom;
  193.         }
  194.  
  195.         if (isset($aito))
  196.         {
  197.             $path .= '&aito=' $aito;
  198.         }
  199.  
  200.         if (isset($aiprefix))
  201.         {
  202.             $path .= '&aiprefix=' $aiprefix;
  203.         }
  204.  
  205.         if (isset($aiminsize))
  206.         {
  207.             $path .= '&aiminsize=' $aiminsize;
  208.         }
  209.  
  210.         if (isset($aimaxsize))
  211.         {
  212.             $path .= '&aimaxsize=' $aimaxsize;
  213.         }
  214.  
  215.         if (isset($ailimit))
  216.         {
  217.             $path .= '&ailimit=' $ailimit;
  218.         }
  219.  
  220.         if (isset($aidir))
  221.         {
  222.             $path .= '&aidir=' $aidir;
  223.         }
  224.         if (isset($aisha1))
  225.         {
  226.             $path .= '&aisha1=' $aisha1;
  227.         }
  228.  
  229.         if (isset($aisha1base36))
  230.         {
  231.             $path .= '&$aisha1base36=' $aisha1base36;
  232.         }
  233.  
  234.         if (isset($aiprop))
  235.         {
  236.             $path .= '&aiprop=' $this->buildParameter($aiprop);
  237.         }
  238.  
  239.         if (isset($aimime))
  240.         {
  241.             $path .= '&aimime=' $aimime;
  242.         }
  243.  
  244.         // Send the request.
  245.         $response $this->client->get($this->fetchUrl($path));
  246.  
  247.         return $this->validateResponse($response);
  248.     }
  249. }

Documentation generated on Tue, 19 Nov 2013 15:05:18 +0100 by phpDocumentor 1.4.3