| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* UsersWP profile widget. |
| 8 |
* |
| 9 |
* @since 1.0.22 |
| 10 |
*/ |
| 11 |
class UWP_Profile_Widget extends WP_Super_Duper { |
| 12 |
|
| 13 |
/** |
| 14 |
* Register the profile 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', |
| 27 |
'name' => __('UWP > Profile','userswp'), |
| 28 |
'no_wrap' => true, |
| 29 |
'widget_ops' => array( |
| 30 |
'classname' => 'uwp-profile-class bsui', |
| 31 |
'description' => esc_html__('Displays user profile.','userswp'), |
| 32 |
), |
| 33 |
'arguments' => array( |
| 34 |
'title' => array( |
| 35 |
'title' => __( 'Widget title', 'userswp' ), |
| 36 |
'desc' => __( 'Enter widget title.', 'userswp' ), |
| 37 |
'type' => 'text', |
| 38 |
'desc_tip' => true, |
| 39 |
'default' => '', |
| 40 |
'advanced' => false |
| 41 |
), |
| 42 |
'disable_greedy' => array( |
| 43 |
'title' => __('Disable Greedy Menu', 'userswp'), |
| 44 |
'desc' => __('Greedy menu prevents a large menu falling onto another line by adding a dropdown select.', 'userswp'), |
| 45 |
'type' => 'checkbox', |
| 46 |
'desc_tip' => true, |
| 47 |
'value' => '1', |
| 48 |
'default' => '', |
| 49 |
'advanced' => true, |
| 50 |
), |
| 51 |
) |
| 52 |
|
| 53 |
); |
| 54 |
|
| 55 |
|
| 56 |
parent::__construct( $options ); |
| 57 |
} |
| 58 |
|
| 59 |
public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 60 |
|
| 61 |
ob_start(); |
| 62 |
|
| 63 |
echo '<div class="uwp_widgets uwp_widget_profile">'; |
| 64 |
|
| 65 |
echo '<div class="uwp_page">'; |
| 66 |
|
| 67 |
$design_style = !empty($args['design_style']) ? esc_attr($args['design_style']) : uwp_get_option("design_style",'bootstrap'); |
| 68 |
$template = $design_style ? $design_style."/profile.php" : "profile.php"; |
| 69 |
|
| 70 |
uwp_get_template($template, $args); |
| 71 |
|
| 72 |
echo '</div>'; |
| 73 |
|
| 74 |
echo '</div>'; |
| 75 |
|
| 76 |
return ob_get_clean(); |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
} |