*/ class AdminFooterText extends AdminSettingsModel { /** * Server Info * * @var $server_info */ public $server_info; /** * Default admin_footer_text value supplied by WordPress core. * * Captured via the admin_footer_text filter at an early priority before * the plugin overrides it, so the standard "Thank you for creating with * WordPress." string can be rendered when the credit option is disabled * without hardcoding a copy of that string in the plugin. * * @var string */ protected static $wp_default_footer_text = ''; /** * Constructor */ public function __construct() { $this->options = (array) AdminSettings::get_instance()->get(); $this->options = !empty($this->options['white_label']['wordpress']['admin_footer']) ? $this->options['white_label']['wordpress']['admin_footer'] : ''; // Remove Admin Footer Version Number if (!empty($this->options) && in_array('wp_version', $this->options)) { add_action('admin_menu', [$this, 'remove_admin_footer_version']); } add_action('admin_menu', [$this, 'footer_version_remove']); add_action('network_admin_menu', [$this, 'footer_version_remove']); /** Admin Footer */ add_filter('update_footer', [$this, 'change_admin_footer'], 10, 3); // Capture WordPress core's default admin_footer_text before // suppressing it, so we can re-render it when the plugin's // "Show Footer Credit" option is disabled. add_filter('admin_footer_text', [$this, 'capture_wp_default_footer_text'], 1); add_filter( 'admin_footer_text', '__return_false', 999 ); add_filter( 'update_footer', '__return_false', 999 ); $this->server_info = new ServerInfo(); } /** * Capture the default admin footer text WordPress passes into the * admin_footer_text filter, then return it unchanged. * * @param string $text * @return string */ public function capture_wp_default_footer_text($text) { if (is_string($text) && $text !== '') { self::$wp_default_footer_text = $text; } return $text; } /** * Remove WordPress version * * @return void */ public function remove_admin_footer_version() { // Remove WordPress Version except Admin if (!current_user_can('manage_options')) { remove_filter('update_footer', 'core_update_footer'); } } // function footer_get_options() // { // $objects = isset($this->options) && is_array($this->options) ? $this->options : []; // return $objects; // } public function footer_version_remove() { remove_filter('update_footer', 'core_update_footer'); } /** * Default footer credit markup. * * Single source of truth for the "Developed by / Powered by" string, * used both as the default value of the white-label footer text option * and as the rendered fallback when the option is empty. * * @return string */ public static function get_default_footer_credit() { return sprintf( /* translators: 1: WP Adminify website URL, 2: Plugin label, 3: WordPress.org URL */ __('
Developed by %2$s
Powered by WordPress
', 'adminify'), esc_url('https://wpadminify.com/'), AdminSettings::get_pro_label(), esc_url('https://wordpress.org/') ); } /** Footer Credits */ public function footer_credits() { ?>