if (array_key_exists($key, $array)) {
        $new = array();
        foreach ($array as $k => $value) {
            $new[$k] = $value;
            if ($k === $key) {
                $new[$new_key] = $new_value;
            }
        }
        return $new;
    }
    return false;
}
$ebay = new Ebay();
$ebay_profile = new EbayProfile((int) Tools::getValue('profile'));
if (!Configuration::get('EBAY_SECURITY_TOKEN') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) {
    return Tools::safeOutput(Tools::getValue('not_logged_str'));
}
$category_list = $ebay->getChildCategories(Category::getCategories(Tools::getValue('id_lang')), version_compare(_PS_VERSION_, '1.5', '>') ? 1 : 0);
$offset = 20;
$page = (int) Tools::getValue('p', 0);
if ($page < 2) {
    $page = 1;
}
$limit = $offset * ($page - 1);
$category_list = array_slice($category_list, $limit, $offset);
$ebay_store_category_list = EbayStoreCategory::getCategoriesWithConfiguration($ebay_profile->id);
$smarty = Context::getContext()->smarty;
/* Smarty datas */
$template_vars = array('tabHelp' => '&id_tab=7', '_path' => $ebay->getPath(), 'categoryList' => $category_list, 'eBayStoreCategoryList' => $ebay_store_category_list, 'request_uri' => $_SERVER['REQUEST_URI'], 'noCatFound' => Tools::getValue('ch_no_cat_str'), 'p' => $page);
$smarty->assign($template_vars);
echo $ebay->display(realpath(dirname(__FILE__) . '/../'), '/views/templates/hook/table_store_categories.tpl');