Changeset 8685
- Timestamp:
- 07/23/2014 11:13:09 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-template.php
r8491 r8685 1790 1790 global $activities_template; 1791 1791 1792 return apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array) $activities_template->my_favs ) );1792 return (bool) apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array) $activities_template->my_favs ) ); 1793 1793 } 1794 1794 … … 2506 2506 */ 2507 2507 function bp_get_activity_delete_link() { 2508 global $activities_template; 2509 2510 $url = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activities_template->activity->id; 2508 2509 $url = bp_get_activity_delete_url(); 2511 2510 $class = 'delete-activity'; 2512 2511 2513 2512 // Determine if we're on a single activity page, and customize accordingly 2514 2513 if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) { 2515 $url = add_query_arg( array( 'redirect_to' => wp_get_referer() ), $url );2516 2514 $class = 'delete-activity-single'; 2517 2515 } 2518 2516 2519 $link = '<a href="' . wp_nonce_url( $url, 'bp_activity_delete_link' ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>'; 2517 $link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>'; 2518 2520 2519 return apply_filters( 'bp_get_activity_delete_link', $link ); 2520 } 2521 2522 /** 2523 * Output the URL to delete a single activity stream item 2524 * 2525 * @since BuddyPress (2.1.0) 2526 * 2527 * @uses bp_get_activity_delete_link() 2528 */ 2529 function bp_activity_delete_url() { 2530 echo esc_url( bp_get_activity_delete_url() ); 2531 } 2532 /** 2533 * Return the URL to delete a single activity item 2534 * 2535 * @since BuddyPress (2.1.0) 2536 * 2537 * @global object $activities_template {@link BP_Activity_Template} 2538 * @uses bp_get_root_domain() 2539 * @uses bp_get_activity_root_slug() 2540 * @uses bp_is_activity_component() 2541 * @uses bp_current_action() 2542 * @uses add_query_arg() 2543 * @uses wp_get_referer() 2544 * @uses wp_nonce_url() 2545 * @uses apply_filters() To call the 'bp_get_activity_delete_link' hook. 2546 * 2547 * @return string $link Activity delete link. Contains $redirect_to arg 2548 * if on single activity page. 2549 */ 2550 function bp_get_activity_delete_url() { 2551 global $activities_template; 2552 2553 $url = trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activities_template->activity->id ); 2554 2555 // Determine if we're on a single activity page, and customize accordingly 2556 if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) { 2557 $url = add_query_arg( array( 'redirect_to' => wp_get_referer() ), $url ); 2558 } 2559 2560 $url = wp_nonce_url( $url, 'bp_activity_delete_link' ); 2561 2562 return apply_filters( 'bp_get_activity_delete_url', $url ); 2521 2563 } 2522 2564
Note: See TracChangeset
for help on using the changeset viewer.