| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* UsersWP profile social widget. |
| 8 |
* |
| 9 |
* @since 1.1.2 |
| 10 |
*/ |
| 11 |
class UWP_Profile_Social_Widget extends WP_Super_Duper { |
| 12 |
|
| 13 |
/** |
| 14 |
* Register the profile social 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','profile']", |
| 25 |
'class_name' => __CLASS__, |
| 26 |
'base_id' => 'uwp_profile_social', |
| 27 |
'name' => __('UWP > Profile Social','userswp'), |
| 28 |
'widget_ops' => array( |
| 29 |
'classname' => 'uwp-users-list-user-social', |
| 30 |
'description' => esc_html__('Displays fields which are selected to display in social location from form builder.','userswp'), |
| 31 |
), |
| 32 |
'arguments' => array( |
| 33 |
'exclude' => array( |
| 34 |
'title' => __( 'Exclude Fields', 'userswp' ), |
| 35 |
'desc' => __( 'Enter comma separated field keys to exclude from displaying in social location.', 'userswp' ), |
| 36 |
'type' => 'text', |
| 37 |
'desc_tip' => true, |
| 38 |
'default' => '', |
| 39 |
'advanced' => false |
| 40 |
), |
| 41 |
) |
| 42 |
|
| 43 |
); |
| 44 |
|
| 45 |
|
| 46 |
parent::__construct( $options ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* The Super block output function. |
| 51 |
* |
| 52 |
* @param array $args |
| 53 |
* @param array $widget_args |
| 54 |
* @param string $content |
| 55 |
* |
| 56 |
* @return mixed|string|bool |
| 57 |
*/ |
| 58 |
public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 59 |
|
| 60 |
$user = uwp_get_displayed_user(); |
| 61 |
|
| 62 |
$defaults = array( |
| 63 |
'exclude' => '', |
| 64 |
); |
| 65 |
|
| 66 |
$args = wp_parse_args( $args, $defaults ); |
| 67 |
|
| 68 |
$args = apply_filters( 'uwp_widget_profile_social_args', $args, $widget_args, $this ); |
| 69 |
|
| 70 |
ob_start(); |
| 71 |
|
| 72 |
do_action('uwp_profile_social', $user, $args['exclude']); |
| 73 |
|
| 74 |
return ob_get_clean(); |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
} |