PluginProbe
Friends / 4.3.2
Friends v4.3.2
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
friends / templates / admin / dashboard-widget.php

dashboard-widget.php in Friends 4.3.2, at templates/admin/dashboard-widget.php

61 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This template contains the Friends Dashboard Widget.
4 *
5 * @package Friends
6 */
7
8 namespace Friends;
9
10 ?><ul>
11 <?php
12 foreach ( $args['posts'] as $_post ) :
13 $friend_user = User::get_post_author( $_post );
14 $author_name = $friend_user->display_name;
15 $override_author_name = apply_filters( 'friends_override_author_name', '', $author_name, $_post->ID );
16 $avatar = $friend_user->get_avatar_url();
17 if ( ! $avatar ) {
18 $avatar = get_avatar_url( $friend_user->ID );
19 }
20 $avatar = apply_filters( 'friends_author_avatar_url', $avatar, $friend_user, $_post->ID );
21
22 ?>
23 <li id="friends-dashboard-post-<?php echo esc_attr( $_post->ID ); ?>" class="friends-post">
24 <?php echo esc_html( get_the_date( get_option( 'time_format', 'H:i' ), $_post ) ); ?>:
25
26 <?php if ( ! isset( $args['friend_user'] ) ) : ?>
27 <a href="<?php echo esc_attr( $friend_user->get_local_friends_page_url() ); ?>" class="author-avatar">
28 <img src="<?php echo esc_url( $avatar ); /* phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage */ ?>" width="16" height="16" />
29 </a>
30 <a href="<?php echo esc_url( $friend_user->get_local_friends_page_url() ); ?>">
31 <strong><?php echo esc_html( $friend_user->display_name ); ?></strong><?php if ( $override_author_name && trim( str_replace( $override_author_name, '', $author_name ) ) === $author_name ) : ?>
32 <?php echo esc_html( $override_author_name ); ?>
33 <?php endif; ?></a>:
34 <?php endif; ?>
35 <a href="<?php echo esc_url( $friend_user->get_local_friends_page_url( $_post->ID ) ); ?>">
36 <?php
37 if ( $_post->post_title ) {
38 echo esc_html( $_post->post_title );
39 } else {
40 echo esc_html( wp_trim_words( get_the_excerpt( $_post ), 18 ) );
41 }
42 ?>
43 </a>
44 <a href="<?php echo esc_url( $_post->guid ); ?>" class="dashicons dashicons-external">
45 </a>
46 </li>
47 <?php endforeach; ?>
48 </ul>
49
50 <?php if ( empty( $args['posts'] ) ) : ?>
51 <?php esc_html_e( 'No posts yet.', 'friends' ); ?>
52 <?php elseif ( isset( $args['friend_user'] ) && isset( $args['format'] ) ) : ?>
53 <a href="<?php echo esc_url( $args['friend_user']->get_local_friends_page_post_format_url( $args['format'] ) ); ?>"><?php esc_html_e( 'Go to your friends page for all posts', 'friends' ); ?></a>
54 <?php elseif ( isset( $args['friend_user'] ) ) : ?>
55 <a href="<?php echo esc_url( $args['friend_user']->get_local_friends_page_url() ); ?>"><?php esc_html_e( 'Go to your friends page for all posts', 'friends' ); ?></a>
56 <?php elseif ( isset( $args['format'] ) ) : ?>
57 <a href="<?php echo esc_url( home_url( '/friends/type/' . $args['format'] ) ); ?>"><?php esc_html_e( 'Go to your friends page for all posts', 'friends' ); ?></a>
58 <?php else : ?>
59 <a href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"><?php esc_html_e( 'Go to your friends page for all posts', 'friends' ); ?></a>
60 <?php endif; ?>
61