| 1 |
<?php |
| 2 |
/** |
| 3 |
* Friend List Widget |
| 4 |
* |
| 5 |
* A widget that displays a list of your friends. |
| 6 |
* |
| 7 |
* @package Friends |
| 8 |
* @since 0.3 |
| 9 |
*/ |
| 10 |
|
| 11 |
namespace Friends; |
| 12 |
|
| 13 |
/** |
| 14 |
* This is the class for the Friend List Widget. |
| 15 |
* |
| 16 |
* @package Friends |
| 17 |
* @author Alex Kirk |
| 18 |
*/ |
| 19 |
class Widget_Recent_Friends_List extends Widget_Base_Friends_List { |
| 20 |
/** |
| 21 |
* Constructor |
| 22 |
*/ |
| 23 |
public function __construct() { |
| 24 |
parent::__construct( |
| 25 |
'friends-widget-recent-friend-list', |
| 26 |
__( 'Recent Friend List', 'friends' ), |
| 27 |
array( |
| 28 |
'description' => __( 'Shows a list of your Recent friends and subscriptions.', 'friends' ), |
| 29 |
) |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Render the widget. |
| 35 |
* |
| 36 |
* @param array $args Sidebar arguments. |
| 37 |
* @param array $instance Widget instance settings. |
| 38 |
*/ |
| 39 |
public function widget( $args, $instance ) { |
| 40 |
$instance = wp_parse_args( $instance, $this->defaults() ); |
| 41 |
|
| 42 |
echo $args['before_widget']; |
| 43 |
|
| 44 |
$this->list_friends( |
| 45 |
$args, |
| 46 |
__( 'Recent Friends', 'friends' ), |
| 47 |
User_Query::recent_friends_subscriptions( 5 ) |
| 48 |
); |
| 49 |
|
| 50 |
do_action( 'friends_widget_lastest_friend_list_after', $this, $args ); |
| 51 |
|
| 52 |
echo $args['after_widget']; |
| 53 |
} |
| 54 |
} |
| 55 |
|