Example #1
0
 }
 /* view after type */
 $type = isset($_GET['type']) && array_key_exists($_GET['type'], $types) ? $_GET['type'] : '';
 /* */
 /* view after category */
 $category = isset($_GET['category']) && in_array($_GET['category'], $categories) ? $_GET['category'] : '';
 /* */
 /* pagination */
 $per_page = \query\main::get_option('cj_ipp');
 $page = isset($_GET['page']) && $_GET['page'] > 0 ? $_GET['page'] : 1;
 /* */
 $lookup = array('website-id' => \query\main::get_option('cj_site-id'), 'advertiser-ids' => $view, 'records-per-page' => $per_page, 'page-number' => $page, 'promotion-type' => $type, 'category' => $category);
 if (!empty($_GET['search'])) {
     $lookup['keywords'] = $_GET['search'];
 }
 $links = $cj->linkSearch($lookup);
 //var_dump($links);
 $attributes = $links['links']['@attributes'];
 /* pagination */
 $pages = ceil($attributes['total-matched'] / $per_page);
 if ($page > $pages) {
     $page = $pages;
 }
 /* */
 echo '<div class="results"><a href="' . $GLOBALS['siteURL'] . '_tools/cj_store_img_import.html" target="_blank">[Bind CJ Store Images]</a> ' . $attributes['total-matched'] . ' results';
 if (!empty($_GET['type']) || !empty($_GET['category']) || !empty($_GET['ids']) || !empty($_GET['search'])) {
     echo ' / <a href="?plugin=CJApi/cj.php&amp;action=links' . (isset($_GET['view']) ? '&amp;view=' . htmlspecialchars($_GET['view']) : '') . '">Reset view</a>';
 }
 echo '</div>';
 if ($attributes['records-returned']) {
     echo '<form action="?plugin=CJApi/cj.php&amp;action=import_coupons#" method="POST">