| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* UsersWP user actions widget. |
| 8 |
* |
| 9 |
* @since 1.1.2 |
| 10 |
*/ |
| 11 |
class UWP_User_Actions_Widget extends WP_Super_Duper { |
| 12 |
|
| 13 |
/** |
| 14 |
* Register the user actions widget with WordPress. |
| 15 |
* |
| 16 |
*/ |
| 17 |
public function __construct() { |
| 18 |
|
| 19 |
|
| 20 |
$options = array( |
| 21 |
'textdomain' => 'userswp', |
| 22 |
'block-icon' => 'admin-site', |
| 23 |
'block-category'=> 'widgets', |
| 24 |
'block-keywords'=> "['userswp','user']", |
| 25 |
'class_name' => __CLASS__, |
| 26 |
'base_id' => 'uwp_user_actions', |
| 27 |
'name' => __('UWP > User Actions','userswp'), |
| 28 |
'no_wrap' => true, |
| 29 |
'block-wrap' => '', |
| 30 |
'widget_ops' => array( |
| 31 |
'classname' => 'uwp-user-actions bsui', |
| 32 |
'description' => esc_html__('Display user actions.','userswp'), |
| 33 |
), |
| 34 |
'arguments' => array( |
| 35 |
'title' => array( |
| 36 |
'title' => __( 'Title', 'userswp' ), |
| 37 |
'desc' => __( 'Enter widget title.', 'userswp' ), |
| 38 |
'type' => 'text', |
| 39 |
'desc_tip' => true, |
| 40 |
'default' => '', |
| 41 |
'advanced' => false |
| 42 |
), |
| 43 |
) |
| 44 |
|
| 45 |
); |
| 46 |
|
| 47 |
|
| 48 |
parent::__construct( $options ); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* The Super block output function. |
| 53 |
* |
| 54 |
* @param array $args |
| 55 |
* @param array $widget_args |
| 56 |
* @param string $content |
| 57 |
* |
| 58 |
* @return mixed|string|bool |
| 59 |
*/ |
| 60 |
public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 61 |
|
| 62 |
$user = uwp_get_displayed_user(); |
| 63 |
|
| 64 |
ob_start(); |
| 65 |
|
| 66 |
do_action('uwp_user_actions', $user); |
| 67 |
|
| 68 |
$output = ob_get_clean(); |
| 69 |
|
| 70 |
return $output; |
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
} |