1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Auto Load Next Post - Admin Footer. |
4
|
|
|
* |
5
|
|
|
* @since 1.6.0 |
6
|
|
|
* @author Sébastien Dumont |
7
|
|
|
* @category Admin |
8
|
|
|
* @package Auto Load Next Post/Admin |
9
|
|
|
* @license GPL-2.0+ |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
// Exit if accessed directly. |
13
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
14
|
|
|
exit; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
if ( ! class_exists( 'ALNP_Admin_Footer' ) ) { |
18
|
|
|
|
19
|
|
|
class ALNP_Admin_Footer { |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Constructor |
23
|
|
|
* |
24
|
|
|
* @access public |
25
|
|
|
*/ |
26
|
|
|
public function __construct() { |
27
|
|
|
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 15, 1 ); |
28
|
|
|
add_filter( 'update_footer', array( $this, 'update_footer'), 15 ); |
29
|
|
|
} // END __construct() |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Filters the admin footer text by placing simply thank you to those who |
33
|
|
|
* like and review the plugin on WordPress.org when viewing |
34
|
|
|
* Auto Load Next Post settings page. |
35
|
|
|
* |
36
|
|
|
* @access public |
37
|
|
|
* @param string $text text to be rendered in the footer. |
38
|
|
|
* @return string $text |
39
|
|
|
*/ |
40
|
|
|
public function admin_footer_text( $text ) { |
41
|
|
|
$screen = get_current_screen(); |
42
|
|
|
$screen_id = $screen ? $screen->id : ''; |
43
|
|
|
|
44
|
|
|
if ( $screen_id == 'settings_page_auto-load-next-post' ) { |
45
|
|
|
// Rating and Review |
46
|
|
|
$text = sprintf( |
47
|
|
|
/* translators: 1: Auto Load Next Post 2:: five stars */ |
48
|
|
|
__( 'If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post' ), |
49
|
|
|
sprintf( '<strong>%1$s</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
50
|
|
|
'<a href="' . AUTO_LOAD_NEXT_POST_REVIEW_URL . '?rate=5#new-post" target="_blank" aria-label="' . esc_attr__( 'five star', 'auto-load-next-post' ) . '" data-rated="' . esc_attr__( 'Thanks :)', 'auto-load-next-post' ) . '">★★★★★</a>' |
51
|
|
|
); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return $text; |
55
|
|
|
} // END admin_footer_text() |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Filters the update footer by placing the version of the plugin |
59
|
|
|
* when viewing Auto Load Next Post settings page. |
60
|
|
|
* |
61
|
|
|
* @access public |
62
|
|
|
* @param string $text |
63
|
|
|
* @return string $text |
64
|
|
|
*/ |
65
|
|
|
public function update_footer( $text ) { |
66
|
|
|
$screen = get_current_screen(); |
67
|
|
|
$screen_id = $screen ? $screen->id : ''; |
68
|
|
|
|
69
|
|
|
if ( $screen_id == 'settings_page_auto-load-next-post' ) { |
70
|
|
|
return sprintf( __( '%s Version', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . ' ' . esc_attr( AUTO_LOAD_NEXT_POST_VERSION ); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
return $text; |
74
|
|
|
} // END update_footer() |
75
|
|
|
|
76
|
|
|
} // END class |
77
|
|
|
|
78
|
|
|
} // END if class exists |
79
|
|
|
|
80
|
|
|
return new ALNP_Admin_Footer(); |
81
|
|
|
|