Changeset 13817 for branches/12.0/src/bp-activity/bp-activity-admin.php
- Timestamp:
- 04/27/2024 06:05:30 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/12.0/src/bp-activity/bp-activity-admin.php
r13497 r13817 15 15 16 16 // Include WP's list table class. 17 if ( ! class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );17 if ( ! class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); 18 18 19 19 // Per_page screen option. Has to be hooked in extremely early. 20 if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] ) 20 if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] ) { 21 21 add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 ); 22 } 22 23 23 24 /** … … 77 78 78 79 // $parent_id is required. 79 if ( empty( $parent_id ) ) 80 if ( empty( $parent_id ) ) { 80 81 die( '-1' ); 82 } 81 83 82 84 // If $root_id not set (e.g. for root items), use $parent_id. 83 if ( empty( $root_id ) ) 85 if ( empty( $root_id ) ) { 84 86 $root_id = $parent_id; 87 } 85 88 86 89 // Check that a reply has been entered. 87 if ( empty( $_REQUEST['content'] ) ) 88 die( __( 'Error: Please type a reply.', 'buddypress' ) ); 90 if ( empty( $_REQUEST['content'] ) ) { 91 die( esc_html__( 'Error: Please type a reply.', 'buddypress' ) ); 92 } 89 93 90 94 // Check parent activity exists. 91 95 $parent_activity = new BP_Activity_Activity( $parent_id ); 92 if ( empty( $parent_activity->component ) ) 93 die( __( 'Error: The item you are trying to reply to cannot be found, or it has been deleted.', 'buddypress' ) ); 96 if ( empty( $parent_activity->component ) ) { 97 die( esc_html__( 'Error: The item you are trying to reply to cannot be found, or it has been deleted.', 'buddypress' ) ); 98 } 94 99 95 100 // @todo: Check if user is allowed to create new activity items 96 101 // if ( ! current_user_can( 'bp_new_activity' ) ) 97 if ( ! bp_current_user_can( 'bp_moderate' ) ) 102 if ( ! bp_current_user_can( 'bp_moderate' ) ) { 98 103 die( '-1' ); 104 } 99 105 100 106 // Add new activity comment. … … 589 595 590 596 // If an error occurred, pass back the activity ID that failed. 591 if ( $error ) 597 if ( $error ) { 592 598 $redirect_to = add_query_arg( 'error', $error, $redirect_to ); 593 else599 } else { 594 600 $redirect_to = add_query_arg( 'updated', $activity->id, $redirect_to ); 601 } 595 602 596 603 /** … … 689 696 printf( 690 697 /* translators: 1: activity type. 2: activity author. 3: activity date and time. */ 691 __( '"%1$s" activity submitted by %2$s on %3$s', 'buddypress' ),698 esc_html__( '"%1$s" activity submitted by %2$s on %3$s', 'buddypress' ), 692 699 esc_html( $activity_type ), 700 // phpcs:ignore WordPress.Security.EscapeOutput 693 701 bp_core_get_userlink( $activity->user_id ), 694 702 sprintf( 695 703 '<a href="%1$s">%2$s</a>', 696 704 esc_url( bp_activity_get_permalink( $activity->id, $activity ) ), 697 date_i18n( bp_get_option( 'date_format' ), strtotime( $activity->date_recorded) )705 esc_html( date_i18n( bp_get_option( 'date_format' ), strtotime( $activity->date_recorded ) ) ) 698 706 ) 699 707 ); … … 761 769 <?php 762 770 /* translators: %s: the activity ID */ 763 printf( __( 'Editing Activity (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid']) );771 printf( esc_html__( 'Editing Activity (ID #%s)', 'buddypress' ), esc_html( number_format_i18n( (int) $_REQUEST['aid'] ) ) ); 764 772 ?> 765 773 </h1> … … 776 784 <div id="postdiv"> 777 785 <div id="bp_activity_action" class="activitybox"> 778 <h2><?php _e( 'Action', 'buddypress' ); ?></h2>786 <h2><?php esc_html_e( 'Action', 'buddypress' ); ?></h2> 779 787 <div class="inside"> 780 <label for="bp-activities-action" class="screen-reader-text"><?php 781 /* translators: accessibility text */ 782 _e( 'Edit activity action', 'buddypress' ); 783 ?></label> 788 <label for="bp-activities-action" class="screen-reader-text"> 789 <?php 790 /* translators: accessibility text */ 791 esc_html_e( 'Edit activity action', 'buddypress' ); 792 ?> 793 </label> 784 794 <?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?> 785 795 </div> … … 787 797 788 798 <div id="bp_activity_content" class="activitybox"> 789 <h2><?php _e( 'Content', 'buddypress' ); ?></h2>799 <h2><?php esc_html_e( 'Content', 'buddypress' ); ?></h2> 790 800 <div class="inside"> 791 <label for="bp-activities-content" class="screen-reader-text"><?php 792 /* translators: accessibility text */ 793 _e( 'Edit activity content', 'buddypress' ); 794 ?></label> 801 <label for="bp-activities-content" class="screen-reader-text"> 802 <?php 803 /* translators: accessibility text */ 804 esc_html_e( 'Edit activity content', 'buddypress' ); 805 ?> 806 </label> 795 807 <?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?> 796 808 </div> … … 820 832 printf( 821 833 '%1$s <a href="%2$s">%3$s</a>', 822 __( 'No activity found with this ID.', 'buddypress' ),834 esc_html__( 'No activity found with this ID.', 'buddypress' ), 823 835 esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ), 824 __( 'Go back and try again.', 'buddypress' )836 esc_html__( 'Go back and try again.', 'buddypress' ) 825 837 ); 826 838 ?></p> … … 852 864 <div id="minor-publishing-actions"> 853 865 <div id="preview-action"> 854 <a class="button preview" href="<?php echo esc_ attr( bp_activity_get_permalink( $item->id, $item ) ); ?>" target="_blank"><?php_e( 'View Activity', 'buddypress' ); ?></a>866 <a class="button preview" href="<?php echo esc_url( bp_activity_get_permalink( $item->id, $item ) ); ?>" target="_blank"><?php esc_html_e( 'View Activity', 'buddypress' ); ?></a> 855 867 </div> 856 868 … … 860 872 <div id="misc-publishing-actions"> 861 873 <div class="misc-pub-section" id="comment-status-radio"> 862 <label class="approved" for="activity-status-approved"><input type="radio" name="activity_status" id="activity-status-approved" value="ham" <?php checked( $item->is_spam, 0 ); ?>><?php _e( 'Approved', 'buddypress' ); ?></label><br />863 <label class="spam" for="activity-status-spam"><input type="radio" name="activity_status" id="activity-status-spam" value="spam" <?php checked( $item->is_spam, 1 ); ?>><?php _e( 'Spam', 'buddypress' ); ?></label>874 <label class="approved" for="activity-status-approved"><input type="radio" name="activity_status" id="activity-status-approved" value="ham" <?php checked( $item->is_spam, 0 ); ?>><?php esc_html_e( 'Approved', 'buddypress' ); ?></label><br /> 875 <label class="spam" for="activity-status-spam"><input type="radio" name="activity_status" id="activity-status-spam" value="spam" <?php checked( $item->is_spam, 1 ); ?>><?php esc_html_e( 'Spam', 'buddypress' ); ?></label> 864 876 </div> 865 877 … … 873 885 <?php 874 886 /* translators: %s: the date the activity was submitted on */ 875 printf( __( 'Submitted on: %s', 'buddypress' ), '<strong>' . $date. '</strong>' );887 printf( esc_html__( 'Submitted on: %s', 'buddypress' ), '<strong>' . esc_html( $date ) . '</strong>' ); 876 888 ?> 877 </span> <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e( 'Edit', 'buddypress' ); ?></a>889 </span> <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php esc_html_e( 'Edit', 'buddypress' ); ?></a> 878 890 879 891 <div id='timestampdiv' class='hide-if-js'> … … 912 924 ?> 913 925 914 <label class="screen-reader-text" for="bp-activities-link"><?php 915 /* translators: accessibility text */ 916 _e( 'Link', 'buddypress' ); 917 ?></label> 926 <label class="screen-reader-text" for="bp-activities-link"> 927 <?php 928 /* translators: accessibility text */ 929 esc_html_e( 'Link', 'buddypress' ); 930 ?> 931 </label> 918 932 <input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" /> 919 <p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>933 <p id="bp-activities-link-description"><?php esc_html_e( 'Activity generated by posts and comments uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p> 920 934 921 935 <?php … … 932 946 ?> 933 947 934 <label class="screen-reader-text" for="bp-activities-userid"><?php 935 /* translators: accessibility text */ 936 _e( 'Author ID', 'buddypress' ); 937 ?></label> 948 <label class="screen-reader-text" for="bp-activities-userid"> 949 <?php 950 /* translators: accessibility text */ 951 esc_html_e( 'Author ID', 'buddypress' ); 952 ?> 953 </label> 938 954 <input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" /> 939 955 … … 1020 1036 sprintf( 1021 1037 /* translators: %s: the name of the activity type */ 1022 __( 'This activity item has a type (%s) that is not registered using bp_activity_set_action(), so no label is available.', 'buddypress' ),1023 $selected1038 esc_html__( 'This activity item has a type (%s) that is not registered using bp_activity_set_action(), so no label is available.', 'buddypress' ), 1039 esc_html( $selected ) 1024 1040 ), 1025 1041 '2.0.0' … … 1031 1047 ?> 1032 1048 1033 <label for="bp-activities-type" class="screen-reader-text"><?php 1034 /* translators: accessibility text */ 1035 esc_html_e( 'Select activity type', 'buddypress' ); 1036 ?></label> 1049 <label for="bp-activities-type" class="screen-reader-text"> 1050 <?php 1051 /* translators: accessibility text */ 1052 esc_html_e( 'Select activity type', 'buddypress' ); 1053 ?> 1054 </label> 1037 1055 <select name="bp-activities-type" id="bp-activities-type"> 1038 1056 <?php foreach ( $actions as $k => $v ) : ?> … … 1054 1072 ?> 1055 1073 1056 <label for="bp-activities-primaryid"><?php _e( 'Primary Item ID', 'buddypress' ); ?></label>1074 <label for="bp-activities-primaryid"><?php esc_html_e( 'Primary Item ID', 'buddypress' ); ?></label> 1057 1075 <input type="number" name="bp-activities-primaryid" id="bp-activities-primaryid" value="<?php echo esc_attr( $item->item_id ); ?>" min="0" /> 1058 1076 <br /> 1059 1077 1060 <label for="bp-activities-secondaryid"><?php _e( 'Secondary Item ID', 'buddypress' ); ?></label>1078 <label for="bp-activities-secondaryid"><?php esc_html_e( 'Secondary Item ID', 'buddypress' ); ?></label> 1061 1079 <input type="number" name="bp-activities-secondaryid" id="bp-activities-secondaryid" value="<?php echo esc_attr( $item->secondary_item_id ); ?>" min="0" /> 1062 1080 1063 <p><?php _e( 'These identify the object that created this activity. For example, the fields could reference a pair of site and comment IDs.', 'buddypress' ); ?></p>1081 <p><?php esc_html_e( 'These identify the object that created this activity. For example, the fields could reference a pair of site and comment IDs.', 'buddypress' ); ?></p> 1064 1082 1065 1083 <?php … … 1156 1174 <?php 1157 1175 /* translators: %s: the activity ID */ 1158 printf( __( 'Activity related to ID #%s', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid']) );1176 printf( esc_html__( 'Activity related to ID #%s', 'buddypress' ), esc_html( number_format_i18n( (int) $_REQUEST['aid'] ) ) ); 1159 1177 ?> 1160 1178 <?php else : ?> 1161 <?php _ex( 'Activity', 'Admin SWA page', 'buddypress' ); ?>1179 <?php echo esc_html_x( 'Activity', 'Admin SWA page', 'buddypress' ); ?> 1162 1180 <?php endif; ?> 1163 1181 … … 1166 1184 <?php 1167 1185 /* translators: %s: the activity search terms */ 1168 printf( __( 'Search results for “%s”', 'buddypress' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) );1186 printf( esc_html__( 'Search results for “%s”', 'buddypress' ), esc_html( wp_html_excerpt( stripslashes( $_REQUEST['s'] ) ), 50 ) ); 1169 1187 ?> 1170 1188 </span> … … 1176 1194 <?php // If the user has just made a change to an activity item, display the status messages. ?> 1177 1195 <?php if ( !empty( $messages ) ) : ?> 1178 <div id="moderated" class="<?php echo ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated'; ?> notice is-dismissible"><p><?php echo implode( "<br/>\n", $messages); ?></p></div>1196 <div id="moderated" class="<?php echo ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated'; ?> notice is-dismissible"><p><?php echo implode( "<br/>\n", array_map( 'esc_html', $messages ) ); ?></p></div> 1179 1197 <?php endif; ?> 1180 1198 … … 1183 1201 1184 1202 <form id="bp-activities-form" action="" method="get"> 1185 <?php $bp_activity_list_table->search_box( __( 'Search all Activity', 'buddypress' ), 'bp-activity' ); ?>1203 <?php $bp_activity_list_table->search_box( esc_html__( 'Search all Activity', 'buddypress' ), 'bp-activity' ); ?> 1186 1204 <input type="hidden" name="page" value="<?php echo esc_attr( $plugin_page ); ?>" /> 1187 1205 <?php $bp_activity_list_table->display(); ?> … … 1194 1212 <form method="get" action=""> 1195 1213 1196 <h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3> 1197 <label for="bp-activities" class="screen-reader-text"><?php 1198 /* translators: accessibility text */ 1199 _e( 'Reply', 'buddypress' ); 1200 ?></label> 1214 <h3 id="bp-replyhead"><?php esc_html_e( 'Reply to Activity', 'buddypress' ); ?></h3> 1215 <label for="bp-activities" class="screen-reader-text"> 1216 <?php 1217 /* translators: accessibility text */ 1218 esc_html_e( 'Reply', 'buddypress' ); 1219 ?> 1220 </label> 1201 1221 <?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?> 1202 1222 1203 1223 <p id="bp-replysubmit" class="submit"> 1204 <a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'buddypress' ); ?></a>1205 <a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'buddypress' ); ?></a>1224 <a href="#" class="cancel button-secondary alignleft"><?php esc_html_e( 'Cancel', 'buddypress' ); ?></a> 1225 <a href="#" class="save button-primary alignright"><?php esc_html_e( 'Reply', 'buddypress' ); ?></a> 1206 1226 1207 1227 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
Note: See TracChangeset
for help on using the changeset viewer.