Ejemplo n.º 1
0
 public function handleActions()
 {
     // trigger feeds update
     if ($this->requestAction() == 'update_feeds') {
         do_action('wpla_update_feeds');
     }
     // submit feed
     if ($this->requestAction() == 'submit_feed_to_amazon') {
         $feed = new WPLA_AmazonFeed($_REQUEST['amazon_feed']);
         if ($feed->status != 'pending') {
             $this->showMessage(__('This feed has already been submitted to Amazon.', 'wpla'), 1);
             return;
         }
         $result = $feed->submit();
         if ($result->success) {
             $this->showMessage(__('Feed has been submitted to Amazon.', 'wpla'));
         } else {
             $this->showMessage(__('There was a problem submitting your feed to Amazon.', 'wpla') . '<br><pre>' . $result->ErrorMessage . '</pre>', 1);
             // echo "<pre>";print_r($result);echo"</pre>";#die();
         }
     }
     // check feed - doesn't work via API
     // if ( $this->requestAction() == 'check_feed_on_amazon' ) {
     // 	$feed = new WPLA_AmazonFeed( $_REQUEST['amazon_feed'] );
     // 	$feed->createCheckFeed();
     // 	$this->showMessage( __('A check feed has been created and was submitted to Amazon for verification.','wpla') );
     // }
     // submit all pending feeds
     if ($this->requestAction() == 'submit_pending_feeds_to_amazon') {
         do_action('wpla_submit_pending_feeds');
         $this->showMessage(__('Pending feed(s) have been submitted to Amazon.', 'wpla'));
     }
     // handle update feed action
     if ($this->requestAction() == 'update_amazon_feed') {
         $this->updateFeedStatus($_REQUEST['amazon_feed']);
     }
     // handle process feed action
     if ($this->requestAction() == 'process_amazon_feed_results') {
         $this->processFeedResult($_REQUEST['amazon_feed']);
     }
     // handle delete action
     if ($this->requestAction() == 'cancel_amazon_feed') {
         $this->cancelFeeds($_REQUEST['amazon_feed']);
         $this->showMessage(__('Selected feeds were cancelled.', 'wpla'));
     }
     // handle delete action
     if ($this->requestAction() == 'delete') {
         $this->deleteFeeds($_REQUEST['amazon_feed']);
         $this->showMessage(__('Selected feeds were removed.', 'wpla'));
     }
 }