e-container">' . '
' . '' . '' . '' . '
' . '
' . '

' . esc_html( $notice['title'] ) . '

' . '

' . esc_html( $notice['message'] ) . '

' . ' ' . esc_html( $notice['link']['label'] ) . '' . '' . '' . '' . '
' . '' ); } } } /** * Add the deprecation notices to My Jetpack. * * @param array $slugs Already added bubbles. * * @return array */ public function add_my_jetpack_red_bubbles( $slugs ) { foreach ( $this->notices as $id => $notice ) { if ( $this->show_feature_notice( $id ) ) { $slugs[ $id ] = array( 'data' => array( 'text' => $notice['message'], 'title' => $notice['title'], 'link' => array( 'label' => esc_html( $notice['link']['label'] ), 'url' => Redirect::get_url( $notice['link']['url'] ), ), 'id' => $id, ), ); } } return $slugs; } /** * Render the notice. * * @param string $id The notice ID. * @param string $text The notice text. * * @return void */ private function render_notice( $id, $text ) { printf( '
%2$s
', esc_html( $id ), $text // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output already escaped in render_admin_notices ); } /** * Check if there are any notices to be displayed, so we wouldn't load unnecessary JS and run excessive hooks. * * @return bool */ private function has_notices() { foreach ( $this->notices as $id => $notice ) { if ( $this->show_feature_notice( $id ) ) { return true; } } return false; } /** * Check if the feature notice should be shown, based on the existence of the cookie. * * @param string $id The notice ID. * * @return bool */ private function show_feature_notice( $id ) { return empty( $_COOKIE['jetpack_deprecate_dismissed'][ $id ] ); } }