Changeset 13520
- Timestamp:
- 07/17/2023 09:01:08 AM (21 months ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-template.php
r13503 r13520 421 421 global $activities_template; 422 422 423 $url = bp_get_requested_url();423 $url = remove_query_arg( 'ac', bp_get_requested_url() ); 424 424 $load_more_args = array( 425 425 $activities_template->pag_arg => $activities_template->pag_page + 1, … … 2610 2610 global $activities_template; 2611 2611 2612 $query_vars = array(); 2613 2614 if ( isset( $_GET['acpage'] ) ) { 2615 $query_vars['acpage'] = (int) wp_unslash( $_GET['acpage'] ); 2616 } 2617 2618 if ( isset( $_GET['offset_lower'] ) ) { 2619 $query_vars['offset_lower'] = (int) wp_unslash( $_GET['offset_lower'] ); 2620 } 2621 2622 // This needs to be the last query var. 2623 $query_vars['ac'] = $activities_template->activity->id; 2624 2625 $url = add_query_arg( $query_vars, bp_get_activity_directory_permalink() ); 2626 2612 2627 /** 2613 2628 * Filters the comment link for the current activity comment. … … 2615 2630 * @since 1.2.0 2616 2631 * 2617 * @param string $ valueConstructed URL parameters with activity IDs.2618 */ 2619 return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id. '/#ac-form-' . $activities_template->activity->id );2632 * @param string $url Constructed URL parameters with activity IDs. 2633 */ 2634 return apply_filters( 'bp_get_activity_comment_link', $url . '/#ac-form-' . $activities_template->activity->id ); 2620 2635 } 2621 2636 … … 2651 2666 2652 2667 /** 2668 * Outputs the URL to cancel a comment. 2669 * 2670 * @since 12.0.0 2671 */ 2672 function bp_activity_comment_cancel_url() { 2673 echo esc_url( bp_get_activity_comment_cancel_url() ); 2674 } 2675 2676 /** 2677 * Returns the URL to cancel a comment. 2678 * 2679 * @since 12.0.0 2680 * 2681 * @return string The URL to cancel a comment. 2682 */ 2683 function bp_get_activity_comment_cancel_url() { 2684 $query_vars = array(); 2685 2686 if ( isset( $_GET['acpage'] ) ) { 2687 $query_vars['acpage'] = (int) wp_unslash( $_GET['acpage'] ); 2688 } 2689 2690 if ( isset( $_GET['offset_lower'] ) ) { 2691 $query_vars['offset_lower'] = (int) wp_unslash( $_GET['offset_lower'] ); 2692 } 2693 2694 $url = add_query_arg( $query_vars, bp_get_activity_directory_permalink() ); 2695 2696 /** 2697 * Filters the cancel comment link for the current activity comment. 2698 * 2699 * @since 12.0.0 2700 * 2701 * @param string $url Constructed URL parameters with activity IDs. 2702 */ 2703 return apply_filters( 'bp_get_activity_comment_cancel_url', $url ); 2704 } 2705 2706 /** 2653 2707 * Output the activity comment form action. 2654 2708 * … … 2657 2711 */ 2658 2712 function bp_activity_comment_form_action() { 2659 echo bp_get_activity_comment_form_action();2713 echo esc_url( bp_get_activity_comment_form_action() ); 2660 2714 } 2661 2715 … … 2665 2719 * @since 1.2.0 2666 2720 * 2667 *2668 2721 * @return string The activity comment form action. 2669 2722 */ 2670 2723 function bp_get_activity_comment_form_action() { 2724 $url = bp_rewrites_get_url( 2725 array( 2726 'component_id' => 'activity', 2727 'single_item_action' => 'reply', 2728 ) 2729 ); 2671 2730 2672 2731 /** … … 2675 2734 * @since 1.2.0 2676 2735 * 2677 * @param string $ valueURL to use in the comment form's action attribute.2678 */ 2679 return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ));2736 * @param string $url URL to use in the comment form's action attribute. 2737 */ 2738 return apply_filters( 'bp_get_activity_comment_form_action', $url ); 2680 2739 } 2681 2740 … … 2803 2862 global $activities_template; 2804 2863 2864 $url = bp_rewrites_get_url( 2865 array( 2866 'component_id' => 'activity', 2867 'single_item_action' => 'favorite', 2868 'single_item_action_variables' => array( $activities_template->activity->id ), 2869 ) 2870 ); 2871 2872 $url = wp_nonce_url( $url, 'mark_favorite' ); 2873 2805 2874 /** 2806 2875 * Filters the activity favorite link. … … 2808 2877 * @since 1.2.0 2809 2878 * 2810 * @param string $ valueConstructed link for favoriting the activity comment.2811 */ 2812 return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ));2879 * @param string $url Constructed link for favoriting the activity comment. 2880 */ 2881 return apply_filters( 'bp_get_activity_favorite_link', $url ); 2813 2882 } 2814 2883 … … 2835 2904 global $activities_template; 2836 2905 2906 $url = bp_rewrites_get_url( 2907 array( 2908 'component_id' => 'activity', 2909 'single_item_action' => 'unfavorite', 2910 'single_item_action_variables' => array( $activities_template->activity->id ), 2911 ) 2912 ); 2913 2914 $url = wp_nonce_url( $url, 'unmark_favorite' ); 2915 2837 2916 /** 2838 2917 * Filters the activity unfavorite link. … … 2840 2919 * @since 1.2.0 2841 2920 * 2842 * @param string $ valueConstructed link for unfavoriting the activity comment.2843 */ 2844 return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ));2921 * @param string $url Constructed link for unfavoriting the activity comment. 2922 */ 2923 return apply_filters( 'bp_get_activity_unfavorite_link', $url ); 2845 2924 } 2846 2925 … … 3589 3668 */ 3590 3669 function bp_get_activity_post_form_action() { 3670 $url = bp_rewrites_get_url( 3671 array( 3672 'component_id' => 'activity', 3673 'single_item_action' => 'post', 3674 ) 3675 ); 3591 3676 3592 3677 /** … … 3595 3680 * @since 1.2.0 3596 3681 * 3597 * @param string $ valueURL to be used for the activity post form.3598 */ 3599 return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ));3682 * @param string $url URL to be used for the activity post form. 3683 */ 3684 return apply_filters( 'bp_get_activity_post_form_action', $url ); 3600 3685 } 3601 3686 -
trunk/src/bp-core/bp-core-functions.php
r13514 r13520 2534 2534 } 2535 2535 2536 // Set default search URL. 2537 $url = bp_get_root_url(); 2538 2536 2539 if ( empty( $_POST['search-terms'] ) ) { 2537 bp_core_redirect( bp_get_root_url());2540 bp_core_redirect( $url ); 2538 2541 return; 2539 2542 } 2540 2543 2541 $search_terms = stripslashes( $_POST['search-terms'] ); 2542 $search_which = !empty( $_POST['search-which'] ) ? $_POST['search-which'] : ''; 2543 $query_string = '/?s='; 2544 $search_terms = sanitize_text_field( wp_unslash( $_POST['search-terms'] ) ); 2545 $encoded_search_terms = urlencode( $search_terms ); 2546 $search_which = ''; 2547 2548 if ( ! empty( $_POST['search-which'] ) ) { 2549 $search_which = sanitize_key( wp_unslash( $_POST['search-which'] ) ); 2550 } 2544 2551 2545 2552 if ( empty( $slug ) ) { 2546 2553 switch ( $search_which ) { 2547 2554 case 'posts': 2548 $slug = ''; 2549 $var = '/?s='; 2555 $url = home_url(); 2550 2556 2551 2557 // If posts aren't displayed on the front page, find the post page's slug. 2552 if ( 'page' == get_option( 'show_on_front' ) ) {2558 if ( 'page' === get_option( 'show_on_front' ) ) { 2553 2559 $page = get_post( get_option( 'page_for_posts' ) ); 2554 2560 2555 if ( ! is_wp_error( $page ) && !empty( $page->post_name ) ) {2561 if ( ! is_wp_error( $page ) && ! empty( $page->post_name ) ) { 2556 2562 $slug = $page->post_name; 2557 $ var = '?s=';2563 $url = get_post_permalink( $page ); 2558 2564 } 2559 2565 } 2566 2567 $url = add_query_arg( 's', $encoded_search_terms, $url ); 2560 2568 break; 2561 2569 2562 2570 case 'activity': 2563 $slug = bp_is_active( 'activity' ) ? bp_get_activity_root_slug() : ''; 2571 if ( bp_is_active( 'activity' ) ) { 2572 $slug = bp_get_activity_root_slug(); 2573 $url = add_query_arg( 'activity_search', $encoded_search_terms, bp_get_activity_directory_permalink() ); 2574 } 2564 2575 break; 2565 2576 2566 2577 case 'blogs': 2567 $slug = bp_is_active( 'blogs' ) ? bp_get_blogs_root_slug() : ''; 2578 if ( bp_is_active( 'blogs' ) ) { 2579 $slug = bp_get_blogs_root_slug(); 2580 $url = add_query_arg( 'sites_search', $encoded_search_terms, bp_get_blogs_directory_url() ); 2581 } 2568 2582 break; 2569 2583 2570 2584 case 'groups': 2571 $slug = bp_is_active( 'groups' ) ? bp_get_groups_root_slug() : ''; 2585 if ( bp_is_active( 'groups' ) ) { 2586 $slug = bp_get_groups_root_slug(); 2587 $url = add_query_arg( 'groups_search', $encoded_search_terms, bp_get_groups_directory_url() ); 2588 } 2572 2589 break; 2573 2590 … … 2575 2592 default: 2576 2593 $slug = bp_get_members_root_slug(); 2594 $url = add_query_arg( 'members_search', $encoded_search_terms, bp_get_members_directory_permalink() ); 2577 2595 break; 2578 2596 } 2579 2597 2580 if ( empty( $slug ) && 'posts' != $search_which ) {2598 if ( empty( $slug ) && 'posts' !== $search_which ) { 2581 2599 bp_core_redirect( bp_get_root_url() ); 2582 2600 return; … … 2589 2607 * @since 1.0.0 2590 2608 * 2591 * @param string $ valueURL for use with site searching.2609 * @param string $url URL for use with site searching. 2592 2610 * @param array $search_terms Array of search terms. 2593 2611 */ 2594 bp_core_redirect( apply_filters( 'bp_core_search_site', home_url( $slug . $query_string . urlencode( $search_terms ) ), $search_terms ) );2612 bp_core_redirect( apply_filters( 'bp_core_search_site', $url, $search_terms ) ); 2595 2613 } 2596 2614 -
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r13503 r13520 935 935 break; 936 936 default: 937 $feed_url = home_url( bp_get_activity_root_slug() . '/feed/' ); 937 $feed_url = bp_rewrites_get_url( 938 array( 939 'component_id' => 'activity', 940 'single_item_action' => 'feed', 941 ) 942 ); 938 943 break; 939 944 } -
trunk/src/bp-templates/bp-legacy/buddypress/activity/entry.php
r13183 r13520 9 9 * @subpackage bp-legacy 10 10 * @since 3.0.0 11 * @version 1 0.0.011 * @version 12.0.0 12 12 */ 13 13 … … 134 134 <textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea> 135 135 </div> 136 <input type="submit" name="ac_form_submit" value="<?php esc_attr_e( 'Post', 'buddypress' ); ?>" /> <a href=" #" class="ac-reply-cancel"><?php_e( 'Cancel', 'buddypress' ); ?></a>136 <input type="submit" name="ac_form_submit" value="<?php esc_attr_e( 'Post', 'buddypress' ); ?>" /> <a href="<?php bp_activity_comment_cancel_url(); ?>" class="ac-reply-cancel"><?php esc_html_e( 'Cancel', 'buddypress' ); ?></a> 137 137 <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" /> 138 138 </div>
Note: See TracChangeset
for help on using the changeset viewer.