Conditions | 3 |
Paths | 3 |
Total Lines | 53 |
Code Lines | 47 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
28 | public function render() { |
||
29 | $post_statuses = $this->get_post_statuses(); |
||
30 | $post_count = wp_count_posts(); |
||
31 | ?> |
||
32 | <h4><?php _e( 'Select the post statuses from which you want to delete posts', 'bulk-delete' ); ?></h4> |
||
33 | |||
34 | <fieldset class="options"> |
||
35 | <table class="optiontable"> |
||
36 | |||
37 | <?php foreach ( $post_statuses as $post_status ) : ?> |
||
38 | <tr> |
||
39 | <td> |
||
40 | <input name="smbd_post_status[]" id="smbd_<?php echo esc_attr( $post_status->name ); ?>" |
||
41 | value="<?php echo esc_attr( $post_status->name ); ?>" type="checkbox"> |
||
42 | |||
43 | <label for="smbd_<?php echo esc_attr( $post_status->name ); ?>"> |
||
44 | <?php echo esc_html( $post_status->label ), ' '; ?> |
||
45 | <?php if ( property_exists( $post_count, $post_status->name ) ) : ?> |
||
46 | (<?php echo absint( $post_count->{ $post_status->name } ) . ' ', __( 'Posts', 'bulk-delete' ); ?>) |
||
47 | <?php endif; ?> |
||
48 | </label> |
||
49 | </td> |
||
50 | </tr> |
||
51 | <?php endforeach; ?> |
||
52 | |||
53 | <?php $sticky_post_count = count( get_option( 'sticky_posts' ) ); ?> |
||
|
|||
54 | |||
55 | <tr> |
||
56 | <td> |
||
57 | <input name="smbd_sticky" id="smbd_sticky" value="on" type="checkbox"> |
||
58 | <label for="smbd_sticky"> |
||
59 | <?php echo __( 'All Sticky Posts', 'bulk-delete' ), ' '; ?> |
||
60 | (<?php echo absint( $sticky_post_count ), ' ', __( 'Posts', 'bulk-delete' ); ?>) |
||
61 | <?php echo '<strong>', __( 'Note', 'bulk-delete' ), '</strong>: ', __( 'The date filter will not work for sticky posts', 'bulk-delete' ); ?> |
||
62 | </label> |
||
63 | </td> |
||
64 | </tr> |
||
65 | |||
66 | </table> |
||
67 | |||
68 | <table class="optiontable"> |
||
69 | <?php |
||
70 | $this->render_filtering_table_header(); |
||
71 | $this->render_restrict_settings(); |
||
72 | $this->render_delete_settings(); |
||
73 | $this->render_limit_settings(); |
||
74 | $this->render_cron_settings(); |
||
75 | ?> |
||
76 | </table> |
||
77 | |||
78 | </fieldset> |
||
79 | <?php |
||
80 | $this->render_submit_button(); |
||
81 | } |
||
127 |