Changeset 13305
- Timestamp:
- 07/26/2022 02:08:37 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r13298 r13305 3461 3461 ); 3462 3462 3463 $post_url = ''; 3463 $post_url = ''; 3464 $post_title = ''; 3465 $bp_excerpt_args = array( 3466 'html' => false, 3467 'filter_shortcodes' => true, 3468 'strip_tags' => true, 3469 'remove_links' => true, 3470 ); 3464 3471 // Get the WP_Post object if this activity type is a blog post. 3465 3472 if ( $activity['type'] === 'new_blog_post' ) { 3466 $content = get_post( $activity['secondary_item_id'] ); 3467 $post_url = $content->guid; 3473 $content = get_post( $activity['secondary_item_id'] ); 3474 $post_url = $content->guid; 3475 $post_title = sprintf( 3476 '<strong><a href="%1$s">%2$s</a></strong>', 3477 esc_url( $post_url ), 3478 esc_html( $content->post_title ) 3479 ); 3480 3481 $more_text = sprintf( 3482 '<span>%s</span>', 3483 trim( __( ' […]', 'buddypress' ) ) 3484 ); 3485 3486 /** This filter is documented in wp-admin/includes/post-template.php */ 3487 $bp_excerpt_args['ending'] = apply_filters( 3488 'the_content_more_link', 3489 sprintf( 3490 ' <a href="%1$s">%2$s</a>', 3491 esc_url( $post_url ), 3492 $more_text 3493 ), 3494 $more_text 3495 ); 3468 3496 } 3469 3497 … … 3580 3608 3581 3609 // Generate a text excerpt for this activity item (and remove any oEmbeds URLs). 3582 $summary = bp_create_excerpt( html_entity_decode( $content ), 225, array( 3583 'html' => false, 3584 'filter_shortcodes' => true, 3585 'strip_tags' => true, 3586 'remove_links' => true 3587 ) ); 3610 $summary_parts = array( 3611 str_replace( 3612 array( "\n", "\r" ), 3613 ' ', 3614 trim( bp_create_excerpt( html_entity_decode( $content ), 225, $bp_excerpt_args ) ) 3615 ), 3616 ); 3588 3617 3589 3618 if ( $use_media_type === 'embeds' ) { 3590 $summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];3619 $summary_parts[] = PHP_EOL . PHP_EOL . $extracted_media['url']; 3591 3620 } elseif ( $use_media_type === 'images' ) { 3592 3621 $extracted_media_url = isset( $extracted_media['url'] ) ? $extracted_media['url'] : ''; 3622 $image_tag = sprintf( '<img src="%s"> ', esc_url( $extracted_media_url ) ); 3593 3623 3594 3624 if ( $post_url ) { 3595 $summary .= sprintf( '<a href="%1$s" class="activity-post-featured-image"><img src="%2$s"></a>', esc_url( $post_url ), esc_url( $extracted_media_url ) ); 3596 } else { 3597 $summary .= sprintf( ' <img src="%s">', esc_url( $extracted_media_url ) ); 3625 $image_tag = sprintf( '<a href="%1$s" class="activity-post-featured-image">%2$s</a> ', esc_url( $post_url ), trim( $image_tag ) ); 3626 array_unshift( $summary_parts, $image_tag ); 3598 3627 } 3599 3628 } elseif ( in_array( $use_media_type, array( 'audio', 'videos' ), true ) ) { 3600 $summary .= PHP_EOL . PHP_EOL . $extracted_media['original']; // Full shortcode. 3601 } 3629 $summary_parts[] = PHP_EOL . PHP_EOL . $extracted_media['original']; // Full shortcode. 3630 } 3631 3632 if ( $post_title ) { 3633 array_unshift( $summary_parts, $post_title ); 3634 } 3635 3636 // Join summary parts. 3637 $summary = implode( '', $summary_parts ); 3602 3638 3603 3639 /** -
trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css
r13183 r13305 325 325 margin-right: 5px; 326 326 padding-right: 10px; 327 } 328 329 #buddypress .activity-list li.new_blog_post .activity-content .activity-inner strong { 330 display: block; 331 margin-bottom: 0.8em; 332 } 333 334 #buddypress .activity-list li.new_blog_post .activity-content .activity-inner img { 335 float: right; 336 margin-left: 0.8em; 327 337 } 328 338 -
trunk/src/bp-templates/bp-legacy/css/buddypress.css
r13183 r13305 325 325 margin-left: 5px; 326 326 padding-left: 10px; 327 } 328 329 #buddypress .activity-list li.new_blog_post .activity-content .activity-inner strong { 330 display: block; 331 margin-bottom: 0.8em; 332 } 333 334 #buddypress .activity-list li.new_blog_post .activity-content .activity-inner img { 335 float: left; 336 margin-right: 0.8em; 327 337 } 328 338 -
trunk/src/bp-templates/bp-nouveau/common-styles/_bp_activity_entries.scss
r13182 r13305 90 90 } 91 91 } // close li forum elements 92 93 &.new_blog_post { 94 95 .activity-inner { 96 97 strong { 98 display: block; 99 margin-bottom: 0.8em; 100 } 101 102 img { 103 float: left; 104 margin-right: 0.8em; 105 } 106 } 107 } // close li blog post elements 92 108 93 109 -
trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css
r13289 r13305 1305 1305 margin-right: 10px; 1306 1306 padding-right: 1em; 1307 } 1308 1309 .activity-list .activity-item.new_blog_post .activity-inner strong { 1310 display: block; 1311 margin-bottom: 0.8em; 1312 } 1313 1314 .activity-list .activity-item.new_blog_post .activity-inner img { 1315 float: right; 1316 margin-left: 0.8em; 1307 1317 } 1308 1318 -
trunk/src/bp-templates/bp-nouveau/css/buddypress.css
r13289 r13305 1305 1305 margin-left: 10px; 1306 1306 padding-left: 1em; 1307 } 1308 1309 .activity-list .activity-item.new_blog_post .activity-inner strong { 1310 display: block; 1311 margin-bottom: 0.8em; 1312 } 1313 1314 .activity-list .activity-item.new_blog_post .activity-inner img { 1315 float: left; 1316 margin-right: 0.8em; 1307 1317 } 1308 1318 -
trunk/tests/phpunit/testcases/activity/actions.php
r13135 r13305 242 242 $a = $this->activity_exists_for_post( $post_id, 'new_post', true ); 243 243 244 $this->assertSame( $post->post_content, $a->content, 'The Activity about a published post type should be updated when the post content has changed.' );244 $this->assertSame( bp_activity_create_summary( $post->post_content, (array) $a ), $a->content, 'The Activity about a published post type should be updated when the post content has changed.' ); 245 245 } 246 246
Note: See TracChangeset
for help on using the changeset viewer.