Conditions | 3 |
Paths | 4 |
Total Lines | 105 |
Code Lines | 69 |
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 |
||
30 | public function render() { |
||
31 | ?> |
||
32 | <!-- User Meta box start--> |
||
33 | <fieldset class="options"> |
||
34 | <h4><?php _e( 'Select the user role whose user meta fields you want to delete', 'bulk-delete' ); ?></h4> |
||
35 | <table class="optiontable"> |
||
36 | <?php |
||
37 | $users_count = count_users(); |
||
38 | foreach ( $users_count['avail_roles'] as $role => $count ) { |
||
39 | ?> |
||
40 | <tr> |
||
41 | <td> |
||
42 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_role" value = "<?php echo $role; ?>" type = "radio" <?php checked( $role, 'administrator' ); ?>> |
||
43 | <label for="smbd_<?php echo esc_attr( $this->field_slug ); ?>_role"><?php echo $role; ?> (<?php echo $count . ' '; _e( 'Users', 'bulk-delete' ); ?>)</label> |
||
44 | </td> |
||
45 | </tr> |
||
46 | <?php |
||
47 | } |
||
48 | ?> |
||
49 | </table> |
||
50 | |||
51 | <h4><?php _e( 'Choose your user meta field settings', 'bulk-delete' ); ?></h4> |
||
52 | <table class="optiontable"> |
||
53 | <tr> |
||
54 | <td> |
||
55 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_use_value" value="false" type="radio" checked> |
||
56 | <label for="smbd_<?php echo esc_attr( $this->field_slug ); ?>_use_value"><?php echo __( 'Delete based on user meta key name only', 'bulk-delete' ); ?></label> |
||
57 | </td> |
||
58 | </tr> |
||
59 | |||
60 | <tr> |
||
61 | <td> |
||
62 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_use_value" id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_use_value" value="true" type="radio" disabled> |
||
63 | <label for="smbd_<?php echo esc_attr( $this->field_slug ); ?>_use_value"><?php echo __( 'Delete based on user meta key name and value', 'bulk-delete' ); ?></label> |
||
64 | <span class="bd-um-pro" style="color:red; vertical-align: middle;"> |
||
65 | <?php _e( 'Only available in Pro Addon', 'bulk-delete' ); ?> <a href = "http://bulkwp.com/addons/bulk-delete-user-meta/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-m-u" target="_blank">Buy now</a> |
||
66 | </span> |
||
67 | </td> |
||
68 | </tr> |
||
69 | |||
70 | <tr> |
||
71 | <td> |
||
72 | <label for="smbd_<?php echo esc_attr( $this->field_slug ); ?>_key"><?php _e( 'User Meta Key ', 'bulk-delete' ); ?></label> |
||
73 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_key" id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_key" placeholder="<?php _e( 'Meta Key', 'bulk-delete' ); ?>"> |
||
74 | </td> |
||
75 | </tr> |
||
76 | </table> |
||
77 | <?php |
||
78 | /** |
||
79 | * Add more fields to the delete user meta field form. |
||
80 | * This hook can be used to add more fields to the delete user meta field form. |
||
81 | * |
||
82 | * @since 5.4 |
||
83 | */ |
||
84 | do_action( 'bd_delete_user_meta_form' ); |
||
85 | ?> |
||
86 | <table class="optiontable"> |
||
87 | <tr> |
||
88 | <td> |
||
89 | <h4><?php _e( 'Choose your deletion options', 'bulk-delete' ); ?></h4> |
||
90 | </td> |
||
91 | </tr> |
||
92 | |||
93 | <tr> |
||
94 | <td> |
||
95 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_limit" id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_limit" value = "true" type = "checkbox"> |
||
96 | <?php _e( 'Only delete user meta field from first ', 'bulk-delete' );?> |
||
97 | <input type ="textbox" name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_limit_to" id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_limit_to" disabled value ="0" maxlength="4" size="4"><?php _e( 'users.', 'bulk-delete' );?> |
||
98 | <?php _e( 'Use this option if there are more than 1000 users and the script times out.', 'bulk-delete' ) ?> |
||
99 | </td> |
||
100 | </tr> |
||
101 | |||
102 | <tr> |
||
103 | <td> |
||
104 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron" value = "false" type = "radio" checked="checked"> <?php _e( 'Delete now', 'bulk-delete' ); ?> |
||
105 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron" value = "true" type = "radio" id = "smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron" disabled > <?php _e( 'Schedule', 'bulk-delete' ); ?> |
||
106 | <input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_start" id = "smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_start" value = "now" type = "text" disabled><?php _e( 'repeat ', 'bulk-delete' );?> |
||
107 | <select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_freq" id = "smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_freq" disabled> |
||
108 | <option value = "-1"><?php _e( "Don't repeat", 'bulk-delete' ); ?></option> |
||
109 | <?php |
||
110 | $schedules = wp_get_schedules(); |
||
111 | foreach ( $schedules as $key => $value ) { |
||
112 | ?> |
||
113 | <option value = "<?php echo $key; ?>"><?php echo $value['display']; ?></option> |
||
114 | <?php |
||
115 | } |
||
116 | ?> |
||
117 | </select> |
||
118 | <span class="bd-um-pro" style="color:red"> |
||
119 | <?php _e( 'Only available in Pro Addon', 'bulk-delete' ); ?> <a href = "http://bulkwp.com/addons/bulk-delete-user-meta/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-m-u">Buy now</a> |
||
120 | </span> |
||
121 | </td> |
||
122 | </tr> |
||
123 | |||
124 | <tr> |
||
125 | <td> |
||
126 | <?php _e( 'Enter time in Y-m-d H:i:s format or enter now to use current time', 'bulk-delete' );?> |
||
127 | </td> |
||
128 | </tr> |
||
129 | |||
130 | </table> |
||
131 | </fieldset> |
||
132 | |||
133 | <p> |
||
134 | <button type="submit" name="bd_action" value="delete_meta_user" class="button-primary"><?php _e( 'Bulk Delete ', 'bulk-delete' ) ?>»</button> |
||
135 | </p> |
||
196 |