Ejemplo n.º 1
0
 public function handleActions()
 {
     // WPLE()->logger->debug("handleActions()");
     // add new account (triggered by 'Fetch eBay Token' button on accounts page)
     if ($this->requestAction() == 'wplister_add_account') {
         $this->newAccount();
     }
     // fetch token for account (triggered from edit account page, right sidebar)
     if ($this->requestAction() == 'wplister_fetch_ebay_token') {
         $this->fetchTokenForAccount($_REQUEST['account_id']);
     }
     // update account details from ebay
     if ($this->requestAction() == 'update_account') {
         $this->updateAccount($_REQUEST['ebay_account']);
     }
     // delete account
     if ($this->requestAction() == 'delete_account') {
         $account = new WPLE_eBayAccount($_REQUEST['ebay_account']);
         $account->delete();
         $this->showMessage(__('Account has been deleted.', 'wplister'));
     }
     // enable account
     if ($this->requestAction() == 'enable_account') {
         $account = new WPLE_eBayAccount($_REQUEST['ebay_account']);
         $account->active = 1;
         $account->update();
         $this->showMessage(__('Account has been enabled.', 'wplister'));
     }
     // disable account
     if ($this->requestAction() == 'disable_account') {
         $account = new WPLE_eBayAccount($_REQUEST['ebay_account']);
         $account->active = 0;
         $account->update();
         $this->showMessage(__('Account has been disabled.', 'wplister'));
     }
     // set default account
     if ($this->requestAction() == 'make_default') {
         $this->makeDefaultAccount($_REQUEST['ebay_account']);
         $this->showMessage(__('Default account has been changed successfully.', 'wplister'));
     }
     // add empty developer account
     if ($this->requestAction() == 'wple_add_dev_account') {
         $this->addEmptyAccount();
     }
     // assign invalid data to default account
     if ($this->requestAction() == 'wple_assign_invalid_data_to_default_account') {
         WPL_Setup::fixItemsUsingInvalidAccounts();
     }
 }