Changeset 6433 for trunk/src/includes/topics/template.php
- Timestamp:
- 05/26/2017 09:50:36 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r6415 r6433 2769 2769 ), 'get_topic_trash_link' ); 2770 2770 2771 // Get topic 2771 2772 $topic = bbp_get_topic( $r['id'] ); 2772 2773 2774 // Bail if no topic or current user cannot delete 2773 2775 if ( empty( $topic ) || ! current_user_can( 'delete_topic', $topic->ID ) ) { 2774 2776 return; 2775 2777 } 2776 2778 2777 $actions = array(); 2779 $actions = array(); 2780 $trash_days = bbp_get_trash_days( bbp_get_topic_post_type() ); 2778 2781 2779 2782 if ( bbp_is_topic_trash( $topic->ID ) ) { 2780 2783 $actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'untrash', 'topic_id' => $topic->ID ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) ) . '" class="bbp-topic-restore-link">' . $r['restore_text'] . '</a>'; 2781 } elseif ( EMPTY_TRASH_DAYS) {2784 } elseif ( ! empty( $trash_days ) ) { 2782 2785 $actions['trash'] = '<a title="' . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'trash', 'topic_id' => $topic->ID ) ), 'trash-' . $topic->post_type . '_' . $topic->ID ) ) . '" class="bbp-topic-trash-link">' . $r['trash_text'] . '</a>'; 2783 2786 } 2784 2787 2785 if ( bbp_is_topic_trash( $topic->ID ) || ! EMPTY_TRASH_DAYS) {2788 if ( bbp_is_topic_trash( $topic->ID ) || empty( $trash_days ) ) { 2786 2789 $actions['delete'] = '<a title="' . esc_attr__( 'Delete this item permanently', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'delete', 'topic_id' => $topic->ID ) ), 'delete-' . $topic->post_type . '_' . $topic->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-topic-delete-link">' . $r['delete_text'] . '</a>'; 2787 2790 } … … 2839 2842 ), 'get_topic_close_link' ); 2840 2843 2844 // Get topic 2841 2845 $topic = bbp_get_topic( $r['id'] ); 2842 2846 2847 // Bail if no topic or current user cannot moderate 2843 2848 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2844 2849 return; … … 2900 2905 ), 'get_topic_approve_link' ); 2901 2906 2907 // Get topic 2902 2908 $topic = bbp_get_topic( $r['id'] ); 2903 2909 2910 // Bail if no topic or current user cannot moderate 2904 2911 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2905 2912 return; … … 2962 2969 ), 'get_topic_stick_link' ); 2963 2970 2971 // Get topic 2964 2972 $topic = bbp_get_topic( $r['id'] ); 2965 2973 2974 // Bail if no topic or current user cannot moderate 2966 2975 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2967 2976 return; … … 3032 3041 ), 'get_topic_merge_link' ); 3033 3042 3043 // Get topic 3034 3044 $topic = bbp_get_topic( $r['id'] ); 3035 3045 3046 // Bail if no topic or current user cannot moderate 3036 3047 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 3037 3048 return; … … 3133 3144 // Parse arguments against default values 3134 3145 $r = bbp_parse_args( $args, array( 3135 'id' 3136 'link_before' 3137 'link_after' 3138 'reply_text' 3146 'id' => 0, 3147 'link_before' => '', 3148 'link_after' => '', 3149 'reply_text' => esc_html_x( 'Reply', 'verb', 'bbpress' ), 3139 3150 ), 'get_topic_reply_link' ); 3140 3151 3141 // Get the replyto use it's ID and post_parent3152 // Get the topic to use it's ID and post_parent 3142 3153 $topic = bbp_get_topic( $r['id'] ); 3143 3154 3144 // Bail if no replyor user cannot reply3145 if ( empty( $topic ) || ! bbp_current_user_can_access_create_reply_form() ) {3155 // Bail if no topic or user cannot reply 3156 if ( empty( $topic ) || bbp_is_single_reply() || ! bbp_current_user_can_access_create_reply_form() ) { 3146 3157 return; 3147 3158 } … … 3149 3160 // Add $uri to the array, to be passed through the filter 3150 3161 $r['uri'] = '#new-post'; 3151 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link">' . esc_html( $r['reply_text'] ). '</a>' . $r['link_after'];3162 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after']; 3152 3163 3153 3164 return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args ); … … 3438 3449 } 3439 3450 3440 // Used variables3441 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . (int) $r['tab'] . '"' : '';3442 3443 3451 // Start an output buffer, we'll finish it after the select loop 3444 3452 ob_start(); ?> 3445 3453 3446 <select name="<?php echo esc_attr( $r['select_id'] ); ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php echo $tab; ?>>3454 <select name="<?php echo esc_attr( $r['select_id'] ); ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 3447 3455 3448 3456 <?php foreach ( bbp_get_topic_types( $r['topic_id'] ) as $key => $label ) : ?> … … 3522 3530 } 3523 3531 3524 // Used variables3525 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . (int) $r['tab'] . '"' : '';3526 3527 3532 // Start an output buffer, we'll finish it after the select loop 3528 3533 ob_start(); ?> 3529 3534 3530 <select name="<?php echo esc_attr( $r['select_id'] ) ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php echo $tab; ?>>3535 <select name="<?php echo esc_attr( $r['select_id'] ) ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 3531 3536 3532 3537 <?php foreach ( bbp_get_topic_statuses( $r['topic_id'] ) as $key => $label ) : ?> … … 3725 3730 } 3726 3731 3727 // Add before and after if description exists 3728 if ( ! empty( $term->term_id ) ) { 3729 $retval = $term->term_id; 3730 3731 // No id 3732 } else { 3733 $retval = ''; 3734 } 3732 // Get the term ID 3733 $retval = ! empty( $term->term_id ) 3734 ? $term->term_id 3735 : 0; 3735 3736 3736 3737 return (int) apply_filters( 'bbp_get_topic_tag_id', (int) $retval, $tag, $term ); … … 3769 3770 } 3770 3771 3771 // Add before and after if description exists 3772 if ( ! empty( $term->name ) ) { 3773 $retval = $term->name; 3774 3775 // No name 3776 } else { 3777 $retval = ''; 3778 } 3772 // Get the term name 3773 $retval = ! empty( $term->name ) 3774 ? $term->name 3775 : ''; 3779 3776 3780 3777 return apply_filters( 'bbp_get_topic_tag_name', $retval, $tag, $term ); … … 3813 3810 } 3814 3811 3815 // Add before and after if description exists 3816 if ( ! empty( $term->slug ) ) { 3817 $retval = $term->slug; 3818 3819 // No slug 3820 } else { 3821 $retval = ''; 3822 } 3812 // Get the term slug 3813 $retval = ! empty( $term->slug ) 3814 ? $term->slug 3815 : ''; 3823 3816 3824 3817 return apply_filters( 'bbp_get_topic_tag_slug', $retval, $tag, $term ); … … 3857 3850 } 3858 3851 3859 // Add before and after if description exists 3860 if ( ! empty( $term->term_id ) ) { 3861 $retval = get_term_link( $term, bbp_get_topic_tag_tax_id() ); 3862 3863 // No link 3864 } else { 3865 $retval = ''; 3866 } 3852 // Get the term link 3853 $retval = ! empty( $term->term_id ) 3854 ? get_term_link( $term, bbp_get_topic_tag_tax_id() ) 3855 : ''; 3867 3856 3868 3857 return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag, $term ); … … 3901 3890 } 3902 3891 3903 // Add before and after if description exists3892 // Get the term's edit link 3904 3893 if ( ! empty( $term->term_id ) ) { 3905 3894 3906 // Pretty 3907 if ( bbp_use_pretty_urls() ) { 3908 $retval = user_trailingslashit( trailingslashit( bbp_get_topic_tag_link() ) . bbp_get_edit_rewrite_id() ); 3909 3910 // Ugly 3911 } else { 3912 $retval = add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link() ); 3913 } 3895 // Pretty or ugly URL 3896 $retval = bbp_use_pretty_urls() 3897 ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link() ) . bbp_get_edit_rewrite_id() ) 3898 : add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link() ); 3914 3899 3915 3900 // No link … … 3957 3942 $term = get_term_by( 'slug', $r['tag'], bbp_get_topic_tag_tax_id() ); 3958 3943 } else { 3959 $tag = get_query_var( 'term' ); 3960 $r['tag'] = $tag; 3961 $term = get_queried_object(); 3962 } 3963 3964 // Add before and after if description exists 3965 if ( ! empty( $term->description ) ) { 3966 $retval = $r['before'] . $term->description . $r['after']; 3967 3968 // No description, no HTML 3969 } else { 3970 $retval = ''; 3971 } 3944 $tag = $r['tag'] = get_query_var( 'term' ); 3945 $term = get_queried_object(); 3946 } 3947 3948 // Add before & after if description exists 3949 $retval = ! empty( $term->description ) 3950 ? $r['before'] . $term->description . $r['after'] 3951 : ''; 3972 3952 3973 3953 return apply_filters( 'bbp_get_topic_tag_description', $retval, $r, $args, $tag, $term );
Note: See TracChangeset
for help on using the changeset viewer.