| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Admin\Product\elements\ProductList; |
| 4 |
|
| 5 |
use SyncBasalam\Admin\ProductService; |
| 6 |
|
| 7 |
defined('ABSPATH') || exit; |
| 8 |
|
| 9 |
class Actions |
| 10 |
{ |
| 11 |
public function registerBulkActions($actions) |
| 12 |
{ |
| 13 |
$actions['sync_basalam_bulk_edit'] = 'ویرایش ووسلا� |
| 14 |
'; |
| 15 |
$actions['add_to_basalam'] = 'افزودن به باسلا� |
| 16 |
'; |
| 17 |
$actions['update_on_basalam'] = 'آپدیت در باسلا� |
| 18 |
'; |
| 19 |
$actions['disconnect_basalam_product'] = 'قطع اتصال � |
| 20 |
حصول باسلا� |
| 21 |
'; |
| 22 |
|
| 23 |
return $actions; |
| 24 |
} |
| 25 |
|
| 26 |
public function handleBulkAction($redirectTo, $doaction, $postIds) |
| 27 |
{ |
| 28 |
if (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])), 'bulk-posts')) { |
| 29 |
wp_die('درخواست نا� |
| 30 |
عتبر است. لطفاً دوباره تلاش کنید.'); |
| 31 |
} |
| 32 |
|
| 33 |
if ($doaction === 'add_to_basalam') { |
| 34 |
ProductService::enqueueSelectedProductsForCreation($postIds); |
| 35 |
$redirectTo = add_query_arg('sync_basalam_added'); |
| 36 |
} |
| 37 |
|
| 38 |
if ($doaction === 'update_on_basalam') { |
| 39 |
ProductService::enqueueSelectedProductsForUpdate($postIds); |
| 40 |
$redirectTo = add_query_arg('sync_basalam_updated'); |
| 41 |
} |
| 42 |
|
| 43 |
if ($doaction === 'disconnect_basalam_product') { |
| 44 |
ProductService::disconnectSelectedProducts($postIds); |
| 45 |
$redirectTo = add_query_arg('sync_basalam_disconnected_products'); |
| 46 |
} |
| 47 |
|
| 48 |
return $redirectTo; |
| 49 |
} |
| 50 |
} |
| 51 |
|