PluginProbe ʕ •ᴥ•ʔ
Admin Help Docs / 2.0.0.1
Admin Help Docs v2.0.0.1
2.0.1.1 trunk 1.4.3.2 2.0.0 2.0.0.1 2.0.0.2 2.0.1
admin-help-docs / inc / docs / footer-text.php
admin-help-docs / inc / docs Last commit date
page-locations 3 months ago admin-bar.php 3 months ago controller.php 3 months ago footer-text.php 3 months ago function.php 3 months ago wp-dashboard.php 3 months ago
footer-text.php
89 lines
1 <?php
2 /**
3 * Footer Text
4 */
5
6 namespace PluginRx\AdminHelpDocs;
7
8 if ( ! defined( 'ABSPATH' ) ) exit;
9
10 class FooterText {
11
12
13 /**
14 * The single instance of the class
15 *
16 * @var self|null
17 */
18 private static ?FooterText $instance = null;
19
20
21 /**
22 * Get the singleton instance
23 *
24 * @return self
25 */
26 public static function instance() : self {
27 return self::$instance ??= new self();
28 } // End instance()
29
30
31 /**
32 * Constructor
33 */
34 private function __construct() {
35 add_filter( ( 'admin_footer_text' ), [ $this, 'render_left_footer' ] );
36 add_filter( ( 'update_footer' ), [ $this, 'render_right_footer' ], 9999 );
37 } // End __construct()
38
39
40 /**
41 * Replaces the "Thank you for creating with WordPress" text.
42 * Supports {version} tag to dynamically insert the current WordPress version.
43 *
44 * @param string $text The original footer text
45 * @return string The modified footer text
46 */
47 public function render_left_footer( $text ) {
48 $option = get_option( 'helpdocs_footer_left' );
49 if ( ! $option ) {
50 return $text;
51 }
52
53 $content = wp_unslash( $option );
54 $content = str_replace( '{version}', get_bloginfo( 'version' ), $content );
55
56 return wp_kses_post( $content );
57 } // End render_left_footer()
58
59
60 /**
61 * Replaces the WordPress version/update text on the right.
62 * Supports {version} tag to dynamically insert the current WordPress version.
63 *
64 * @param string $text The original footer text
65 * @return string The modified footer text
66 */
67 public function render_right_footer( $text ) {
68 $option = get_option( 'helpdocs_footer_right' );
69 if ( ! $option ) {
70 return $text;
71 }
72
73 $content = wp_unslash( $option );
74 $content = str_replace( '{version}', get_bloginfo( 'version' ), $content );
75
76 return wp_kses_post( $content );
77 } // End render_right_footer()
78
79
80 /**
81 * Prevent cloning and unserializing
82 */
83 public function __clone() {}
84 public function __wakeup() {}
85
86 }
87
88
89 FooterText::instance();