Changeset 4070
- Timestamp:
- 07/08/2012 08:55:34 AM (14 years ago)
- Location:
- branches/plugin/bbp-admin
- Files:
-
- 3 edited
-
bbp-forums.php (modified) (14 diffs)
-
bbp-replies.php (modified) (20 diffs)
-
bbp-topics.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-forums.php
r4053 r4070 39 39 * @uses BBP_Forums_Admin::setup_help() Setup the help text 40 40 */ 41 function __construct() {41 public function __construct() { 42 42 $this->setup_globals(); 43 43 $this->setup_actions(); … … 56 56 * @uses bbp_get_reply_post_type() To get the reply post type 57 57 */ 58 function setup_actions() {58 private function setup_actions() { 59 59 60 60 // Add some general styling to the admin area … … 81 81 82 82 /** 83 * Should we bail out of this method? 84 * 85 * @since bbPress (r4067) 86 * @return boolean 87 */ 88 private function bail() { 89 if ( $this->post_type != get_current_screen()->post_type ) 90 return true; 91 92 return false; 93 } 94 95 /** 83 96 * Admin globals 84 97 * … … 86 99 * @access private 87 100 */ 88 function setup_globals() { 89 90 // Setup the post type for this admin component 101 private function setup_globals() { 91 102 $this->post_type = bbp_get_forum_post_type(); 92 103 } … … 101 112 */ 102 113 public function edit_help() { 114 115 if ( $this->bail() ) return; 103 116 104 117 // Overview … … 164 177 public function new_help() { 165 178 179 if ( $this->bail() ) return; 180 166 181 $customize_display = '<p>' . __( 'The title field and the big forum editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>'; 167 182 … … 234 249 * @uses do_action() Calls 'bbp_forum_attributes_metabox' 235 250 */ 236 function attributes_metabox() { 251 public function attributes_metabox() { 252 253 if ( $this->bail() ) return; 254 237 255 add_meta_box ( 238 256 'bbp_forum_attributes', … … 269 287 * @return int Forum id 270 288 */ 271 function attributes_metabox_save( $forum_id ) { 289 public function attributes_metabox_save( $forum_id ) { 290 291 if ( $this->bail() ) return $forum_id; 272 292 273 293 // Bail if doing an autosave … … 312 332 * @uses do_action() Calls 'bbp_admin_head' 313 333 */ 314 function admin_head() { 334 public function admin_head() { 335 336 if ( $this->bail() ) return; 337 315 338 ?> 316 339 … … 388 411 * @return array $columns bbPress forum columns 389 412 */ 390 function column_headers( $columns ) { 413 public function column_headers( $columns ) { 414 415 if ( $this->bail() ) return $columns; 416 391 417 $columns = array ( 392 418 'cb' => '<input type="checkbox" />', … … 419 445 * column and forum id 420 446 */ 421 function column_data( $column, $forum_id ) { 447 public function column_data( $column, $forum_id ) { 448 449 if ( $this->bail() ) return; 450 422 451 switch ( $column ) { 423 452 case 'bbp_forum_topic_count' : … … 465 494 * @return array $actions Actions 466 495 */ 467 function row_actions( $actions, $forum ) { 496 public function row_actions( $actions, $forum ) { 497 498 if ( $this->bail() ) return $actions; 499 468 500 unset( $actions['inline hide-if-no-js'] ); 469 501 … … 489 521 * @return array 490 522 */ 491 function updated_messages( $messages ) {523 public function updated_messages( $messages ) { 492 524 global $post_ID; 525 526 if ( $this->bail() ) return $messages; 493 527 494 528 // URL for the current forum … … 556 590 */ 557 591 function bbp_admin_forums() { 558 global $typenow;559 560 if ( bbp_get_forum_post_type() != $typenow )561 return;562 563 592 bbpress()->admin->forums = new BBP_Forums_Admin(); 564 593 } -
branches/plugin/bbp-admin/bbp-replies.php
r4054 r4070 39 39 * @uses BBP_Replies_Admin::setup_actions() Setup the help text 40 40 */ 41 function __construct() {41 public function __construct() { 42 42 $this->setup_globals(); 43 43 $this->setup_actions(); … … 56 56 * @uses bbp_get_reply_post_type() To get the reply post type 57 57 */ 58 function setup_actions() {58 private function setup_actions() { 59 59 60 60 // Add some general styling to the admin area … … 93 93 94 94 /** 95 * Should we bail out of this method? 96 * 97 * @since bbPress (r4067) 98 * @return boolean 99 */ 100 private function bail() { 101 if ( $this->post_type != get_current_screen()->post_type ) 102 return true; 103 104 return false; 105 } 106 107 /** 95 108 * Admin globals 96 109 * … … 98 111 * @access private 99 112 */ 100 function setup_globals() { 101 102 // Setup the post type for this admin component 113 private function setup_globals() { 103 114 $this->post_type = bbp_get_reply_post_type(); 104 115 } … … 113 124 */ 114 125 public function edit_help() { 126 127 if ( $this->bail() ) return; 115 128 116 129 // Overview … … 176 189 public function new_help() { 177 190 191 if ( $this->bail() ) return; 192 178 193 $customize_display = '<p>' . __( 'The title field and the big reply editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>'; 179 194 … … 243 258 * @uses do_action() Calls 'bbp_reply_attributes_metabox' 244 259 */ 245 function reply_attributes_metabox() { 260 public function reply_attributes_metabox() { 261 262 if ( $this->bail() ) return; 263 246 264 add_meta_box ( 247 265 'bbp_reply_attributes', … … 268 286 * @return int Parent id 269 287 */ 270 function reply_attributes_metabox_save( $reply_id ) { 288 public function reply_attributes_metabox_save( $reply_id ) { 289 290 if ( $this->bail() ) return $reply_id; 271 291 272 292 // Bail if doing an autosave … … 318 338 * id 319 339 */ 320 function author_metabox() { 340 public function author_metabox() { 341 342 if ( $this->bail() ) return; 321 343 322 344 // Bail if post_type is not a reply … … 353 375 * @return int Topic or reply id 354 376 */ 355 function author_metabox_save( $post_id ) { 377 public function author_metabox_save( $post_id ) { 378 379 if ( $this->bail() ) return $post_id; 356 380 357 381 // Bail if no post_id … … 393 417 * @uses do_action() Calls 'bbp_admin_head' 394 418 */ 395 function admin_head() { 419 public function admin_head() { 420 421 if ( $this->bail() ) return; 422 396 423 ?> 397 424 … … 464 491 * @uses wp_safe_redirect() Redirect the page to custom url 465 492 */ 466 function toggle_reply() { 493 public function toggle_reply() { 494 495 if ( $this->bail() ) return; 467 496 468 497 // Only proceed if GET is a reply toggle action … … 524 553 * message, reply id, notice and is it a failure 525 554 */ 526 function toggle_reply_notice() { 555 public function toggle_reply_notice() { 556 557 if ( $this->bail() ) return; 527 558 528 559 // Only proceed if GET is a reply toggle action … … 576 607 * @return array $columns bbPress reply columns 577 608 */ 578 function replies_column_headers( $columns ) { 609 public function replies_column_headers( $columns ) { 610 611 if ( $this->bail() ) return $columns; 612 579 613 $columns = array( 580 614 'cb' => '<input type="checkbox" />', … … 617 651 * column and reply id 618 652 */ 619 function replies_column_data( $column, $reply_id ) { 653 public function replies_column_data( $column, $reply_id ) { 654 655 if ( $this->bail() ) return; 620 656 621 657 // Get topic ID … … 727 763 * @return array $actions Actions 728 764 */ 729 function replies_row_actions( $actions, $reply ) {730 731 if ( bbp_get_reply_post_type() == $reply->post_type ) {732 unset( $actions['inline hide-if-no-js'] ); 733 734 // Reply view links to topic 735 $actions['view'] = '<a href="' . bbp_get_reply_url( $reply->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'bbpress' ), bbp_get_reply_title( $reply->ID ) ) ) . '" rel="permalink">' . __( 'View', 'bbpress' ) . '</a>';736 737 // User cannot view replies in trash 738 if ( ( bbp_get_trash_status_id() == $reply->post_status ) && !current_user_can( 'view_trash' ) )739 unset( $actions['view'] );740 741 // Only show the actions if the user is capable of viewing them 742 if ( current_user_can( 'moderate', $reply->ID ) ) {743 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() )) ) {744 $spam_uri = esc_url( wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_spam' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'spam-reply_' . $reply->ID ) );745 if ( bbp_is_reply_spam( $reply->ID ) ) {746 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . __( 'Not spam', 'bbpress' ) . '</a>';747 } else {748 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark this reply as spam', 'bbpress' ) . '">' . __( 'Spam', 'bbpress' ) . '</a>';749 }765 public function replies_row_actions( $actions, $reply ) { 766 767 if ( $this->bail() ) return $actions; 768 769 unset( $actions['inline hide-if-no-js'] ); 770 771 // Reply view links to topic 772 $actions['view'] = '<a href="' . bbp_get_reply_url( $reply->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'bbpress' ), bbp_get_reply_title( $reply->ID ) ) ) . '" rel="permalink">' . __( 'View', 'bbpress' ) . '</a>'; 773 774 // User cannot view replies in trash 775 if ( ( bbp_get_trash_status_id() == $reply->post_status ) && !current_user_can( 'view_trash' ) ) 776 unset( $actions['view'] ); 777 778 // Only show the actions if the user is capable of viewing them 779 if ( current_user_can( 'moderate', $reply->ID ) ) { 780 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() ) ) ) { 781 $spam_uri = esc_url( wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_spam' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'spam-reply_' . $reply->ID ) ); 782 if ( bbp_is_reply_spam( $reply->ID ) ) { 783 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . __( 'Not spam', 'bbpress' ) . '</a>'; 784 } else { 785 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark this reply as spam', 'bbpress' ) . '">' . __( 'Spam', 'bbpress' ) . '</a>'; 750 786 } 751 787 } 752 753 // Trash 754 if ( current_user_can( 'delete_reply', $reply->ID ) ) {755 if ( bbp_get_trash_status_id() == $reply->post_status) {756 $post_type_object = get_post_type_object( bbp_get_reply_post_type() );757 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>";758 } elseif ( EMPTY_TRASH_DAYS ) {759 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID ) ) . "'>" . __( 'Trash', 'bbpress' ) . "</a>";760 }761 762 if ( bbp_get_trash_status_id() == $reply->post_status || !EMPTY_TRASH_DAYS ) { 763 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>";764 } elseif ( bbp_get_spam_status_id() == $reply->post_status ) {765 unset( $actions['trash'] );766 }788 } 789 790 // Trash 791 if ( current_user_can( 'delete_reply', $reply->ID ) ) { 792 if ( bbp_get_trash_status_id() == $reply->post_status ) { 793 $post_type_object = get_post_type_object( bbp_get_reply_post_type() ); 794 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>"; 795 } elseif ( EMPTY_TRASH_DAYS ) { 796 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID ) ) . "'>" . __( 'Trash', 'bbpress' ) . "</a>"; 797 } 798 799 if ( bbp_get_trash_status_id() == $reply->post_status || !EMPTY_TRASH_DAYS ) { 800 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>"; 801 } elseif ( bbp_get_spam_status_id() == $reply->post_status ) { 802 unset( $actions['trash'] ); 767 803 } 768 804 } … … 781 817 * @return bool False. If post type is not topic or reply 782 818 */ 783 function filter_dropdown() { 819 public function filter_dropdown() { 820 821 if ( $this->bail() ) return; 784 822 785 823 // Add Empty Spam button … … 811 849 * @return array Processed Query Vars 812 850 */ 813 function filter_post_rows( $query_vars ) { 814 global $pagenow; 851 public function filter_post_rows( $query_vars ) { 852 853 if ( $this->bail() ) return $query_vars; 815 854 816 855 // Add post_parent query_var if one is present … … 839 878 * @return array 840 879 */ 841 function updated_messages( $messages ) {880 public function updated_messages( $messages ) { 842 881 global $post_ID; 882 883 if ( $this->bail() ) return $messages; 843 884 844 885 // URL for the current topic … … 906 947 */ 907 948 function bbp_admin_replies() { 908 global $typenow;909 910 if ( bbp_get_reply_post_type() != $typenow )911 return;912 913 949 bbpress()->admin->replies = new BBP_Replies_Admin(); 914 950 } -
branches/plugin/bbp-admin/bbp-topics.php
r4053 r4070 39 39 * @uses BBP_Topics_Admin::setup_help() Setup the help text 40 40 */ 41 function __construct() {41 public function __construct() { 42 42 $this->setup_globals(); 43 43 $this->setup_actions(); … … 56 56 * @uses bbp_get_reply_post_type() To get the reply post type 57 57 */ 58 function setup_actions() {58 private function setup_actions() { 59 59 60 60 // Add some general styling to the admin area … … 93 93 94 94 /** 95 * Should we bail out of this method? 96 * 97 * @since bbPress (r4067) 98 * @return boolean 99 */ 100 private function bail() { 101 if ( $this->post_type != get_current_screen()->post_type ) 102 return true; 103 104 return false; 105 } 106 107 /** 95 108 * Admin globals 96 109 * … … 98 111 * @access private 99 112 */ 100 function setup_globals() { 101 102 // Setup the post type for this admin component 113 private function setup_globals() { 103 114 $this->post_type = bbp_get_topic_post_type(); 104 115 } … … 113 124 */ 114 125 public function edit_help() { 126 127 if ( $this->bail() ) return; 115 128 116 129 // Overview … … 176 189 public function new_help() { 177 190 191 if ( $this->bail() ) return; 192 178 193 $customize_display = '<p>' . __( 'The title field and the big topic editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>'; 179 194 … … 243 258 * @uses do_action() Calls 'bbp_topic_attributes_metabox' 244 259 */ 245 function attributes_metabox() { 260 public function attributes_metabox() { 261 262 if ( $this->bail() ) return; 263 246 264 add_meta_box ( 247 265 'bbp_topic_attributes', … … 268 286 * @return int Parent id 269 287 */ 270 function attributes_metabox_save( $topic_id ) {288 public function attributes_metabox_save( $topic_id ) { 271 289 290 if ( $this->bail() ) return $topic_id; 291 272 292 // Bail if doing an autosave 273 293 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) … … 335 355 * id 336 356 */ 337 function author_metabox() { 357 public function author_metabox() { 358 359 if ( $this->bail() ) return; 338 360 339 361 // Bail if post_type is not a topic … … 370 392 * @return int Topic or reply id 371 393 */ 372 function author_metabox_save( $post_id ) { 394 public function author_metabox_save( $post_id ) { 395 396 if ( $this->bail() ) return $post_id; 373 397 374 398 // Bail if no post_id … … 410 434 * @uses do_action() Calls 'bbp_admin_head' 411 435 */ 412 function admin_head() { 436 public function admin_head() { 437 438 if ( $this->bail() ) return; 439 413 440 ?> 414 441 … … 489 516 * @uses wp_safe_redirect() Redirect the page to custom url 490 517 */ 491 function toggle_topic() { 518 public function toggle_topic() { 519 520 if ( $this->bail() ) return; 492 521 493 522 // Only proceed if GET is a topic toggle action … … 568 597 * message, topic id, notice and is it a failure 569 598 */ 570 function toggle_topic_notice() { 599 public function toggle_topic_notice() { 600 601 if ( $this->bail() ) return; 571 602 572 603 // Only proceed if GET is a topic toggle action … … 640 671 * @return array $columns bbPress topic columns 641 672 */ 642 function topics_column_headers( $columns ) { 673 public function topics_column_headers( $columns ) { 674 675 if ( $this->bail() ) return $columns; 676 643 677 $columns = array( 644 678 'cb' => '<input type="checkbox" />', … … 682 716 function topics_column_data( $column, $topic_id ) { 683 717 718 if ( $this->bail() ) return; 719 684 720 // Get topic forum ID 685 721 $forum_id = bbp_get_topic_forum_id( $topic_id ); … … 778 814 * @return array $actions Actions 779 815 */ 780 function topics_row_actions( $actions, $topic ) { 816 public function topics_row_actions( $actions, $topic ) { 817 818 if ( $this->bail() ) return $actions; 781 819 782 820 unset( $actions['inline hide-if-no-js'] ); … … 850 888 * @return bool False. If post type is not topic or reply 851 889 */ 852 function filter_dropdown() { 890 public function filter_dropdown() { 891 892 if ( $this->bail() ) return; 853 893 854 894 // Add Empty Spam button … … 882 922 function filter_post_rows( $query_vars ) { 883 923 924 if ( $this->bail() ) return $query_vars; 925 884 926 // Add post_parent query_var if one is present 885 927 if ( !empty( $_GET['bbp_forum_id'] ) ) { … … 907 949 * @return array 908 950 */ 909 function updated_messages( $messages ) {951 public function updated_messages( $messages ) { 910 952 global $post_ID; 953 954 if ( $this->bail() ) return $messages; 911 955 912 956 // URL for the current topic … … 974 1018 */ 975 1019 function bbp_admin_topics() { 976 global $typenow;977 978 if ( bbp_get_topic_post_type() != $typenow )979 return;980 981 1020 bbpress()->admin->topics = new BBP_Topics_Admin(); 982 1021 }
Note: See TracChangeset
for help on using the changeset viewer.