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
← All changes | includes/class-shortcodes.php +5 -85 2.7.64.3.2 View file →
@@ -38,100 +38,20 @@
38 38 /**
39 39 * Register the WordPress shortcodes
40 40 */
41 41 private function register_shortcodes() {
42 - add_shortcode( 'only-friends', array( $this, 'only_friends_shortcode' ) );
43 - add_shortcode( 'not-friends', array( $this, 'not_friends_shortcode' ) );
44 - add_shortcode( 'friends-list', array( $this, 'friends_list_shortcode' ) );
42 + add_shortcode( 'only-friends', '__return_empty_string' ); // deprecated after removal of friendships.
43 + add_shortcode( 'not-friends', '__return_empty_string' ); // deprecated after removal of friendships.
44 + add_shortcode( 'friends-list', '__return_empty_string' ); // deprecated after removal of friendships.
45 45 add_shortcode( 'friends-count', array( $this, 'friends_count_shortcode' ) );
46 46 }
47 47
48 48 /**
49 - * Display the content of this shortcode just to friends.
50 - *
51 - * @param array $atts Attributes provided by the user.
52 - * @param string $content Enclosed content provided by the user.
53 - * @return string The content to be output.
54 - */
55 - public function only_friends_shortcode( $atts, $content = null ) {
56 - if ( current_user_can( 'friend' ) ) {
57 - return do_shortcode( $content );
58 - }
59 -
60 - if ( friends::has_required_privileges() ) {
61 - return '<div class="only-friends"><span class="watermark">' . __( 'Only friends', 'friends' ) . '</span>' . do_shortcode( $content ) . '</div>';
62 - }
63 -
64 - return '';
65 - }
66 -
67 - /**
68 - * Display the content of this shortcode to everyone except friends.
69 - *
70 - * @param array $atts Attributes provided by the user.
71 - * @param string $content Enclosed content provided by the user.
72 - * @return string The content to be output.
73 - */
74 - public function not_friends_shortcode( $atts, $content = null ) {
75 - if ( current_user_can( 'friend' ) ) {
76 - return '';
77 - }
78 -
79 - if ( friends::has_required_privileges() ) {
80 - return '<div class="not-friends"><span class="watermark">' . __( 'Not friends', 'friends' ) . '</span>' . do_shortcode( $content ) . '</div>';
81 - }
82 -
83 - return do_shortcode( $content );
84 - }
85 -
86 - /**
87 - * Display a list of your friends.
88 - *
89 - * @param array $atts Attributes provided by the user.
90 - * @return string The content to be output.
91 - */
92 - public function friends_list_shortcode( $atts ) {
93 - $a = shortcode_atts(
94 - array(
95 - 'include-links' => false,
96 - ),
97 - $atts
98 - );
99 -
100 - $friends = User_Query::all_friends();
101 - $ret = '<ul class="friend-list">';
102 -
103 - foreach ( $friends->get_results() as $friend_user ) {
104 - $ret .= '<li>';
105 -
106 - if ( $a['include-links'] ) {
107 - $ret .= '<a href="' . esc_url( $friend_user->user_url ) . '">';
108 - }
109 -
110 - $ret .= esc_html( $friend_user->display_name );
111 -
112 - if ( $a['include-links'] ) {
113 - $ret .= '</a>';
114 - }
115 -
116 - $ret .= '</li>';
117 -
118 - }
119 -
120 - $ret .= '</ul>';
121 -
122 - return $ret;
123 - }
124 -
125 - /**
126 49 * Display the number of your friends.
127 50 *
128 - * @param array $atts Attributes provided by the user.
129 51 * @return string The content to be output.
130 52 */
131 - public function friends_count_shortcode( $atts ) {
132 - exit;
133 - $friends = User_Query::all_friends();
53 + public function friends_count_shortcode() {
54 + $friends = User_Query::all_subscriptions();
134 55 return $friends->get_total();
135 56 }
136 -
137 57 }