1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Customize admin UI for Bulk Delete plugin. |
4
|
|
|
* |
5
|
|
|
* @since 5.0 |
6
|
|
|
* |
7
|
|
|
* @author Sudar |
8
|
|
|
* |
9
|
|
|
* @package BulkDelete\Admin |
10
|
|
|
*/ |
11
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Add rating links to the admin dashboard. |
15
|
|
|
* |
16
|
|
|
* @since 5.0 |
17
|
|
|
* |
18
|
|
|
* @param string $footer_text The existing footer text |
19
|
|
|
* |
20
|
|
|
* @return string |
21
|
|
|
*/ |
22
|
|
|
function bd_add_rating_link( $footer_text ) { |
23
|
|
|
$rating_text = sprintf( __( 'Thank you for using <a href = "%1$s">Bulk Delete</a> plugin! Kindly <a href = "%2$s">rate us</a> at <a href = "%2$s">WordPress.org</a>', 'bulk-delete' ), |
24
|
|
|
'http://bulkwp.com?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=footer', |
25
|
|
|
'http://wordpress.org/support/view/plugin-reviews/bulk-delete?filter=5#postform' |
26
|
|
|
); |
27
|
|
|
|
28
|
|
|
$rating_text = apply_filters( 'bd_rating_link', $rating_text ); |
29
|
|
|
|
30
|
|
|
return str_replace( '</span>', '', $footer_text ) . ' | ' . $rating_text . '</span>'; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Modify admin footer in Bulk Delete plugin pages. |
35
|
|
|
* |
36
|
|
|
* @since 5.0 |
37
|
|
|
*/ |
38
|
|
|
function bd_modify_admin_footer() { |
39
|
|
|
add_filter( 'admin_footer_text', 'bd_add_rating_link' ); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Add additional links in the Plugin listing page. |
44
|
|
|
* Based on http://zourbuth.com/archives/751/creating-additional-wordpress-plugin-links-row-meta/. |
45
|
|
|
* |
46
|
|
|
* @param array $links List of current links |
47
|
|
|
* @param string $file Plugin filename |
48
|
|
|
* |
49
|
|
|
* @return array $links Modified list of links |
50
|
|
|
*/ |
51
|
|
|
function bd_add_links_in_plugin_listing( $links, $file ) { |
52
|
|
|
$plugin = plugin_basename( Bulk_Delete::$PLUGIN_FILE ); |
53
|
|
|
|
54
|
|
|
if ( $file == $plugin ) { // only for this plugin |
55
|
|
|
return array_merge( $links, array( |
56
|
|
|
'<a href="http://bulkwp.com/addons?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=plugin-page" target="_blank">' . __( 'Buy Addons', 'bulk-delete' ) . '</a>', |
57
|
|
|
) ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
return $links; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
// Modify admin footer |
64
|
1 |
|
add_action( 'bd_admin_footer_posts_page', 'bd_modify_admin_footer' ); |
65
|
1 |
|
add_action( 'bd_admin_footer_pages_page', 'bd_modify_admin_footer' ); |
66
|
1 |
|
add_action( 'bd_admin_footer_cron_page' , 'bd_modify_admin_footer' ); |
67
|
1 |
|
add_action( 'bd_admin_footer_addon_page', 'bd_modify_admin_footer' ); |
68
|
1 |
|
add_action( 'bd_admin_footer_info_page' , 'bd_modify_admin_footer' ); |
69
|
|
|
|
70
|
|
|
// Change plugin listing page |
71
|
|
|
add_filter( 'plugin_row_meta', 'bd_add_links_in_plugin_listing', 10, 2 ); |
72
|
|
|
|