| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class to Empty_Trash -- Option for "Bulk Actions - Dropdown Menu" |
| 4 |
* |
| 5 |
* @package Support functions. |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit, if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
// JavaScript: in ../includes/print/_src/bookings_print.js -> function wpbc_print_dialog__show() { ... } . |
| 13 |
|
| 14 |
/** |
| 15 |
* Class WPBC_Listing_Actions__Empty_Trash |
| 16 |
*/ |
| 17 |
class WPBC_Listing_Actions__Empty_Trash{ |
| 18 |
|
| 19 |
const ACTION = 'empty_trash'; |
| 20 |
|
| 21 |
/** |
| 22 |
* Get Action Button |
| 23 |
* |
| 24 |
* @return false|string |
| 25 |
*/ |
| 26 |
public static function get_option() { |
| 27 |
|
| 28 |
// In some versions: if ( ! class_exists( 'wpdev_bk_personal' ) ) { return false; } . |
| 29 |
|
| 30 |
if ( ! wpbc_is_user_can( self::ACTION, wpbc_get_current_user_id() ) ) { |
| 31 |
return false; |
| 32 |
} |
| 33 |
|
| 34 |
$css_class = 'ul_dropdown_menu_li_action '; |
| 35 |
$css_class .= 'ul_dropdown_menu_li_trash_color '; |
| 36 |
$css_class .= 'ul_dropdown_menu_li_action_' . self::ACTION; |
| 37 |
|
| 38 |
$el_id = 'ul_dropdown_menu_li_action_' . self::ACTION; |
| 39 |
|
| 40 |
// Option Title. |
| 41 |
$html = "<a href=\"javascript:void(0)\" class=\"" . esc_attr( $css_class ) . "\" |
| 42 |
onclick=\"if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 43 |
wpbc_ajx_booking_ajax_action_request( { |
| 44 |
'booking_action' : '" . esc_js( self::ACTION ) . "', |
| 45 |
'ui_clicked_element_id': '{$el_id}' |
| 46 |
} ); |
| 47 |
wpbc_button_enable_loading_icon( this ); |
| 48 |
} \" |
| 49 |
title=\"" . esc_attr( __( 'Empty Trash', 'booking' ) ) . "\" |
| 50 |
>" . |
| 51 |
esc_js( __( 'Empty Trash', 'booking' ) ) . |
| 52 |
' <i class="menu_icon icon-1x wpbc_icn_delete_forever"></i>' . |
| 53 |
'</a>'; |
| 54 |
|
| 55 |
return $html; |
| 56 |
} |
| 57 |
} |
| 58 |
|