PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.18
ووسلام – همگام سازی ووکامرس و باسلام v1.10.18
1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 1.8.7 1.8.4 All 51 releases
sync-basalam / templates / admin / ProductSync.php

ProductSync.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.18, at templates/admin/ProductSync.php

58 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 use SyncBasalam\Services\Products\FetchUnsyncProducts;
3 use SyncBasalam\Admin\Components\ProductListComponents;
4
5 defined('ABSPATH') || exit;
6
7 $sync_basalam_sync_status_checker = new FetchUnsyncProducts();
8
9 $cursor = isset($_GET['unsync_cursor']) ? sanitize_text_field(wp_unslash($_GET['unsync_cursor'])) : null;
10 $history = isset($_GET['unsync_history']) && is_array($_GET['unsync_history'])
11 ? array_values(array_filter(array_map('sanitize_text_field', wp_unslash($_GET['unsync_history']))))
12 : [];
13
14 $hasPrev = false;
15 $prevCursor = null;
16 $prevHistory = $history;
17
18 if (!empty($history)) {
19 $hasPrev = true;
20 $prevCursor = end($history);
21 array_pop($prevHistory);
22 } elseif (!empty($cursor)) {
23 // If user opens a cursor page directly, previous page is the initial page (without cursor).
24 $hasPrev = true;
25 }
26
27 $nextHistory = $history;
28 if (!empty($cursor)) $nextHistory[] = $cursor;
29
30 $nextCursor = null;
31
32 $unsync_products = $sync_basalam_sync_status_checker->getUnsyncBasalamProducts($cursor, $nextCursor);
33
34 if (!empty($unsync_products)) {
35 ProductListComponents::renderUnsyncBasalamProductsTable($unsync_products);
36 ?>
37
38 <div class="basalam-pagination basalam-pagination-flex">
39 <?php if ($hasPrev):
40 $prevArgs = ['page' => 'basalam-show-products'];
41 if (!empty($prevCursor)) $prevArgs['unsync_cursor'] = $prevCursor;
42 if (!empty($prevHistory)) $prevArgs['unsync_history'] = $prevHistory;
43 ?>
44 <a href="<?php echo esc_url(add_query_arg($prevArgs, admin_url('admin.php'))); ?>">قبلی</a>
45 <?php endif; ?>
46
47 <?php if (!empty($nextCursor)): ?>
48 <?php
49 $nextArgs = ['page' => 'basalam-show-products', 'unsync_cursor' => $nextCursor];
50 if (!empty($nextHistory)) $nextArgs['unsync_history'] = $nextHistory;
51 ?>
52 <a href="<?php echo esc_url(add_query_arg($nextArgs, admin_url('admin.php'))); ?>">بعدی</a>
53 <?php endif; ?>
54 </div>
55 <?php
56 } else echo '<p class="basalam-p">�
57 حصولی یافت نشد</p>';
58