Skip to:
Content

bbPress.org

Changeset 6424


Ignore:
Timestamp:
05/26/2017 08:46:41 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Admin: in list-tables, if no parent forum/topic, show — instead.

Also make sure a few strings are escaped, and dropdowns are using correct parent text.

Location:
trunk/src/includes/admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/metaboxes.php

    r6334 r6424  
    357357                        'select_id'          => 'parent_id',
    358358                        'options_only'       => false,
    359                         'show_none'          => __( '— No forum —', 'bbpress' ),
     359                        'show_none'          => esc_html__( '— No parent —', 'bbpress' ),
    360360                        'disable_categories' => false,
    361361                        'disabled'           => ''
     
    436436                        'select_id'          => 'parent_id',
    437437                        'options_only'       => false,
    438                         'show_none'          => __( '— No parent —', 'bbpress' ),
     438                        'show_none'          => esc_html__( '— No forum —', 'bbpress' ),
    439439                        'disable_categories' => current_user_can( 'edit_forums' ),
    440440                        'disabled'           => ''
     
    503503                                'select_id'          => 'bbp_forum_id',
    504504                                'options_only'       => false,
    505                                 'show_none'          => __( '— No reply —', 'bbpress' ),
     505                                'show_none'          => esc_html__( '— No reply —', 'bbpress' ),
    506506                                'disable_categories' => current_user_can( 'edit_forums' ),
    507507                                'disabled'           => ''
  • trunk/src/includes/admin/replies.php

    r6400 r6424  
    725725                        case 'bbp_reply_topic' :
    726726
    727                                 // Output forum name
    728                                 if ( ! empty( $topic_id ) ) {
    729 
    730                                         // Topic Title
    731                                         $topic_title = bbp_get_topic_title( $topic_id );
    732                                         if ( empty( $topic_title ) ) {
    733                                                 $topic_title = esc_html__( 'No Topic', 'bbpress' );
    734                                         }
    735 
    736                                         // Output the title
     727                                // Get title
     728                                $topic_title = ! empty( $topic_id )
     729                                        ? bbp_get_topic_title( $topic_id )
     730                                        : '';
     731
     732                                // Output topic name
     733                                if ( ! empty( $topic_title ) ) {
    737734                                        echo $topic_title;
    738735
    739                                 // Reply has no topic
     736                                // Output dash
    740737                                } else {
    741                                         esc_html_e( 'No Topic', 'bbpress' );
     738                                        ?>
     739                                        <span aria-hidden="true">&mdash;</span>
     740                                        <span class="screen-reader-text"><?php esc_html_e( 'No topic', 'bbpress' ); ?></span>
     741                                        <?php
    742742                                }
    743743
     
    751751                                $topic_forum_id = bbp_get_topic_forum_id( $topic_id );
    752752
     753                                // Forum Title
     754                                $forum_title = ! empty( $reply_forum_id )
     755                                        ? bbp_get_forum_title( $reply_forum_id )
     756                                        : '';
     757
     758                                // Alert capable users of reply forum mismatch
     759                                if ( $reply_forum_id !== $topic_forum_id ) {
     760                                        if ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate', $reply_id ) ) {
     761                                                $forum_title .= '<div class="attention">' . esc_html__( '(Mismatch)', 'bbpress' ) . '</div>';
     762                                        }
     763                                }
     764
    753765                                // Output forum name
    754                                 if ( ! empty( $reply_forum_id ) ) {
    755 
    756                                         // Forum Title
    757                                         $forum_title = bbp_get_forum_title( $reply_forum_id );
    758                                         if ( empty( $forum_title ) ) {
    759                                                 $forum_title = esc_html__( 'No Forum', 'bbpress' );
    760                                         }
    761 
    762                                         // Alert capable users of reply forum mismatch
    763                                         if ( $reply_forum_id !== $topic_forum_id ) {
    764                                                 if ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate', $reply_id ) ) {
    765                                                         $forum_title .= '<div class="attention">' . esc_html__( '(Mismatch)', 'bbpress' ) . '</div>';
    766                                                 }
    767                                         }
    768 
    769                                         // Output the title
     766                                if ( ! empty( $forum_title ) ) {
    770767                                        echo $forum_title;
    771768
    772769                                // Reply has no forum
    773770                                } else {
    774                                         _e( 'No Forum', 'bbpress' );
     771                                        ?>
     772                                        <span aria-hidden="true">&mdash;</span>
     773                                        <span class="screen-reader-text"><?php esc_html_e( 'No forum', 'bbpress' ); ?></span>
     774                                        <?php
    775775                                }
    776776
     
    779779                        // Author
    780780                        case 'bbp_reply_author' :
    781                                 bbp_reply_author_display_name ( $reply_id );
     781                                bbp_reply_author_display_name( $reply_id );
    782782                                break;
    783783
     
    868868                // Trash
    869869                if ( current_user_can( 'delete_reply', $reply->ID ) ) {
     870                        $trash_days = bbp_get_trash_days( bbp_get_reply_post_type() );
     871
    870872                        if ( bbp_get_trash_status_id() === $reply->post_status ) {
    871873                                $post_type_object   = get_post_type_object( bbp_get_reply_post_type() );
    872874                                $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . "' href='" . esc_url( wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $reply->ID ) ), 'untrash-post_' . $reply->ID ) ) . "'>" . esc_html__( 'Restore', 'bbpress' ) . "</a>";
    873                         } elseif ( EMPTY_TRASH_DAYS ) {
     875                        } elseif ( ! empty( $trash_days ) ) {
    874876                                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . "' href='" . esc_url( get_delete_post_link( $reply->ID ) ) . "'>" . esc_html__( 'Trash', 'bbpress' ) . "</a>";
    875877                        }
    876878
    877                         if ( bbp_get_trash_status_id() === $reply->post_status || ! EMPTY_TRASH_DAYS ) {
     879                        if ( ( bbp_get_trash_status_id() === $reply->post_status ) || empty( $trash_days ) ) {
    878880                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . esc_url( get_delete_post_link( $reply->ID, '', true ) ) . "'>" . esc_html__( 'Delete Permanently', 'bbpress' ) . "</a>";
    879881                        } elseif ( bbp_get_spam_status_id() === $reply->post_status ) {
     
    916918                bbp_dropdown( array(
    917919                        'selected'  => $selected,
    918                         'show_none' => __( 'In all forums', 'bbpress' )
     920                        'show_none' => esc_html__( 'In all forums', 'bbpress' )
    919921                ) );
    920922        }
  • trunk/src/includes/admin/topics.php

    r6400 r6424  
    929929                        case 'bbp_topic_forum' :
    930930
     931                                // Get title
     932                                $forum_title = ! empty( $forum_id )
     933                                        ? bbp_get_forum_title( $forum_id )
     934                                        : '';
     935
    931936                                // Output forum name
    932                                 if ( ! empty( $forum_id ) ) {
    933 
    934                                         // Forum Title
    935                                         $forum_title = bbp_get_forum_title( $forum_id );
    936                                         if ( empty( $forum_title ) ) {
    937                                                 $forum_title = esc_html__( 'No Forum', 'bbpress' );
    938                                         }
    939 
    940                                         // Output the title
     937                                if ( ! empty( $forum_title ) ) {
    941938                                        echo $forum_title;
    942939
     940                                // Output dash
    943941                                } else {
    944                                         esc_html_e( '&mdash; No forum &mdash;', 'bbpress' );
     942                                        ?>
     943                                        <span aria-hidden="true">&mdash;</span>
     944                                        <span class="screen-reader-text"><?php esc_html_e( 'No forum', 'bbpress' ); ?></span>
     945                                        <?php
    945946                                }
    946947
     
    10801081                // Do not show trash links for spam topics, or spam links for trashed topics
    10811082                if ( current_user_can( 'delete_topic', $topic->ID ) ) {
     1083                        $trash_days = bbp_get_trash_days( bbp_get_topic_post_type() );
     1084
    10821085                        if ( bbp_get_trash_status_id() === $topic->post_status ) {
    10831086                                $post_type_object   = get_post_type_object( bbp_get_topic_post_type() );
    10841087                                $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . "' href='" . esc_url( wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $topic->ID ) ), 'untrash-post_' . $topic->ID ) ) . "'>" . esc_html__( 'Restore', 'bbpress' ) . "</a>";
    1085                         } elseif ( EMPTY_TRASH_DAYS ) {
     1088                        } elseif ( ! empty( $trash_days ) ) {
    10861089                                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . "' href='" . esc_url( get_delete_post_link( $topic->ID ) ) . "'>" . esc_html__( 'Trash', 'bbpress' ) . "</a>";
    10871090                        }
    10881091
    1089                         if ( bbp_get_trash_status_id() === $topic->post_status || !EMPTY_TRASH_DAYS ) {
     1092                        if ( ( bbp_get_trash_status_id() === $topic->post_status ) || empty( $trash_days ) ) {
    10901093                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . esc_url( get_delete_post_link( $topic->ID, '', true ) ) . "'>" . esc_html__( 'Delete Permanently', 'bbpress' ) . "</a>";
    10911094                        } elseif ( bbp_get_spam_status_id() === $topic->post_status ) {
     
    11281131                bbp_dropdown( array(
    11291132                        'selected'  => $selected,
    1130                         'show_none' => __( 'In all forums', 'bbpress' )
     1133                        'show_none' => esc_html__( 'In all forums', 'bbpress' )
    11311134                ) );
    11321135        }
Note: See TracChangeset for help on using the changeset viewer.