当前位置: 首页>>代码示例>>PHP>>正文


PHP WPLE函数代码示例

本文整理汇总了PHP中WPLE函数的典型用法代码示例。如果您正苦于以下问题:PHP WPLE函数的具体用法?PHP WPLE怎么用?PHP WPLE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WPLE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: downloadReturnPolicyDetails

 function downloadReturnPolicyDetails($session, $site_id)
 {
     WPLE()->logger->info("downloadReturnPolicyDetails()");
     $this->initServiceProxy($session);
     // download ebay details
     $req = new GeteBayDetailsRequestType();
     $req->setDetailName('ReturnPolicyDetails');
     $res = $this->_cs->GeteBayDetails($req);
     // handle response and check if successful
     if ($this->handleResponse($res)) {
         // save array of ReturnsWithin options
         $ReturnsWithinOptions = array();
         foreach ($res->ReturnPolicyDetails->ReturnsWithin as $Detail) {
             $ReturnsWithinOptions[$Detail->ReturnsWithinOption] = $Detail->Description;
         }
         // update legacy option
         update_option('wplister_ReturnsWithinOptions', $ReturnsWithinOptions);
         // save array of ShippingCostPaidBy options
         $ShippingCostPaidByOptions = array();
         foreach ($res->ReturnPolicyDetails->ShippingCostPaidBy as $Detail) {
             $ShippingCostPaidByOptions[$Detail->ShippingCostPaidByOption] = $Detail->Description;
         }
         // update legacy option
         update_option('wplister_ShippingCostPaidByOptions', $ShippingCostPaidByOptions);
         // update site properties
         $Site = new WPLE_eBaySite($site_id);
         $Site->ReturnsWithinOptions = serialize($ReturnsWithinOptions);
         $Site->ShippingCostPaidByOptions = serialize($ShippingCostPaidByOptions);
         $Site->update();
     }
     // call successful
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:32,代码来源:EbayPaymentModel.php

示例2: handleSubmit

 public function handleSubmit()
 {
     WPLE()->logger->debug("handleSubmit()");
     if ($this->requestAction() == 'display_log_entry') {
         $this->displayLogEntry($_REQUEST['log_id']);
         exit;
     }
     // handle delete action
     if ($this->requestAction() == 'delete') {
         $log_ids = @$_REQUEST['log'];
         if (is_array($log_ids)) {
             foreach ($log_ids as $id) {
                 $this->deleteLogEntry($id);
             }
             $this->showMessage(__('Selected items were removed.', 'wplister'));
         }
     }
     if ($this->requestAction() == 'wpl_clear_ebay_log') {
         $this->clearLog();
         $this->showMessage(__('Database log has been cleared.', 'wplister'));
     }
     if ($this->requestAction() == 'wpl_optimize_ebay_log') {
         $count = $this->optimizeLog();
         $this->showMessage($count . ' ' . __('expired records have been removed and the database table has been optimized.', 'wplister'));
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:26,代码来源:LogPage.php

示例3: handleActionsOnInit

 public function handleActionsOnInit()
 {
     WPLE()->logger->debug("handleActionsOnInit()");
     // these actions have to wait until 'init'
     if ($this->requestAction() == 'view_trx_details') {
         $this->showTransactionDetails($_REQUEST['transaction']);
         exit;
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:9,代码来源:TransactionsPage.php

示例4: handleActionsOnInit

 public function handleActionsOnInit()
 {
     WPLE()->logger->debug("handleActionsOnInit()");
     // these actions have to wait until 'init'
     if ($this->requestAction() == 'view_ebay_message_details') {
         $this->showMessageDetails($_REQUEST['ebay_message']);
         exit;
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:9,代码来源:EbayMessagesPage.php

示例5: getTokenExpirationTime

 function getTokenExpirationTime($token)
 {
     $body = "\n  <RequesterCredentials><eBayAuthToken>{$token}</eBayAuthToken></RequesterCredentials>\n";
     $expdate = $this->TradeAPI('GetTokenStatus', $body, 'ExpirationTime');
     WPLE()->logger->info('getTokenExpirationTime: ' . $expdate);
     $expdate = str_replace('T', ' ', $expdate);
     $expdate = str_replace('.000Z', '', $expdate);
     #echo '<p/>Your token expires on:<p/>' . $expdate;
     return $expdate;
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:10,代码来源:EbayGetSessionID.php

示例6: handleSubmit

 public function handleSubmit()
 {
     WPLE()->logger->debug("handleSubmit()");
     // handle download template
     if ($this->requestAction() == 'download_listing_template') {
         $this->downloadTemplate();
     }
     // handle delete action
     if ($this->requestAction() == 'delete_listing_template') {
         $this->deleteTemplate();
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:12,代码来源:TemplatesPage.php

示例7: insertJob

 function insertJob($jobname, $tasklist)
 {
     global $wpdb;
     // get current user id
     $user = wp_get_current_user();
     // generate job key
     $key = md5($jobname . rand());
     // insert row into db
     $data = array();
     $data['job_key'] = $key;
     $data['job_name'] = $jobname;
     $data['tasklist'] = self::encodeObject($tasklist);
     $data['date_created'] = date('Y-m-d H:i:s');
     $data['user_id'] = $user->ID;
     $wpdb->insert($this->tablename, $data);
     WPLE()->logger->info("insertJob( {$jobname} ) - key {$key}");
     $this->key = $key;
     return $key;
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:19,代码来源:JobsModel.php

示例8: handleSubmitOnInit

 public function handleSubmitOnInit()
 {
     WPLE()->logger->debug("handleSubmit()");
     if ($this->requestAction() == 'prepare_auction') {
         $listingsModel = new ListingsModel();
         $listings = $listingsModel->prepareListings($_REQUEST['post']);
         // redirect to listings page
         wp_redirect(get_admin_url() . 'admin.php?page=wplister');
         exit;
     }
     if ($this->requestAction() == 'reselect') {
         ListingsModel::reSelectListings($_REQUEST['auction']);
         // redirect to listings page
         wp_redirect(get_admin_url() . 'admin.php?page=wplister');
         exit;
     }
     if ($this->requestAction() == 'apply_listing_profile') {
         WPLE()->logger->info('apply_listing_profile');
         #WPLE()->logger->info( print_r( $_REQUEST, 1 ) );
         $profilesModel = new ProfilesModel();
         $profile = $profilesModel->getItem($_REQUEST['wpl_e2e_profile_to_apply']);
         $listingsModel = new ListingsModel();
         $items = $listingsModel->applyProfileToNewListings($profile);
         // remember selected profile
         self::updateOption('last_selected_profile', intval($_REQUEST['wpl_e2e_profile_to_apply']));
         // redirect to listings page
         if (@$_REQUEST['wpl_e2e_verify_after_profile'] == '1') {
             // verify new listings if asked to
             wp_redirect(get_admin_url() . 'admin.php?page=wplister&action=verifyPreparedItemsNow');
         } else {
             wp_redirect(get_admin_url() . 'admin.php?page=wplister');
         }
         exit;
     }
     // handle preview action
     if ($this->requestAction() == 'preview_auction') {
         $this->previewListing($_REQUEST['auction']);
         exit;
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:40,代码来源:ListingsPage.php

示例9: wple_show_message

function wple_show_message($message, $type = 'info', $params = null)
{
    WPLE()->messages->add_message($message, $type, $params);
}
开发者ID:booklein,项目名称:wpbookle,代码行数:4,代码来源:WPL_Functions.php

示例10: update_products_on_shutdown

 function update_products_on_shutdown()
 {
     // get queue
     $collected_products = get_option('wplister_updated_products_queue', array());
     if (!is_array($collected_products)) {
         $collected_products = array();
     }
     // DEBUG
     WPLE()->logger->info("CSV: update_products_on_shutdown() - collected_products: " . print_r($collected_products, 1));
     // mark each queued product as modified
     foreach ($collected_products as $post_id) {
         do_action('wplister_product_has_changed', $post_id);
     }
     // clear queue
     delete_option('wplister_updated_products_queue');
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:16,代码来源:WPL_API_Hooks.php

示例11: handleCronSettings

 protected function handleCronSettings($schedule)
 {
     WPLE()->logger->info("handleCronSettings( {$schedule} )");
     // remove scheduled event
     $timestamp = wp_next_scheduled('wplister_update_auctions');
     wp_unschedule_event($timestamp, 'wplister_update_auctions');
     if ($schedule == 'external') {
         return;
     }
     if (!wp_next_scheduled('wplister_update_auctions')) {
         wp_schedule_event(time(), $schedule, 'wplister_update_auctions');
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:13,代码来源:SettingsPage.php

示例12: handleResponse

 function handleResponse($res, $is_second_request = false)
 {
     $errors = array();
     $this->handle_error_code = null;
     // prevent fatal error when response is not an object
     if (!is_object($res)) {
         echo 'Unexpected error: eBay response is invalid.<br>';
         echo "<pre>";
         print_r($res);
         echo "</pre>";
         WPLE()->logger->error('eBay response is not an object: ' . print_r($res, 1));
         return false;
     }
     // echo errors and warnings - call can be successful but with warnings
     if ($res->getErrors()) {
         foreach ($res->getErrors() as $error) {
             // hide warning #21917103 ("Delivery estimate based on shipping service and handling time")
             if ($error->getErrorCode() == 21917103) {
                 continue;
             }
             // #37 means soap error - and htmlentities have to be encoded (maybe not anymore?)
             if ($error->getErrorCode() == 37) {
                 $longMessage = htmlspecialchars($error->getLongMessage());
                 // $longMessage = $error->getLongMessage();
             } else {
                 $longMessage = htmlspecialchars($error->getLongMessage());
                 // $longMessage = $error->getLongMessage();
             }
             $shortMessage = htmlspecialchars($error->getShortMessage());
             // #240 - generic error on listing item
             if ($error->getErrorCode() == 240) {
                 $longMessage .= '<br><br>' . '<b>Note:</b> The message above is a generic error message from eBay which is not to be taken literally.';
                 $longMessage .= '<br>' . 'Below you find an explaination as to what triggered the above error:';
             }
             // #1047 - Auction closed / The auction has been closed.
             if ($error->getErrorCode() == 1047) {
                 // change status from Error to Warning to allow post processing of this error
                 $res->setAck('Warning');
                 $this->handle_error_code = 1047;
                 $longMessage .= '<br><br>' . '<b>Note:</b> Listing status was changed to ended.';
             }
             // #291 - Auction ended / You are not allowed to revise ended listings.
             if ($error->getErrorCode() == 291) {
                 // change status from Error to Warning to allow post processing of this error
                 $res->setAck('Warning');
                 $this->handle_error_code = 291;
                 $longMessage .= '<br><br>' . '<b>Note:</b> Listing status was changed to ended.';
             }
             // #17 - This item cannot be accessed because the listing has been deleted, ... or you are not the seller.
             if ($error->getErrorCode() == 17) {
                 // change status from Error to Warning to allow post processing of this error
                 $res->setAck('Warning');
                 $this->handle_error_code = 17;
                 $longMessage .= '<br><br>' . '<b>Note:</b> Listing status was changed to archived.';
             }
             // #21916734 - Error: Pictures cannot be removed. - Variation pictures cannot be removed during restricted revise.
             if ($error->getErrorCode() == 21916734) {
                 // change status from Error to Warning to allow post processing of this error (retry in restricted revise mode)
                 $res->setAck('Warning');
                 $this->handle_error_code = 21916734;
                 $longMessage .= '<br><br>' . '<i>Switching to restricted revise mode...</i>';
             }
             // #55 - Error: Adding feedback failed: invalid item number or invalid transaction or feedback already left
             if ($error->getErrorCode() == 55) {
                 $this->handle_error_code = 55;
                 // remember error code for callCompleteOrder()
             }
             // #302 - Invalid auction listing type
             if ($error->getErrorCode() == 302) {
                 $longMessage .= '<br><br>' . '<b>Note:</b> eBay does not allow changing the listing type of an active listing.';
                 $longMessage .= '<br>' . 'To change a listing type from auction to fixed price or vice versa, you need to end and relist the item.';
             }
             // #931 - Auth token is invalid
             if ($error->getErrorCode() == 931) {
                 $shortMessage = 'Your API token is invalid';
                 // $longMessage .= '<br><br>'. '<b>Your API token is invalid.</b> Please authenticate WP-Lister with eBay again.';
                 $longMessage .= '<br><br>' . '<b>Please authenticate WP-Lister with eBay again.</b>';
                 $longMessage .= '<br>' . 'This can happen if you enabled the sandbox mode or if your token has expired.';
                 $longMessage .= '<br>' . 'To refresh your eBay token, please visit Settings &raquo; Account &raquo; Edit and follow the instructions in the sidebar.';
                 // update_option( 'wplister_ebay_token_is_invalid', true ); // update legacy option
                 update_option('wplister_ebay_token_is_invalid', array('site_id' => $this->site_id, 'account_id' => $this->account_id));
                 // store site and account
             }
             // #21916519 - Error: Listing is missing required item specific(s)
             if ($error->getErrorCode() == 21916519) {
                 // $longMessage .= '<br><br>'. '<b>How to add item specifics to your eBay listings</b>'.'<br>';
                 $longMessage .= '<br><br>' . '<b>Why am I seeing this error message?</b>' . '<br>';
                 $longMessage .= 'eBay requires sellers to provide these item specifics (product attributes) for the selected primary category.' . '<br>';
                 $longMessage .= '<br>';
                 $longMessage .= 'You have two options to add item specifics to your listings:' . '<!br>';
                 $longMessage .= '<ol>';
                 $longMessage .= '<li>Create product attributes with the exact same name as required by eBay.' . '</li>';
                 if (WPLISTER_LIGHT) {
                     $longMessage .= '<li>Upgrade to WP-Lister Pro where you can define item specifics in your profile. You can either enter fixed values or map existing WooCommerce product attributes to eBay item specifics.' . '</li>';
                 } else {
                     $longMessage .= '<li>Define item specifics in your listing profile where you can either enter fixed values or map WooCommerce product attributes to eBay item specifics.' . '</li>';
                 }
                 $longMessage .= '</ol>';
                 if (!defined('WPLISTER_RESELLER_VERSION')) {
                     $longMessage .= 'More detailed information about item specifics in WP-Lister Pro can be found here: ';
//.........这里部分代码省略.........
开发者ID:booklein,项目名称:wpbookle,代码行数:101,代码来源:WPL_Model.php

示例13: checkToken

 public function checkToken()
 {
     // legacy option - not used anymore
     // $expdate = get_option( 'wplister_ebay_token_expirationtime' );
     // get all accounts
     $accounts = WPLE()->accounts;
     if (!is_array($accounts) || empty($accounts)) {
         return;
     }
     $two_weeks_from_now = time() + 3600 * 24 * 7 * 2;
     foreach ($accounts as $account) {
         // get a valid expiration time
         $expdate = $account->valid_until;
         if (!$expdate) {
             continue;
         }
         if (!($exptime = strtotime($expdate))) {
             continue;
         }
         if (!$account->active) {
             continue;
         }
         if ($exptime < time()) {
             // token has already expired
             wple_show_message('<p>' . '<b> ' . sprintf(__('Warning: The token for your eBay account %s has expired on %s.', 'wplister'), $account->title, $expdate) . ' (' . human_time_diff(strtotime($expdate)) . ' ago) ' . '</b>' . '<br><br>' . 'To refresh your eBay token, please visit Settings &raquo; Account &raquo; Edit and follow the instructions in the sidebar.' . '</p>', 'error');
         } elseif ($exptime < $two_weeks_from_now) {
             // token will expire soon
             wple_show_message('<p>' . '<b> ' . sprintf(__('Warning: The token for your eBay account %s will expire on %s.', 'wplister'), $account->title, $expdate) . ' (in ' . human_time_diff(strtotime($expdate)) . ') ' . '</b>' . '<br><br>' . 'To refresh your eBay token, please visit Settings &raquo; Account &raquo; Edit and follow the instructions in the sidebar.' . '</p>', 'warn');
         }
     }
     // foreach account
     // warn about invalid token - could be obsolete since we check for expiry time already, but maybe it's still useful
     if ($token_data = get_option('wplister_ebay_token_is_invalid')) {
         if (is_array($token_data) && isset($token_data['site_id'])) {
             $account = isset(WPLE()->accounts[$token_data['account_id']]) ? WPLE()->accounts[$token_data['account_id']] : false;
             $account_title = $account ? $account->title . '(' . $account->site_code . ')' : 'Default';
             $msg1 = sprintf(__('The token for your eBay account %s seems to be invalid.', 'wplister'), $account_title);
             $msg2 = 'To refresh your eBay token, please visit Settings &raquo; Account &raquo; Edit and follow the instructions in the sidebar.';
             $msg = "<b>{$msg1}</b></p><p>{$msg2}";
             wple_show_message($msg, 'warn');
         }
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:43,代码来源:WPL_Setup.php

示例14: fixEnabledSites

 protected function fixEnabledSites()
 {
     global $wpdb;
     // disable all sites
     $wpdb->update($wpdb->prefix . 'ebay_sites', array('enabled' => 0), array('enabled' => 1));
     // enable site for each account
     foreach (WPLE()->accounts as $account) {
         $wpdb->update($wpdb->prefix . 'ebay_sites', array('enabled' => 1), array('id' => $account->site_id));
     }
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:10,代码来源:AccountsPage.php

示例15: mapItemDetailToDB

 function mapItemDetailToDB($Detail)
 {
     //#type $Detail MyMessagesMessageType
     $data['message_id'] = $Detail->MessageID;
     $data['received_date'] = self::convertEbayDateToSql($Detail->ReceiveDate);
     $data['expiration_date'] = self::convertEbayDateToSql($Detail->ExpirationDate);
     $data['subject'] = $Detail->Subject;
     $data['sender'] = $Detail->Sender;
     $data['flag_read'] = $Detail->Read;
     $data['flag_replied'] = $Detail->Replied;
     $data['flag_flagged'] = $Detail->Flagged;
     $data['item_title'] = $Detail->ItemTitle;
     $data['item_id'] = $Detail->ItemID;
     $data['folder_id'] = $Detail->Folder->FolderID;
     $data['response_url'] = $Detail->ResponseDetails->ResponseURL;
     $data['site_id'] = $this->site_id;
     $data['account_id'] = $this->account_id;
     if ($Detail->Text != '') {
         $data['msg_text'] = $Detail->Text;
     }
     if ($Detail->Content != '') {
         $data['msg_content'] = $Detail->Content;
     }
     // save GetMyMessages reponse in details
     $data['details'] = self::encodeObject($Detail);
     WPLE()->logger->info("IMPORTING message #" . $Detail->MessageID);
     return $data;
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:28,代码来源:EbayMessagesModel.php


注:本文中的WPLE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。