Changeset 4053 for branches/plugin/bbp-admin/bbp-replies.php
- Timestamp:
- 07/04/2012 02:17:31 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-replies.php
r4034 r4053 26 26 * @var The post type of this admin component 27 27 */ 28 var$post_type = '';28 private $post_type = ''; 29 29 30 30 /** Functions *************************************************************/ … … 76 76 77 77 // Check if there are any bbp_toggle_reply_* requests on admin_init, also have a message displayed 78 add_action( ' bbp_admin_init',array( $this, 'toggle_reply' ) );78 add_action( 'load-edit.php', array( $this, 'toggle_reply' ) ); 79 79 add_action( 'admin_notices', array( $this, 'toggle_reply_notice' ) ); 80 80 … … 114 114 public function edit_help() { 115 115 116 $current_screen = get_current_screen();117 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';118 119 // Bail if current screen could not be found120 if ( empty( $current_screen ) )121 return;122 123 // Bail if not the reply post type124 if ( $post_type != $this->post_type )125 return;126 127 116 // Overview 128 $current_screen->add_help_tab( array(117 get_current_screen()->add_help_tab( array( 129 118 'id' => 'overview', 130 119 'title' => __( 'Overview', 'bbpress' ), … … 134 123 135 124 // Screen Content 136 $current_screen->add_help_tab( array(125 get_current_screen()->add_help_tab( array( 137 126 'id' => 'screen-content', 138 127 'title' => __( 'Screen Content', 'bbpress' ), … … 148 137 149 138 // Available Actions 150 $current_screen->add_help_tab( array(139 get_current_screen()->add_help_tab( array( 151 140 'id' => 'action-links', 152 141 'title' => __( 'Available Actions', 'bbpress' ), … … 163 152 164 153 // Bulk Actions 165 $current_screen->add_help_tab( array(154 get_current_screen()->add_help_tab( array( 166 155 'id' => 'bulk-actions', 167 156 'title' => __( 'Bulk Actions', 'bbpress' ), … … 172 161 173 162 // Help Sidebar 174 $current_screen->set_help_sidebar(163 get_current_screen()->set_help_sidebar( 175 164 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 176 165 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 187 176 public function new_help() { 188 177 189 $current_screen = get_current_screen();190 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';191 192 // Bail if current screen could not be found193 if ( empty( $current_screen ) )194 return;195 196 // Bail if not the reply post type197 if ( $post_type != $this->post_type )198 return;199 200 178 $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>'; 201 179 202 $current_screen->add_help_tab( array(180 get_current_screen()->add_help_tab( array( 203 181 'id' => 'customize-display', 204 182 'title' => __( 'Customizing This Display', 'bbpress' ), … … 206 184 ) ); 207 185 208 $current_screen->add_help_tab( array(186 get_current_screen()->add_help_tab( array( 209 187 'id' => 'title-reply-editor', 210 188 'title' => __( 'Title and Reply Editor', 'bbpress' ), … … 224 202 } 225 203 226 $current_screen->add_help_tab( array(204 get_current_screen()->add_help_tab( array( 227 205 'id' => 'reply-attributes', 228 206 'title' => __( 'Reply Attributes', 'bbpress' ), … … 235 213 ) ); 236 214 237 $current_screen->add_help_tab( array(215 get_current_screen()->add_help_tab( array( 238 216 'id' => 'publish-box', 239 217 'title' => __( 'Publish Box', 'bbpress' ), … … 241 219 ) ); 242 220 243 $current_screen->add_help_tab( array(221 get_current_screen()->add_help_tab( array( 244 222 'id' => 'discussion-settings', 245 223 'title' => __( 'Discussion Settings', 'bbpress' ), … … 249 227 ) ); 250 228 251 $current_screen->set_help_sidebar(229 get_current_screen()->set_help_sidebar( 252 230 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 253 231 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 308 286 return $reply_id; 309 287 310 // Bail if post_type is not a reply311 if ( get_post_type( $reply_id ) != $this->post_type )312 return $reply_id;313 314 288 // Current user cannot edit this reply 315 289 if ( !current_user_can( 'edit_reply', $reply_id ) ) … … 347 321 348 322 // Bail if post_type is not a reply 349 if ( ( empty( $_GET['action'] ) || ( 'edit' != $_GET['action'] ) ) || ( get_post_type() != $this->post_type) )323 if ( empty( $_GET['action'] ) || ( 'edit' != $_GET['action'] ) ) 350 324 return; 351 325 … … 393 367 return $post_id; 394 368 395 // Bail if post_type is not a topic or reply396 if ( get_post_type( $post_id ) != $this->post_type )397 return;398 399 369 // Bail if user cannot edit replies or reply is not anonymous 400 370 if ( !current_user_can( 'edit_reply', $post_id ) ) … … 424 394 */ 425 395 function admin_head() { 426 427 if ( get_post_type() == $this->post_type ) : ?> 428 429 <style type="text/css" media="screen"> 430 /*<![CDATA[*/ 431 432 .column-bbp_forum_topic_count, 433 .column-bbp_forum_reply_count, 434 .column-bbp_topic_reply_count, 435 .column-bbp_topic_voice_count { 436 width: 8% !important; 437 } 438 439 .column-author, 440 .column-bbp_reply_author, 441 .column-bbp_topic_author { 442 width: 10% !important; 443 } 444 445 .column-bbp_topic_forum, 446 .column-bbp_reply_forum, 447 .column-bbp_reply_topic { 448 width: 10% !important; 449 } 450 451 .column-bbp_forum_freshness, 452 .column-bbp_topic_freshness { 453 width: 10% !important; 454 } 455 456 .column-bbp_forum_created, 457 .column-bbp_topic_created, 458 .column-bbp_reply_created { 459 width: 15% !important; 460 } 461 462 .status-closed { 463 background-color: #eaeaea; 464 } 465 466 .status-spam { 467 background-color: #faeaea; 468 } 469 470 /*]]>*/ 471 </style> 472 473 <?php endif; 474 396 ?> 397 398 <style type="text/css" media="screen"> 399 /*<![CDATA[*/ 400 401 .column-bbp_forum_topic_count, 402 .column-bbp_forum_reply_count, 403 .column-bbp_topic_reply_count, 404 .column-bbp_topic_voice_count { 405 width: 8% !important; 406 } 407 408 .column-author, 409 .column-bbp_reply_author, 410 .column-bbp_topic_author { 411 width: 10% !important; 412 } 413 414 .column-bbp_topic_forum, 415 .column-bbp_reply_forum, 416 .column-bbp_reply_topic { 417 width: 10% !important; 418 } 419 420 .column-bbp_forum_freshness, 421 .column-bbp_topic_freshness { 422 width: 10% !important; 423 } 424 425 .column-bbp_forum_created, 426 .column-bbp_topic_created, 427 .column-bbp_reply_created { 428 width: 15% !important; 429 } 430 431 .status-closed { 432 background-color: #eaeaea; 433 } 434 435 .status-spam { 436 background-color: #faeaea; 437 } 438 439 /*]]>*/ 440 </style> 441 442 <?php 475 443 } 476 444 … … 815 783 function filter_dropdown() { 816 784 817 // Bail if not viewing the topics list818 if (819 // post_type exists in _GET820 empty( $_GET['post_type'] ) ||821 822 // post_type is reply or topic type823 ( $_GET['post_type'] != $this->post_type )824 )825 return;826 827 785 // Add Empty Spam button 828 786 if ( !empty( $_GET['post_status'] ) && ( bbp_get_spam_status_id() == $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { … … 856 814 global $pagenow; 857 815 858 // Avoid poisoning other requests859 if (860 // Only look in admin861 !is_admin() ||862 863 // Make sure the current page is for post rows864 ( 'edit.php' != $pagenow ) ||865 866 // Make sure we're looking for a post_type867 empty( $_GET['post_type'] ) ||868 869 // Make sure we're looking at bbPress topics870 ( $_GET['post_type'] != $this->post_type )871 )872 873 // We're in no shape to filter anything, so return874 return $query_vars;875 876 816 // Add post_parent query_var if one is present 877 817 if ( !empty( $_GET['bbp_forum_id'] ) ) { … … 890 830 * 891 831 * @global int $post_ID 892 * @uses get_post_type()893 832 * @uses bbp_get_topic_permalink() 894 833 * @uses wp_post_revision_title() … … 902 841 function updated_messages( $messages ) { 903 842 global $post_ID; 904 905 if ( get_post_type( $post_ID ) != $this->post_type )906 return $messages;907 843 908 844 // URL for the current topic … … 962 898 * Setup bbPress Replies Admin 963 899 * 900 * This is currently here to make hooking and unhooking of the admin UI easy. 901 * It could use dependency injection in the future, but for now this is easier. 902 * 964 903 * @since bbPress (r2596) 965 904 * … … 967 906 */ 968 907 function bbp_admin_replies() { 908 global $typenow; 909 910 if ( bbp_get_reply_post_type() == $typenow ) 911 return; 912 969 913 bbpress()->admin->replies = new BBP_Replies_Admin(); 970 914 }
Note: See TracChangeset
for help on using the changeset viewer.