| Conditions | 1 |
| Paths | 1 |
| Total Lines | 76 |
| Code Lines | 58 |
| 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 |
||
| 62 | protected function get_post_upsell_addons() { |
||
| 63 | $addon_upsell_details = array( |
||
| 64 | array( |
||
| 65 | 'name' => 'Bulk Delete Posts by Custom Field', |
||
| 66 | 'description' => 'This addon adds the ability to delete posts based on custom field. This will be really useful, if your plugin or theme uses custom fields to store additional information about a post.', |
||
| 67 | 'slug' => 'bulk-delete-posts-by-custom-field', |
||
| 68 | 'url' => 'https://bulkwp.com/addons/bulk-delete-posts-by-custom-field/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-cf', |
||
| 69 | 'buy_url' => '', |
||
| 70 | 'upsell_title' => 'Want to delete Posts based on Custom Field (Post Meta)?', |
||
| 71 | 'upsell_message' => '<strong>Bulk Delete Posts by Custom Field</strong> add-on allows you to delete posts based on custom field (also known as post meta).', |
||
| 72 | ), |
||
| 73 | array( |
||
| 74 | 'name' => 'Bulk Delete Posts by Title', |
||
| 75 | 'description' => 'This addon adds the ability to delete posts based on title.', |
||
| 76 | 'slug' => 'bulk-delete-posts-by-title', |
||
| 77 | 'url' => 'https://bulkwp.com/addons/bulk-delete-posts-by-title/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-ti', |
||
| 78 | 'buy_url' => '', |
||
| 79 | 'upsell_title' => 'Want to delete Posts based on title?', |
||
| 80 | 'upsell_message' => '<strong>Bulk Delete Posts by Title</strong> add-on allows you to delete posts based on title.', |
||
| 81 | ), |
||
| 82 | array( |
||
| 83 | 'name' => 'Bulk Delete Posts by Duplicate Title', |
||
| 84 | 'description' => 'This addon adds the ability to delete posts based on duplicate title.', |
||
| 85 | 'slug' => 'bulk-delete-posts-by-duplicate-title', |
||
| 86 | 'url' => 'https://bulkwp.com/addons/bulk-delete-posts-by-duplicate-title/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-dti', |
||
| 87 | 'buy_url' => '', |
||
| 88 | 'upsell_title' => 'Want to delete Posts that have duplicate titles?', |
||
| 89 | 'upsell_message' => '<strong>Bulk Delete Posts by Duplicate Title</strong> add-on allows you to delete posts that have duplicate title.', |
||
| 90 | ), |
||
| 91 | array( |
||
| 92 | 'name' => 'Bulk Delete Posts by Content', |
||
| 93 | 'description' => 'This addon adds the ability to delete posts based on content.', |
||
| 94 | 'slug' => 'bulk-delete-posts-by-content', |
||
| 95 | 'url' => 'https://bulkwp.com/addons/bulk-delete-posts-by-content/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-p-co', |
||
| 96 | 'buy_url' => '', |
||
| 97 | 'upsell_title' => 'Want to delete Posts based on the post content?', |
||
| 98 | 'upsell_message' => '<strong>Bulk Delete Posts by Content</strong> add-on allows you to delete posts based on its post content.', |
||
| 99 | ), |
||
| 100 | array( |
||
| 101 | 'name' => 'Bulk Delete Posts by User', |
||
| 102 | 'description' => 'This addon adds the ability to delete posts based on the author who created the post.', |
||
| 103 | 'slug' => 'bulk-delete-posts-by-user', |
||
| 104 | 'url' => 'https://bulkwp.com/addons/bulk-delete-posts-by-user/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-p-u', |
||
| 105 | 'buy_url' => '', |
||
| 106 | 'upsell_title' => 'Want to delete Posts based on the user who created it?', |
||
| 107 | 'upsell_message' => '<strong>Bulk Delete Posts by User</strong> add-on allows you to delete posts based on user who created the post.', |
||
| 108 | ), |
||
| 109 | array( |
||
| 110 | 'name' => 'Bulk Delete Posts by Attachment', |
||
| 111 | 'description' => 'This addon adds the ability to delete posts based on attachment.', |
||
| 112 | 'slug' => 'bulk-delete-posts-by-attachment', |
||
| 113 | 'url' => 'https://bulkwp.com/addons/bulk-delete-posts-by-attachment/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-p-at', |
||
| 114 | 'buy_url' => '', |
||
| 115 | 'upsell_title' => 'Want to delete Posts based on whether it has an attachment?', |
||
| 116 | 'upsell_message' => "<strong>Bulk Delete Posts by Attachment</strong> add-on allows you to delete posts based on whether a post contains (or doesn't contain) an attachment.", |
||
| 117 | ), |
||
| 118 | array( |
||
| 119 | 'name' => 'Bulk Delete From Trash', |
||
| 120 | 'description' => 'This addon adds the ability to delete posts or pages from trash.', |
||
| 121 | 'slug' => 'bulk-delete-from-trash', |
||
| 122 | 'url' => 'https://bulkwp.com/addons/bulk-delete-from-trash/?utm_campaign=Upsell&utm_medium=wp-admin&utm_source=upsell-module&utm_content=bd-th', |
||
| 123 | 'buy_url' => '', |
||
| 124 | 'upsell_title' => 'Want to delete Posts that are in trash?', |
||
| 125 | 'upsell_message' => '<strong>Bulk Delete From Trash</strong> add-on allows you to delete posts that are in trash.', |
||
| 126 | ), |
||
| 127 | ); |
||
| 128 | |||
| 129 | /** |
||
| 130 | * List of Upsell add-ons based on item type. |
||
| 131 | * |
||
| 132 | * @since 6.0.0 |
||
| 133 | * |
||
| 134 | * @param array $addon_upsell_details Add-on details. |
||
| 135 | * @param string $item_type Item type. |
||
| 136 | */ |
||
| 137 | return apply_filters( 'bd_upsell_addons', $addon_upsell_details, 'posts' ); |
||
| 138 | } |
||
| 209 |