| Conditions | 8 |
| Paths | 14 |
| Total Lines | 86 |
| Code Lines | 67 |
| 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 | $taxs = get_taxonomies( array( |
||
| 30 | 'public' => true, |
||
| 31 | '_builtin' => false, |
||
| 32 | ), 'objects' |
||
| 33 | ); |
||
| 34 | |||
| 35 | $terms_array = array(); |
||
| 36 | if ( count( $taxs ) > 0 ) { |
||
| 37 | foreach ( $taxs as $tax ) { |
||
| 38 | $terms = get_terms( $tax->name ); |
||
| 39 | if ( count( $terms ) > 0 ) { |
||
|
|
|||
| 40 | $terms_array[$tax->name] = $terms; |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | if ( count( $terms_array ) > 0 ) { |
||
| 46 | ?> |
||
| 47 | <!-- Custom tax Start--> |
||
| 48 | <h4><?php _e( 'Select the post type from which you want to delete posts by custom taxonomy', 'bulk-delete' ); ?></h4> |
||
| 49 | |||
| 50 | <fieldset class="options"> |
||
| 51 | <table class="optiontable"> |
||
| 52 | <?php $this->render_post_type_dropdown(); ?> |
||
| 53 | </table> |
||
| 54 | |||
| 55 | <h4><?php _e( 'Select the taxonomies from which you want to delete posts', 'bulk-delete' ) ?></h4> |
||
| 56 | |||
| 57 | <table class="optiontable"> |
||
| 58 | <?php |
||
| 59 | foreach ( $terms_array as $tax => $terms ) { |
||
| 60 | ?> |
||
| 61 | <tr> |
||
| 62 | <td scope="row" > |
||
| 63 | <input name="smbd_taxs" value="<?php echo $tax; ?>" type="radio" class="custom-tax"> |
||
| 64 | </td> |
||
| 65 | <td> |
||
| 66 | <label for="smbd_taxs"><?php echo $taxs[$tax]->labels->name; ?> </label> |
||
| 67 | </td> |
||
| 68 | </tr> |
||
| 69 | <?php |
||
| 70 | } |
||
| 71 | ?> |
||
| 72 | </table> |
||
| 73 | |||
| 74 | <h4><?php _e( 'The selected taxonomy has the following terms. Select the terms from which you want to delete posts', 'bulk-delete' ) ?></h4> |
||
| 75 | <p><?php _e( 'Note: The post count below for each term is the total number of posts in that term, irrespective of post type', 'bulk-delete' ); ?>.</p> |
||
| 76 | <?php |
||
| 77 | foreach ( $terms_array as $tax => $terms ) { |
||
| 78 | ?> |
||
| 79 | <table class="optiontable terms_<?php echo $tax;?> terms"> |
||
| 80 | <?php |
||
| 81 | foreach ( $terms as $term ) { |
||
| 82 | ?> |
||
| 83 | <tr> |
||
| 84 | <td scope="row" > |
||
| 85 | <input name="smbd_tax_terms[]" value="<?php echo $term->slug; ?>" type="checkbox" class="terms"> |
||
| 86 | </td> |
||
| 87 | <td> |
||
| 88 | <label for="smbd_tax_terms"><?php echo $term->name; ?> (<?php echo $term->count . ' '; _e( 'Posts', 'bulk-delete' ); ?>)</label> |
||
| 89 | </td> |
||
| 90 | </tr> |
||
| 91 | <?php |
||
| 92 | } |
||
| 93 | ?> |
||
| 94 | </table> |
||
| 95 | <?php |
||
| 96 | } |
||
| 97 | ?> |
||
| 98 | <table class="optiontable"> |
||
| 99 | <?php |
||
| 100 | $this->render_filtering_table_header(); |
||
| 101 | $this->render_restrict_settings(); |
||
| 102 | $this->render_delete_settings(); |
||
| 103 | $this->render_limit_settings(); |
||
| 104 | $this->render_cron_settings(); |
||
| 105 | ?> |
||
| 106 | </table> |
||
| 107 | |||
| 108 | </fieldset> |
||
| 109 | <?php |
||
| 110 | $this->render_submit_button(); |
||
| 111 | } else { |
||
| 112 | ?> |
||
| 113 | <h4><?php _e( "This WordPress installation doesn't have any non-empty custom taxonomies defined", 'bulk-delete' ) ?></h4> |
||
| 114 | <?php |
||
| 183 |