PageRenderTime 68ms CodeModel.GetById 35ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/wp-lister-for-ebay/classes/EbayController.php

https://bitbucket.org/sanders_nick/my-maxi-skirt
PHP | 823 lines | 515 code | 194 blank | 114 comment | 42 complexity | 31a19a2bdc64b669aed56f3ea04c89bf MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause, AGPL-1.0, GPL-3.0, LGPL-2.1
  1. <?php
  2. class EbayController {
  3. var $logger;
  4. var $apiurl;
  5. var $signin;
  6. var $devId;
  7. var $appId;
  8. var $certId;
  9. var $RuName;
  10. var $siteId;
  11. var $sandbox;
  12. var $compLevel;
  13. #public $data = array();
  14. public $session; // ebay session
  15. public $sp; // ebay service proxy
  16. public $message = false;
  17. public $error = false;
  18. public $lastResults = array();
  19. public function __construct() {
  20. global $wpl_logger;
  21. $this->logger = &$wpl_logger;
  22. // $this->config();
  23. }
  24. public function config() {
  25. // add EbatNs folder to include path - required for SDK
  26. // $incPath = WPLISTER_PATH . '/includes/EbatNs';
  27. // set_include_path( get_include_path() . ':' . $incPath );
  28. }
  29. static function loadEbayClasses() {
  30. // we want to be patient when talking to ebay
  31. set_time_limit(600);
  32. // add EbatNs folder to include path - required for SDK
  33. $incPath = WPLISTER_PATH . '/includes/EbatNs';
  34. set_include_path( get_include_path() . ':' . $incPath );
  35. // use autoloader to load EbatNs classes
  36. spl_autoload_register('WPL_Autoloader::autoloadEbayClasses');
  37. }
  38. function GetEbaySignInUrl($RuName = null, $Params = null)
  39. {
  40. $s = $this->session;
  41. if ($s->getAppMode() == 0)
  42. $url = 'https://signin.' . $this->_getDomainnameBySiteId( $s->getSiteId() ) . '/ws/eBayISAPI.dll?SignIn';
  43. else
  44. $url = 'https://signin.sandbox.' . $this->_getDomainnameBySiteId( $s->getSiteId() ) . '/ws/eBayISAPI.dll?SignIn';
  45. if ($RuName != null)
  46. $url .= '&runame=' . $RuName;
  47. if ($Params != null)
  48. $url .= '&ruparams=' . $Params;
  49. return $url;
  50. }
  51. // get SessionID and build AuthURL
  52. public function getAuthUrl(){
  53. // fetch SessionID - valid for about 5 minutes
  54. $SessionID = $this->GetSessionID( $this->RuName );
  55. // save SessionID to DB
  56. update_option('wplister_ebay_sessionid', $SessionID);
  57. // build auth url
  58. $query = array( 'RuName' => $this->RuName, 'SessID' => $SessionID );
  59. $url = $this->GetEbaySignInUrl() . '&'. http_build_query( $query );
  60. $this->logger->info( 'AuthUrl: ' . $url );
  61. return $url;
  62. }
  63. // do FetchToken and save to DB
  64. public function doFetchToken(){
  65. $SessionID = get_option('wplister_ebay_sessionid');
  66. $token = $this->FetchToken( $SessionID );
  67. if ($token) {
  68. update_option('wplister_ebay_token', $token);
  69. update_option('wplister_setup_next_step', '2');
  70. }
  71. }
  72. // do getTokenExpirationTime and save to DB
  73. public function getTokenExpirationTime( $site_id, $sandbox_enabled ){
  74. $token = get_option('wplister_ebay_token');
  75. $expdate = $this->fetchTokenExpirationTime( $token );
  76. update_option('wplister_ebay_token_expirationtime', $expdate);
  77. return $expdate;
  78. }
  79. // establish connection to eBay API
  80. public function initEbay( $site_id, $sandbox_enabled, $token = false){
  81. // init autoloader fro EbatNs classes
  82. $this->loadEbayClasses();
  83. $this->logger->info('initEbay()');
  84. require_once 'EbatNs_ServiceProxy.php';
  85. require_once 'EbatNs_Logger.php';
  86. // hide inevitable cURL warnings from SDK
  87. // *** DISABLE FOR DEBUGGING ***
  88. $this->error_reporting_level = error_reporting();
  89. error_reporting( E_ERROR );
  90. $this->siteId = $site_id;
  91. $this->sandbox = $sandbox_enabled;
  92. #$this->compLevel = 765;
  93. if ( $sandbox_enabled ) {
  94. // sandbox keys
  95. $this->devId = 'db0c17b6-c357-4a38-aa60-7e80158f57dc';
  96. $this->appId = 'LWSWerbu-c159-4552-8411-1406ca5a2bba';
  97. $this->certId = '33272b6e-ef02-4d22-a487-a1a3f02b9c66';
  98. $this->RuName = 'LWS_Werbung_Gmb-LWSWerbu-c159-4-tchfyrowj';
  99. $this->apiurl = 'https://api.sandbox.ebay.com/ws/api.dll';
  100. $this->signin = 'https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn&';
  101. } else {
  102. // production keys
  103. $this->devId = 'db0c17b6-c357-4a38-aa60-7e80158f57dc';
  104. $this->appId = 'LWSWerbu-6147-43ed-9835-853f7b5dc6cb';
  105. $this->certId = '61212d27-f74b-416b-8d48-3160f245443f';
  106. $this->RuName = 'LWS_Werbung_Gmb-LWSWerbu-6147-4-ywstl';
  107. $this->apiurl = 'https://api.ebay.com/ws/api.dll';
  108. $this->signin = 'https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&';
  109. }
  110. // init session
  111. $session = new EbatNs_Session();
  112. // depends on the site working on (needs ID-Value !)
  113. $session->setSiteId($site_id);
  114. // environment (0=production, 1=sandbox)
  115. if ( $sandbox_enabled == '1' ) {
  116. $this->logger->info('initEbay(): SANDBOX ENABLED');
  117. $session->setAppMode(1); // this must be set *before* setting the keys (appId, devId, ...)
  118. } else {
  119. $session->setAppMode(0);
  120. }
  121. $session->setAppId($this->appId);
  122. $session->setDevId($this->devId);
  123. $session->setCertId($this->certId);
  124. if ( $token ) {
  125. // use a token as credential
  126. $session->setTokenMode(true);
  127. // do NOT use a token file !
  128. $session->setTokenUsePickupFile(false);
  129. // token of the user
  130. $session->setRequestToken($token);
  131. } else {
  132. $session->setTokenMode(false);
  133. }
  134. // creating a proxy for UTF8
  135. $sp = new EbatNs_ServiceProxy($session, 'EbatNs_DataConverterUtf8');
  136. // // logger doc: http://www.intradesys.com/de/forum/1528
  137. // if ( get_option('wplister_log_level') > 5 ) {
  138. // #$sp->attachLogger( new EbatNs_Logger(false, 'stdout', true, false) );
  139. // $sp->attachLogger( new EbatNs_Logger(false, $this->logger->file ) );
  140. // }
  141. // attach custom DB Logger for Tools page
  142. // if ( get_option('wplister_log_to_db') == '1' ) {
  143. if ( 'wplister-tools' == $_REQUEST['page'] ) {
  144. $sp->attachLogger( new WPL_EbatNs_Logger( false, 'db' ) );
  145. }
  146. // save service proxy - and session
  147. $this->sp = $sp;
  148. $this->session = $session;
  149. }
  150. // close connection to eBay API
  151. public function closeEbay(){
  152. // restore error reporting level
  153. error_reporting( $this->error_reporting_level );
  154. }
  155. // get SessionID for Auth&Auth
  156. public function GetSessionID( $RuName ){
  157. require_once 'GetSessionIDRequestType.php';
  158. // prepare request
  159. $req = new GetSessionIDRequestType();
  160. $req->setRuName($RuName);
  161. #$req->setErrorLanguage('en_US');
  162. // send request
  163. $res = $this->sp->GetSessionID($req);
  164. // handle errors like blocked ips
  165. if ( $res->Ack != 'Success' ) {
  166. echo "<h1>Problem connecting to eBay</h1>";
  167. echo "<p>WP-Lister can't seem to establish a connection to eBay's servers. This could be caused by a firewall blocking cURL from accessing unkown ip addresses.</p>";
  168. echo "<p>Only your hosting company can sort out the problems causing cURL not to connect properly. Your hosting company's server administrator should be able to resolve the permission problems preventing cURL from working. They've probably got overly limiting restrictions configured on the server, preventing it from being able to do the communication required for listing items on eBay.</p>";
  169. echo "<p>debug output:</p>";
  170. echo "<pre>"; print_r($res); echo "</pre>";
  171. die();
  172. }
  173. // TODO: handle error
  174. return ( $res->SessionID );
  175. }
  176. public function FetchToken( $SessionID ){
  177. require_once 'FetchTokenRequestType.php';
  178. // prepare request
  179. $req = new FetchTokenRequestType();
  180. $req->setSessionID($SessionID);
  181. #$req->setErrorLanguage(0);
  182. // send request
  183. $res = $this->sp->FetchToken($req);
  184. // TODO: handle error
  185. return ( $res->eBayAuthToken );
  186. }
  187. public function fetchTokenExpirationTime( $SessionID ){
  188. require_once 'GetTokenStatusRequestType.php';
  189. // prepare request
  190. $req = new GetTokenStatusRequestType();
  191. $req->setSessionID($SessionID);
  192. #$req->setErrorLanguage(0);
  193. // send request
  194. $res = $this->sp->GetTokenStatus($req);
  195. // TODO: handle error
  196. return ( $res->ExpirationTime );
  197. }
  198. // ajax: initialize categories update
  199. // returns: tasklist
  200. public function initCategoriesUpdate(){
  201. $site_id = get_option('wplister_ebay_site_id');
  202. $cm = new EbayCategoriesModel();
  203. return $cm->initCategoriesUpdate( $this->session, $site_id );
  204. }
  205. // ajax: load single branch of ebay categories
  206. // returns: result
  207. public function loadEbayCategoriesBranch( $cat_id ){
  208. $site_id = get_option('wplister_ebay_site_id');
  209. $cm = new EbayCategoriesModel();
  210. return $cm->loadEbayCategoriesBranch( $cat_id, $this->session, $site_id );
  211. }
  212. // load full categories list and insert to db (old)
  213. public function loadCategories(){
  214. $site_id = get_option('wplister_ebay_site_id');
  215. $cm = new EbayCategoriesModel();
  216. $cm->downloadCategories( $this->session, $site_id );
  217. }
  218. // load Store categories list and insert to db
  219. public function loadStoreCategories(){
  220. $cm = new EbayCategoriesModel();
  221. $cm->downloadStoreCategories( $this->session );
  222. }
  223. // load shipping services and insert to db
  224. public function loadShippingServices(){
  225. $sm = new EbayShippingModel();
  226. $sm->downloadCountryDetails( $this->session );
  227. $sm->downloadShippingLocations( $this->session );
  228. $sm->downloadShippingDetails( $this->session );
  229. $sm->downloadDispatchTimes( $this->session );
  230. }
  231. // load shipping services and insert to db
  232. public function loadPaymentOptions(){
  233. $sm = new EbayPaymentModel();
  234. $sm->downloadPaymentDetails( $this->session );
  235. }
  236. // load available dispatch times
  237. public function loadDispatchTimes(){
  238. $sm = new EbayShippingModel();
  239. return $sm->downloadDispatchTimes( $this->session );
  240. }
  241. // update transactions
  242. public function loadTransactions( $days = null ){
  243. $sm = new TransactionsModel();
  244. $sm->updateTransactions( $this->session, $days );
  245. }
  246. // update listings
  247. public function updateListings(){
  248. $sm = new ListingsModel();
  249. $sm->updateEndedListings( $this->session );
  250. }
  251. // get category conditions
  252. public function getCategoryConditions( $category_id ){
  253. $sm = new EbayCategoriesModel();
  254. return $sm->getCategoryConditions( $this->session, $category_id );
  255. }
  256. // get category specifics
  257. public function getCategorySpecifics( $category_id ){
  258. $sm = new EbayCategoriesModel();
  259. return $sm->getCategorySpecifics( $this->session, $category_id );
  260. }
  261. // process $this->lastResults and look for errors and/or warnings
  262. public function processLastResults(){
  263. $this->logger->debug('processLastResults()'.print_r( $this->lastResults, 1 ));
  264. $this->isSuccess = true;
  265. $this->hasErrors = false;
  266. $this->hasWarnings = false;
  267. foreach ($this->lastResults as $result) {
  268. if ( ! $result->success ) $this->isSuccess = false;
  269. }
  270. }
  271. // call verifyAddItem on selected items
  272. public function verifyItems( $id ){
  273. $this->logger->info('EC::verifyItems('.$id.')');
  274. $sm = new ListingsModel();
  275. if ( is_array( $id )) {
  276. foreach( $id as $single_id ) {
  277. $this->lastResults[] = $sm->verifyAddItem( $single_id, $this->session );
  278. }
  279. $this->processLastResults();
  280. } else {
  281. $this->lastResults[] = $sm->verifyAddItem( $id, $this->session );
  282. $this->processLastResults();
  283. return $this->lastResults;
  284. }
  285. }
  286. // call ReviseItem on selected items
  287. public function reviseItems( $id ){
  288. $sm = new ListingsModel();
  289. if ( is_array( $id )) {
  290. foreach( $id as $single_id ) {
  291. $this->lastResults[] = $sm->reviseItem( $single_id, $this->session );
  292. }
  293. $this->processLastResults();
  294. } else {
  295. $this->lastResults[] = $sm->reviseItem( $id, $this->session );
  296. $this->processLastResults();
  297. return $this->lastResults;
  298. }
  299. }
  300. // call AddItem on selected items
  301. public function sendItemsToEbay( $id ){
  302. $sm = new ListingsModel();
  303. if ( is_array( $id )) {
  304. foreach( $id as $single_id ) {
  305. $this->lastResults[] = $sm->addItem( $single_id, $this->session );
  306. }
  307. $this->processLastResults();
  308. } else {
  309. $this->lastResults[] = $sm->addItem( $id, $this->session );
  310. $this->processLastResults();
  311. return $this->lastResults;
  312. }
  313. }
  314. // call EddItem on selected items
  315. public function endItemsOnEbay( $id ){
  316. $sm = new ListingsModel();
  317. if ( is_array( $id )) {
  318. foreach( $id as $single_id ) {
  319. $this->lastResults[] = $sm->endItem( $single_id, $this->session );
  320. }
  321. $this->processLastResults();
  322. } else {
  323. $this->lastResults[] = $sm->endItem( $id, $this->session );
  324. $this->processLastResults();
  325. return $this->lastResults;
  326. }
  327. }
  328. // call relistItem on selected items
  329. public function relistItems( $id ){
  330. $this->logger->info('EC::relistItems('.$id.')');
  331. $sm = new ListingsModel();
  332. if ( is_array( $id )) {
  333. foreach( $id as $single_id ) {
  334. $this->lastResults[] = $sm->relistItem( $single_id, $this->session );
  335. }
  336. $this->processLastResults();
  337. } else {
  338. $this->lastResults[] = $sm->relistItem( $id, $this->session );
  339. $this->processLastResults();
  340. return $this->lastResults;
  341. }
  342. }
  343. // call GetItemDetails on selected items
  344. public function updateItemsFromEbay( $id ){
  345. $sm = new ListingsModel();
  346. if ( is_array( $id )) {
  347. foreach( $id as $single_id ) {
  348. $this->lastResults[] = $sm->updateItemDetails( $single_id, $this->session );
  349. }
  350. $this->processLastResults();
  351. } else {
  352. $this->lastResults[] = $sm->updateItemDetails( $id, $this->session );
  353. $this->processLastResults();
  354. return $this->lastResults;
  355. }
  356. }
  357. // delete selected items
  358. public function deleteListings( $id ){
  359. $sm = new ListingsModel();
  360. if ( is_array( $id )) {
  361. foreach( $id as $single_id ) {
  362. $sm->deleteItem( $single_id );
  363. }
  364. } else {
  365. $sm->deleteItem( $id );
  366. }
  367. }
  368. // delete selected items
  369. public function deleteProfiles( $id ){
  370. $sm = new ProfilesModel();
  371. if ( is_array( $id )) {
  372. foreach( $id as $single_id ) {
  373. $sm->deleteItem( $single_id );
  374. }
  375. } else {
  376. $sm->deleteItem( $id );
  377. }
  378. }
  379. // delete selected items
  380. public function deleteTransactions( $id ){
  381. $sm = new TransactionsModel();
  382. if ( is_array( $id )) {
  383. foreach( $id as $single_id ) {
  384. $sm->deleteItem( $single_id );
  385. }
  386. } else {
  387. $sm->deleteItem( $id );
  388. }
  389. }
  390. // call verifyAddItem on all prepared items
  391. public function verifyAllPreparedItems(){
  392. $sm = new ListingsModel();
  393. $items = $sm->getAllPrepared();
  394. foreach( $items as $item ) {
  395. $sm->verifyAddItem( $item['id'], $this->session );
  396. }
  397. }
  398. // call AddItem on all verified items
  399. public function publishAllVerifiedItems(){
  400. $sm = new ListingsModel();
  401. $items = $sm->getAllVerified();
  402. foreach( $items as $item ) {
  403. $sm->addItem( $item['id'], $this->session );
  404. }
  405. }
  406. // call reviseItem on all changed items
  407. public function reviseAllChangedItems(){
  408. $sm = new ListingsModel();
  409. $items = $sm->getAllChanged();
  410. foreach( $items as $item ) {
  411. $sm->reviseItem( $item['id'], $this->session );
  412. }
  413. }
  414. // call updateItemDetails on all published and changed items
  415. public function updateAllPublishedItems(){
  416. $sm = new ListingsModel();
  417. $items = $sm->getAllPublished();
  418. foreach( $items as $item ) {
  419. $sm->updateItemDetails( $item['id'], $this->session );
  420. }
  421. }
  422. // call updateSingleTransaction on selected transactions
  423. public function updateTransactionsFromEbay( $id ){
  424. $sm = new TransactionsModel();
  425. if ( is_array( $id )) {
  426. foreach( $id as $single_id ) {
  427. $sm->updateSingleTransaction( $this->session, $single_id );
  428. }
  429. } else {
  430. $sm->updateSingleTransaction( $this->session, $id );
  431. }
  432. }
  433. // GetNotificationPreferences
  434. public function GetNotificationPreferences(){
  435. require_once 'GetNotificationPreferencesRequestType.php';
  436. // prepare request
  437. $req = new GetNotificationPreferencesRequestType();
  438. $req->setPreferenceLevel('Application');
  439. #$req->setPreferenceLevel('User');
  440. // send request
  441. $res = $this->sp->GetNotificationPreferences($req);
  442. // second request for user data
  443. $req->setPreferenceLevel('User');
  444. $res2 = $this->sp->GetNotificationPreferences($req);
  445. // handle result
  446. return ( print_r( $res, 1 ) . print_r( $res2, 1 ) );
  447. }
  448. // SetNotificationPreferences
  449. public function SetNotificationPreferences(){
  450. require_once 'SetNotificationPreferencesRequestType.php';
  451. $app_url = admin_url().'admin-ajax.php?action=handle_ebay_notify';
  452. // prepare request
  453. #$req = new SetNotificationPreferencesRequestType();
  454. #$req->setDeliveryURLName('http://www.example.com/wp-admin/admin-ajax.php?action=handle_ebay_notify');
  455. # example from http://jolierouge.net/2011/05/spree-commerce-ebay-trading-api-and-the-ebay-accelerator-toolkit-from-intradesys-ebatns/
  456. $req = new SetNotificationPreferencesRequestType();
  457. // ApplicationDeliveryPreferences
  458. $req->ApplicationDeliveryPreferences = new ApplicationDeliveryPreferencesType();
  459. $req->ApplicationDeliveryPreferences->setApplicationEnable('Enable');
  460. $req->ApplicationDeliveryPreferences->setApplicationURL($app_url);
  461. //$req->ApplicationDeliveryPreferences->setAlertEmail("youremail");
  462. $req->ApplicationDeliveryPreferences->setAlertEnable("Enable");
  463. // ApplicationDeliveryPreferences.DeliveryURLDetails
  464. $details = new DeliveryURLDetailType();
  465. $details->setDeliveryURLName('wplister_notify_handler');
  466. $details->setDeliveryURL($app_url.'&details=true');
  467. $details->setStatus('Enable');
  468. $req->ApplicationDeliveryPreferences->setDeliveryURLDetails($details,null);
  469. // UserDeliveryPreferenceArray
  470. $user = new NotificationEnableArrayType();
  471. $notifs = array();
  472. // put all of the notices you want here.
  473. foreach (array('BidReceived',
  474. 'EndOfListing',
  475. 'FixedPriceEndOfTransaction',
  476. 'FixedPriceTransaction',
  477. 'ItemListed',
  478. 'ItemSold',
  479. 'FeedbackReceived') as $event) {
  480. $n = new NotificationEnableType();
  481. $n->setEventType($event);
  482. $n->setEventEnable('Enable');
  483. $notifs[] = $n;
  484. }
  485. $user->setNotificationEnable($notifs,null);
  486. $req->setUserDeliveryPreferenceArray($user);
  487. // send request
  488. $res = $this->sp->SetNotificationPreferences($req);
  489. // handle result
  490. return ( print_r( $res, 1 ) );
  491. }
  492. // GetUser
  493. public function GetUser(){
  494. // prepare request
  495. $req = new GetUserRequestType();
  496. // send request
  497. $res = $this->sp->GetUser($req);
  498. $UserID = $res->User->UserID;
  499. update_option('wplister_ebay_token_userid', $UserID);
  500. $user = new stdClass();
  501. $user->UserID = $res->User->UserID;
  502. $user->Email = $res->User->Email;
  503. $user->FeedbackScore = $res->User->FeedbackScore;
  504. $user->FeedbackRatingStar = $res->User->FeedbackRatingStar;
  505. $user->NewUser = $res->User->NewUser;
  506. $user->IDVerified = $res->User->IDVerified;
  507. $user->eBayGoodStanding = $res->User->eBayGoodStanding;
  508. $user->Status = $res->User->Status;
  509. $user->Site = $res->User->Site;
  510. $user->VATStatus = $res->User->VATStatus;
  511. $user->PayPalAccountLevel = $res->User->PayPalAccountLevel;
  512. $user->PayPalAccountType = $res->User->PayPalAccountType;
  513. $user->PayPalAccountStatus = $res->User->PayPalAccountStatus;
  514. $user->StoreOwner = $res->User->SellerInfo->StoreOwner;
  515. $user->StoreURL = $res->User->SellerInfo->StoreURL;
  516. $user->SellerBusinessType = $res->User->SellerInfo->SellerBusinessType;
  517. $user->ExpressEligible = $res->User->SellerInfo->ExpressEligible;
  518. $user->StoreSite = $res->User->SellerInfo->StoreSite;
  519. update_option('wplister_ebay_user', $user);
  520. return ( $UserID );
  521. }
  522. // GetTokenStatus
  523. public function GetTokenStatus(){
  524. // require_once 'GetTokenStatusRequestType.php';
  525. // prepare request
  526. $req = new GetTokenStatusRequestType();
  527. // send request
  528. $res = $this->sp->GetTokenStatus($req);
  529. $expdate = $res->TokenStatus->ExpirationTime;
  530. $expdate = str_replace('T', ' ', $expdate);
  531. $expdate = str_replace('.000Z', '', $expdate);
  532. update_option('wplister_ebay_token_expirationtime', $expdate);
  533. // handle result
  534. return ( $expdate );
  535. }
  536. // test connection to ebay api by single GetItem request
  537. public function testConnection(){
  538. #require_once 'GetItemRequestType.php';
  539. require_once 'GeteBayOfficialTimeRequestType.php';
  540. // prepare request
  541. $req = new GeteBayOfficialTimeRequestType();
  542. #$req->setItemID($item_id);
  543. // send request
  544. $res = $this->sp->GeteBayOfficialTime($req);
  545. // handle result
  546. return ( $res );
  547. }
  548. // TODO: fetch ebaySites from eBay
  549. public function getEbaySites() {
  550. $sites = array (
  551. '0' => 'US',
  552. '2' => 'Canada',
  553. '3' => 'UK',
  554. '77' => 'Germany',
  555. '15' => 'Australia',
  556. '71' => 'France',
  557. '100' => 'eBayMotors',
  558. '101' => 'Italy',
  559. '146' => 'Netherlands',
  560. '186' => 'Spain',
  561. '203' => 'India',
  562. '201' => 'HongKong',
  563. '216' => 'Singapore',
  564. '207' => 'Malaysia',
  565. '211' => 'Philippines',
  566. '210' => 'CanadaFrench',
  567. '212' => 'Poland',
  568. '123' => 'Belgium_Dutch',
  569. '23' => 'Belgium_French',
  570. '16' => 'Austria',
  571. '193' => 'Switzerland',
  572. '205' => 'Ireland'
  573. );
  574. return $sites;
  575. }
  576. //
  577. function _getDomainnameBySiteId($siteid = 0)
  578. {
  579. switch ($siteid) {
  580. case 0:
  581. return 'ebay.com';
  582. case 2:
  583. return 'ebay.ca';
  584. case 3:
  585. return 'ebay.co.uk';
  586. case 15:
  587. return 'ebay.com.au';
  588. case 16:
  589. return 'ebay.at';
  590. case 23:
  591. return 'ebay.be';
  592. case 71:
  593. return 'ebay.fr';
  594. case 77:
  595. return 'ebay.de';
  596. case 100:
  597. return 'ebaymotors.com';
  598. case 101:
  599. return 'ebay.it';
  600. case 123:
  601. return 'ebay.be';
  602. case 146:
  603. return 'ebay.nl';
  604. case 186:
  605. return 'ebay.es';
  606. case 193:
  607. return 'ebay.ch';
  608. case 196:
  609. return 'ebay.tw';
  610. case 201:
  611. return 'ebay.hk';
  612. case 203:
  613. return 'ebay.in';
  614. case 207:
  615. return 'ebay.my';
  616. case 211:
  617. return 'ebay.ph';
  618. case 212:
  619. return 'ebay.pl';
  620. case 216:
  621. return 'ebay.sg';
  622. case 218:
  623. return 'ebay.se';
  624. case 223:
  625. return 'ebay.cn';
  626. }
  627. return 'ebay.com';
  628. } // _getDomainnameBySiteId()
  629. }