public function ajax_get_store_categories_tree() { $account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : get_option('wplister_default_account_id'); $site_id = WPLE()->accounts[$account_id]->site_id; $path = $_POST["dir"]; $parent_cat_id = basename($path); $categories = EbayCategoriesModel::getChildrenOfStoreCategory($parent_cat_id, $account_id); $categories = apply_filters('wplister_get_store_categories_node', $categories, $parent_cat_id, $path); if (count($categories) > 0) { echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">"; // add reference to parent node - non-leaf Store Categories are allowed as well if ($parent_cat_id != 0) { $parent_path = substr($_POST['dir'], 0, -1); // strip trailing slash echo '<li class="file ext_txt"><a href="#" rel="' . $parent_path . '">' . '[use this category]' . '</a></li>'; } // All dirs foreach ($categories as $cat) { if ($cat['leaf'] == '0') { echo '<li class="directory collapsed"><a href="#" rel="' . ($_POST['dir'] . $cat['cat_id']) . '/">' . $cat['cat_name'] . '</a></li>'; } } // All files foreach ($categories as $cat) { if ($cat['leaf'] == '1') { $ext = 'txt'; echo '<li class="file ext_txt"><a href="#" rel="' . ($_POST['dir'] . $cat['cat_id']) . '">' . $cat['cat_name'] . '</a></li>'; } } echo "</ul>"; } exit; }