Changeset 6591 for trunk/src/includes/replies/template.php
- Timestamp:
- 06/19/2017 09:46:29 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/replies/template.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/template.php
r6583 r6591 1132 1132 'type' => 'both', 1133 1133 'size' => 80, 1134 'sep' => ' ',1134 'sep' => '', 1135 1135 'show_role' => false 1136 1136 ), 'get_reply_author_link' ); 1137 1137 1138 // Default return value 1139 $author_link = ''; 1140 1138 1141 // Used as reply_id 1139 if ( is_numeric( $args ) ) { 1140 $reply_id = bbp_get_reply_id( $args ); 1141 } else { 1142 $reply_id = bbp_get_reply_id( $r['post_id'] ); 1143 } 1142 $reply_id = is_numeric( $args ) 1143 ? bbp_get_reply_id( $args ) 1144 : bbp_get_reply_id( $r['post_id'] ); 1144 1145 1145 1146 // Reply ID is good … … 1152 1153 // Tweak link title if empty 1153 1154 if ( empty( $r['link_title'] ) ) { 1154 $link_title = sprintf( empty( $anonymous ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ), bbp_get_reply_author_display_name( $reply_id ) ); 1155 $author = bbp_get_reply_author_display_name( $reply_id ); 1156 $title = empty( $anonymous ) 1157 ? __( 'View %s\'s profile', 'bbpress' ) 1158 : __( 'Visit %s\'s website', 'bbpress' ); 1159 $link_title = sprintf( $title, $author ); 1155 1160 1156 1161 // Use what was passed if not … … 1160 1165 1161 1166 // Setup title and author_links array 1162 $link_title = ! empty( $link_title ) ? ' title="' . esc_attr( $link_title ) . '"' : '';1163 1167 $author_links = array(); 1164 1165 // Get avatar 1166 if ( 'avatar' === $r['type'] || 'both' === $r['type'] ) { 1168 $link_title = ! empty( $link_title ) 1169 ? ' title="' . esc_attr( $link_title ) . '"' 1170 : ''; 1171 1172 // Get avatar (unescaped, because HTML) 1173 if ( ( 'avatar' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 1167 1174 $author_links['avatar'] = bbp_get_reply_author_avatar( $reply_id, $r['size'] ); 1168 1175 } 1169 1176 1170 // Get display name 1171 if ( 'name' === $r['type'] || 'both' === $r['type']) {1172 $author_links['name'] = bbp_get_reply_author_display_name( $reply_id);1177 // Get display name (escaped, because never HTML) 1178 if ( ( 'name' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 1179 $author_links['name'] = esc_html( bbp_get_reply_author_display_name( $reply_id ) ); 1173 1180 } 1174 1181 … … 1179 1186 if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) { 1180 1187 1188 // Empty array 1189 $links = array(); 1190 1181 1191 // Assemble the links 1182 1192 foreach ( $author_links as $link => $link_text ) { 1183 $link_class = ' class="bbp-author-' . $link. '"';1184 $ author_link[]= sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url( $author_url ), $link_title, $link_class, $link_text );1193 $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"'; 1194 $links[] = sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url( $author_url ), $link_title, $link_class, $link_text ); 1185 1195 } 1186 1196 1197 // Role is not linked 1187 1198 if ( true === $r['show_role'] ) { 1188 $ author_link[] = bbp_get_reply_author_role( array( 'reply_id' => $reply_id ) );1199 $links[] = bbp_get_reply_author_role( array( 'reply_id' => $reply_id ) ); 1189 1200 } 1190 1201 1191 $author_link = implode( $r['sep'], $author_link ); 1192 1193 // No links if anonymous 1194 } else { 1195 $author_link = implode( $r['sep'], $author_links ); 1202 // Juggle 1203 $author_links = $links; 1204 unset( $links ); 1196 1205 } 1197 1206 1198 // No replies so link is empty 1199 } else { 1200 $author_link = ''; 1207 // Filter sections 1208 $sections = apply_filters( 'bbp_get_reply_author_links', $author_links, $r, $args ); 1209 1210 // Assemble sections into author link 1211 $author_link = implode( $r['sep'], $sections ); 1201 1212 } 1202 1213
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)