#akismet-plugin-container > header / .akismet-lower / footer`). This
* keeps the integration resilient to the CSS-Module class hashing used by the real React
* components.
*
* NOTE: This class does not modify the Akismet plugin in any way. It only registers
* callbacks on Akismet's own action hooks.
*
* @package automattic/jetpack
*/
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Status;
use Automattic\Jetpack\Status\Host;
if ( ! defined( 'ABSPATH' ) ) {
exit( 0 );
}
/**
* Wires the unified Jetpack header, footer and contained layout onto Akismet's admin pages.
*/
class Akismet_Admin_Chrome {
/**
* The green Jetpack logo mark, sized via the `height` attribute by callers.
*
* @param int $height Pixel height of the logo.
* @return string SVG markup.
*/
private function jetpack_logo( $height ) {
return '';
}
/**
* The Akismet logo mark — the green rounded square with the white "A", taken from
* Akismet's own `akismet-refresh-logo.svg`. Sized via the `height` attribute by callers.
*
* @param int $height Pixel height of the logo.
* @return string SVG markup.
*/
private function akismet_logo( $height ) {
return '';
}
/**
* Register the hooks that drive the chrome.
*
* Safe to call unconditionally: the header/footer callbacks are only ever fired by
* Akismet's own admin views, and the inline stylesheet is printed alongside the header.
*
* Idempotent: this can be wired from more than one place depending on the platform —
* `Jetpack_Admin` on Atomic/self-hosted, and `Akismet_Admin_WPCOM` on WordPress.com
* Simple sites (the two run under different load orders). The static guard ensures the
* `akismet_header` / `akismet_footer` callbacks are only ever registered once, so the
* chrome can never render twice regardless of how many call sites fire.
*/
public function init_hooks() {
static $registered = false;
if ( $registered ) {
return;
}
$registered = true;
add_action( 'akismet_header', array( $this, 'render_header' ) );
add_action( 'akismet_footer', array( $this, 'render_footer' ) );
}
/**
* The self-contained stylesheet reproducing the admin-ui page header + `.jetpack-footer`
* computed styles. Printed once, alongside the header.
*/
private function print_styles() {
static $printed = false;
if ( $printed ) {
return;
}
$printed = true;
?>
print_styles();
?>