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 |
||
27 | public function render() { |
||
28 | $post_statuses = bd_get_post_statuses(); |
||
29 | $post_count = wp_count_posts(); |
||
30 | ?> |
||
31 | <h4><?php _e( 'Select the post statuses from which you want to delete posts', 'bulk-delete' ); ?></h4> |
||
32 | |||
33 | <fieldset class="options"> |
||
34 | <table class="optiontable"> |
||
35 | |||
36 | <?php foreach ( $post_statuses as $post_status ) : ?> |
||
37 | <tr> |
||
38 | <td> |
||
39 | <input name="smbd_post_status[]" id="smbd_<?php echo esc_attr( $post_status->name ); ?>" |
||
40 | value="<?php echo esc_attr( $post_status->name ); ?>" type="checkbox"> |
||
41 | |||
42 | <label for="smbd_<?php echo esc_attr( $post_status->name ); ?>"> |
||
43 | <?php echo esc_html( $post_status->label ), ' '; ?> |
||
44 | <?php if ( property_exists( $post_count, $post_status->name ) ) : ?> |
||
45 | (<?php echo absint( $post_count->{ $post_status->name } ) . ' ', __( 'Posts', 'bulk-delete' ); ?>) |
||
46 | <?php endif; ?> |
||
47 | </label> |
||
48 | </td> |
||
49 | </tr> |
||
50 | <?php endforeach; ?> |
||
51 | |||
52 | <?php $sticky_post_count = count( get_option( 'sticky_posts' ) ); ?> |
||
|
|||
53 | |||
54 | <tr> |
||
55 | <td> |
||
56 | <input name="smbd_sticky" id="smbd_sticky" value="on" type="checkbox"> |
||
57 | <label for="smbd_sticky"> |
||
58 | <?php echo __( 'All Sticky Posts', 'bulk-delete' ), ' '; ?> |
||
59 | (<?php echo absint( $sticky_post_count ), ' ', __( 'Posts', 'bulk-delete' ); ?>) |
||
60 | <?php echo '<strong>', __( 'Note', 'bulk-delete' ), '</strong>: ', __( 'The date filter will not work for sticky posts', 'bulk-delete' ); ?> |
||
61 | </label> |
||
62 | </td> |
||
63 | </tr> |
||
64 | |||
65 | </table> |
||
66 | |||
67 | <table class="optiontable"> |
||
68 | <?php |
||
69 | $this->render_filtering_table_header(); |
||
70 | $this->render_restrict_settings(); |
||
71 | $this->render_delete_settings(); |
||
72 | $this->render_limit_settings(); |
||
73 | $this->render_cron_settings(); |
||
74 | ?> |
||
75 | </table> |
||
76 | |||
77 | </fieldset> |
||
78 | <?php |
||
79 | $this->render_submit_button(); |
||
80 | } |
||
136 |