home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Services / Ebay / Call / GetProductFinder.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.1 KB  |  77 lines

  1. <?PHP
  2. /**
  3.  * Get XSL stylesheet to transform product finder
  4.  *
  5.  * $Id: GetProductFinder.php,v 1.1 2005/01/01 15:48:47 schst Exp $
  6.  *
  7.  * @package Services_Ebay
  8.  * @author  Stephan Schmidt <schst@php.net>
  9.  * @link    http://developer.ebay.com/DevZone/docs/API_Doc/Functions/GetProductFinder/GetProductFinderLogic.htm
  10.  */
  11. class Services_Ebay_Call_GetProductFinder extends Services_Ebay_Call 
  12. {
  13.    /**
  14.     * verb of the API call
  15.     *
  16.     * @var  string
  17.     */
  18.     protected $verb = 'GetProductFinder';
  19.  
  20.    /**
  21.     * parameter map that is used, when scalar parameters are passed
  22.     *
  23.     * @var  array
  24.     */
  25.     protected $paramMap = array(
  26.                                  'ProductFinderId',
  27.                                  'Version'
  28.                                 );
  29.  
  30.    /**
  31.     * arguments of the call
  32.     *
  33.     * @var  array
  34.     */
  35.     protected $args = array(
  36.                             'DetailLevel' => 1
  37.                         );
  38.  
  39.    /**
  40.     * options that will be passed to the serializer
  41.     *
  42.     * @var  array
  43.     */
  44.     protected $serializerOptions = array(
  45.                                             'mode' => 'simplexml'
  46.                                         );
  47.  
  48.    /**
  49.     * make the API call
  50.     *
  51.     * @param    object Services_Ebay_Session
  52.     * @return   string
  53.     */
  54.     public function call(Services_Ebay_Session $session)
  55.     {
  56.         if (isset($this->args['ProductFinderId'])) {
  57.             $ids = $this->args['ProductFinderId'];
  58.             unset($this->args['ProductFinderId']);
  59.             if (!is_array($ids)) {
  60.                 $ids = array($ids);
  61.             }
  62.             $this->args['ProductFinderIds']['ProductFinderId'] = $ids;
  63.         }
  64.         
  65.         $xml = parent::call($session, false);
  66.         $dom = DOMDocument::loadXML($xml);
  67.  
  68.         $result = array();
  69.         $productFinders = $dom->getElementsByTagName('ProductFinder');
  70.         foreach ($productFinders as $node) {
  71.             $result[] = Services_Ebay::loadModel('ProductFinder', $node, $session);
  72.         }
  73.         
  74.         return $result;
  75.     }
  76. }
  77. ?>