sudar /
bulk-delete
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Post Addons related functions. |
||
| 4 | * |
||
| 5 | * @since 5.5 |
||
| 6 | * |
||
| 7 | * @author Sudar |
||
| 8 | * |
||
| 9 | * @package BulkDelete\Addon |
||
| 10 | */ |
||
| 11 | defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Register post related addons. |
||
| 15 | * |
||
| 16 | * @since 5.5 |
||
| 17 | */ |
||
| 18 | function bd_register_post_addons() { |
||
| 19 | $bd = BULK_DELETE(); |
||
|
0 ignored issues
–
show
|
|||
| 20 | |||
| 21 | add_meta_box( Bulk_Delete::BOX_CUSTOM_FIELD , __( 'By Custom Field' , 'bulk-delete' ) , 'bd_render_delete_posts_by_custom_field_box' , $bd->posts_page , 'advanced' ); |
||
| 22 | add_meta_box( Bulk_Delete::BOX_TITLE , __( 'By Title' , 'bulk-delete' ) , 'bd_render_delete_posts_by_title_box' , $bd->posts_page , 'advanced' ); |
||
| 23 | add_meta_box( Bulk_Delete::BOX_DUPLICATE_TITLE , __( 'By Duplicate Title' , 'bulk-delete' ) , 'bd_render_delete_posts_by_duplicate_title_box' , $bd->posts_page , 'advanced' ); |
||
| 24 | add_meta_box( Bulk_Delete::BOX_POST_BY_ROLE , __( 'By User Role' , 'bulk-delete' ) , 'bd_render_delete_posts_by_user_role_box' , $bd->posts_page , 'advanced' ); |
||
| 25 | add_meta_box( Bulk_Delete::BOX_POST_FROM_TRASH , __( 'Posts in Trash' , 'bulk-delete' ) , 'bd_render_delete_posts_from_trash' , $bd->posts_page , 'advanced' ); |
||
| 26 | } |
||
| 27 | add_action( 'bd_add_meta_box_for_posts', 'bd_register_post_addons' ); |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Render delete posts by custom field box. |
||
| 31 | * |
||
| 32 | * @since 5.5 |
||
| 33 | */ |
||
| 34 | function bd_render_delete_posts_by_custom_field_box() { |
||
| 35 | if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_CUSTOM_FIELD ) ) { |
||
| 36 | printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
||
| 37 | |||
| 38 | return; |
||
| 39 | } |
||
| 40 | |||
| 41 | if ( ! class_exists( 'Bulk_Delete_Posts_By_Custom_Field' ) ) { |
||
| 42 | ?> |
||
| 43 | <!-- Custom Field box start--> |
||
| 44 | <p> |
||
| 45 | <span class = "bd-post-custom-field-pro" style = "color:red"> |
||
| 46 | <?php _e( 'You need "Bulk Delete Posts by Custom Field" Addon, to delete post by custom field.', 'bulk-delete' ); ?> |
||
| 47 | <a href = "http://bulkwp.com/addons/bulk-delete-posts-by-custom-field/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-cf">Buy now</a> |
||
| 48 | </span> |
||
| 49 | </p> |
||
| 50 | <!-- Custom Field box end--> |
||
| 51 | <?php |
||
| 52 | } else { |
||
| 53 | Bulk_Delete_Posts_By_Custom_Field::render_delete_posts_by_custom_field_box(); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Render posts by title box. |
||
| 59 | * |
||
| 60 | * @since 5.5 |
||
| 61 | */ |
||
| 62 | function bd_render_delete_posts_by_title_box() { |
||
| 63 | if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_TITLE ) ) { |
||
| 64 | printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
||
| 65 | |||
| 66 | return; |
||
| 67 | } |
||
| 68 | |||
| 69 | if ( ! class_exists( 'Bulk_Delete_Posts_By_Title' ) ) { |
||
| 70 | ?> |
||
| 71 | <!-- Title box start--> |
||
| 72 | <p> |
||
| 73 | <span class = "bd-post-title-pro" style = "color:red"> |
||
| 74 | <?php _e( 'You need "Bulk Delete Posts by Title" Addon, to delete post by title.', 'bulk-delete' ); ?> |
||
| 75 | <a href = "http://bulkwp.com/addons/bulk-delete-posts-by-title/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-ti">Buy now</a> |
||
| 76 | </span> |
||
| 77 | </p> |
||
| 78 | <!-- Title box end--> |
||
| 79 | <?php |
||
| 80 | } else { |
||
| 81 | Bulk_Delete_Posts_By_Title::render_delete_posts_by_title_box(); |
||
| 82 | } |
||
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Render delete posts by duplicate title box. |
||
| 87 | * |
||
| 88 | * @since 5.5 |
||
| 89 | */ |
||
| 90 | function bd_render_delete_posts_by_duplicate_title_box() { |
||
| 91 | if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_DUPLICATE_TITLE ) ) { |
||
| 92 | printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
||
| 93 | |||
| 94 | return; |
||
| 95 | } |
||
| 96 | |||
| 97 | if ( ! class_exists( 'Bulk_Delete_Posts_By_Duplicate_Title' ) ) { |
||
| 98 | ?> |
||
| 99 | <!-- Duplicate Title box start--> |
||
| 100 | <p> |
||
| 101 | <span class = "bd-post-title-pro" style = "color:red"> |
||
| 102 | <?php _e( 'You need "Bulk Delete Posts by Duplicate Title" Addon, to delete post by duplicate title.', 'bulk-delete' ); ?> |
||
| 103 | <a href = "http://bulkwp.com/addons/bulk-delete-posts-by-duplicate-title/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-dti">Buy now</a> |
||
| 104 | </span> |
||
| 105 | </p> |
||
| 106 | <!-- Duplicate Title box end--> |
||
| 107 | <?php |
||
| 108 | } else { |
||
| 109 | Bulk_Delete_Posts_By_Duplicate_Title::render_delete_posts_by_duplicate_title_box(); |
||
| 110 | } |
||
| 111 | } |
||
| 112 | |||
| 113 | /** |
||
| 114 | * Delete posts by user role. |
||
| 115 | * |
||
| 116 | * @since 5.5 |
||
| 117 | */ |
||
| 118 | function bd_render_delete_posts_by_user_role_box() { |
||
| 119 | if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_POST_BY_ROLE ) ) { |
||
| 120 | printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
||
| 121 | |||
| 122 | return; |
||
| 123 | } |
||
| 124 | if ( ! class_exists( 'Bulk_Delete_Posts_By_User_Role' ) ) { |
||
| 125 | ?> |
||
| 126 | <!-- Posts by user role start--> |
||
| 127 | <p> |
||
| 128 | <span class = "bd-post-by-role-pro" style = "color:red"> |
||
| 129 | <?php _e( 'You need "Bulk Delete Posts by User Role" Addon, to delete post based on User Role', 'bulk-delete' ); ?> |
||
| 130 | <a href = "http://bulkwp.com/addons/bulk-delete-posts-by-user-role/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-ur">Buy now</a> |
||
| 131 | </span> |
||
| 132 | </p> |
||
| 133 | <!-- Posts by user role end--> |
||
| 134 | <?php |
||
| 135 | } else { |
||
| 136 | Bulk_Delete_Posts_By_User_Role::render_delete_posts_by_user_role_box(); |
||
| 137 | } |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Render delete posts from trash box. |
||
| 142 | * |
||
| 143 | * @since 5.5 |
||
| 144 | */ |
||
| 145 | function bd_render_delete_posts_from_trash() { |
||
| 146 | if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_POST_FROM_TRASH ) ) { |
||
| 147 | printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
||
| 148 | |||
| 149 | return; |
||
| 150 | } |
||
| 151 | |||
| 152 | if ( ! class_exists( 'Bulk_Delete_From_Trash' ) ) { |
||
| 153 | ?> |
||
| 154 | <!-- Posts In Trash box start--> |
||
| 155 | <p> |
||
| 156 | <span class = "bd-post-trash-pro" style = "color:red"> |
||
| 157 | <?php _e( 'You need "Bulk Delete From Trash" Addon, to delete post in Trash.', 'bulk-delete' ); ?> |
||
| 158 | <a href = "http://bulkwp.com/addons/bulk-delete-from-trash/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-th">Buy now</a> |
||
| 159 | </span> |
||
| 160 | </p> |
||
| 161 | <!-- Posts In Trash box end--> |
||
| 162 | <?php |
||
| 163 | } else { |
||
| 164 | /** |
||
| 165 | * Render delete posts from trash box. |
||
| 166 | * |
||
| 167 | * @since 5.4 |
||
| 168 | */ |
||
| 169 | do_action( 'bd_render_delete_posts_from_trash' ); |
||
| 170 | } |
||
| 171 | } |
||
| 172 | ?> |
||
| 173 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.