enabled() ) { return; } add_action( 'wp_head', array( $this, 'print_frontend_css' ) ); add_action( 'wp_footer', array( $this, 'print_frontend_js' ) ); add_action( 'admin_head', array( $this, 'print_admin_css' ) ); } /** * Print the saved frontend CSS. * * @return void */ public function print_frontend_css(): void { $css = $this->value( 'frontend_css' ); if ( '' === trim( $css ) ) { return; } echo "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- admin-authored CSS; tags stripped (as core does for "Additional CSS") so it can't close the \n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- admin-authored CSS; tags stripped, as above. } /** * Whether the feature is enabled. * * @return bool */ private function enabled(): bool { return (bool) aiou()->settings()->get_value( self::TAB, 'code', 'enabled', 0 ); } /** * A saved field's value. * * @param string $field_id Field id. * @return string */ private function value( string $field_id ): string { return (string) aiou()->settings()->get_value( self::TAB, 'code', $field_id, '' ); } }