예제 #1
0
파일: apis.php 프로젝트: buttasg/cowgirlk
 /**
  * Represents the "get_categories" action.
  *
  * @throws ShopgateLibraryException
  * @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_categories
  */
 protected function getReviews()
 {
     $limit = isset($this->params['limit']) ? (int) $this->params['limit'] : null;
     $offset = isset($this->params['offset']) ? (int) $this->params['offset'] : null;
     $uids = isset($this->params['uids']) ? (array) $this->params['uids'] : array();
     $responseType = isset($this->params['response_type']) ? $this->params['response_type'] : false;
     $supportedResponseTypes = $this->config->getSupportedResponseTypes();
     if (!empty($responseType) && !in_array($responseType, $supportedResponseTypes['get_reviews'])) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_UNSUPPORTED_RESPONSE_TYPE, 'Requested type: "' . $responseType . '"');
     }
     $this->plugin->startGetReviews($limit, $offset, $uids, $responseType);
     switch ($responseType) {
         default:
         case 'xml':
             $response = new ShopgatePluginApiResponseAppXmlExport($this->trace_id);
             $responseData = $this->config->getReviewsXmlPath();
             break;
         case 'json':
             $response = new ShopgatePluginApiResponseAppJsonExport($this->trace_id);
             $responseData = $this->config->getReviewsJsonPath();
             break;
     }
     if (empty($this->response)) {
         $this->response = $response;
     }
     $this->responseData = $responseData;
 }
예제 #2
0
파일: core.php 프로젝트: buttasg/cowgirlk
 /**
  * Takes care of buffer and file handlers and calls ShopgatePlugin::createReviews().
  *
  * @param int $limit
  * @param int $offset
  * @param array $uids
  * @param string $responseType
  */
 public final function startGetReviews($limit = null, $offset = null, array $uids = array(), $responseType = 'xml')
 {
     switch ($responseType) {
         default:
         case 'xml':
             $this->buffer->setFile($this->config->getReviewsXmlPath());
             break;
         case 'json':
             $this->buffer->setFile($this->config->getReviewsJsonPath());
             break;
     }
     $this->createReviews($limit, $offset, $uids);
     $this->buffer->finish();
 }