Пример #1
0
 public function ajax_wpl_ebay_store_categories()
 {
     $default_account_id = get_option('wplister_default_account_id');
     $account_id = isset($_REQUEST['account_id']) ? intval($_REQUEST['account_id']) : $default_account_id;
     $store_categories = EbayCategoriesModel::getEntireStoreCategoryTree(0, $account_id);
     // check if callback parameter is set
     if (isset($_REQUEST['callback'])) {
         // return JSONP
         header('content-type: application/javascript; charset=utf-8');
         echo $_REQUEST['callback'] . '(' . json_encode($store_categories) . ')';
     } else {
         // return plain JSON
         header('content-type: application/json; charset=utf-8');
         echo json_encode($store_categories);
     }
     exit;
 }