); $this->options->set( 'show_new_content_type_notification', true ); $this->maybe_add_notification(); } /** * Update db when a post type is made removed. * * @param array $newly_made_non_public_taxonomies The newly made non public post types. * @return void */ public function clean_new_public_taxonomy( $newly_made_non_public_taxonomies ) { // See if post types that needs review were removed and update option. $needs_review = $this->options->get( 'new_taxonomies', [] ); $new_needs_review = \array_diff( $needs_review, $newly_made_non_public_taxonomies ); if ( \count( $new_needs_review ) !== \count( $needs_review ) ) { $this->options->set( 'new_taxonomies', $new_needs_review ); $this->content_type_dismiss_notifications->maybe_dismiss_notifications(); } } /** * Decides if a notification should be added in the notification center. * * @return void */ public function maybe_add_notification() { $notification = $this->notification_center->get_notification_by_id( 'content-types-made-public' ); if ( \is_null( $notification ) ) { $this->add_notification(); } } /** * Adds a notification to be shown on the next page request since posts are updated in an ajax request. * * @return void */ private function add_notification() { $message = \sprintf( /* translators: 1: Opening tag of the link to the Search appearance settings page, 2: Link closing tag. */ \esc_html__( 'You\'ve added a new type of content. We recommend that you review the corresponding %1$sSearch appearance settings%2$s.', 'wordpress-seo' ), '', '' ); $notification = new Yoast_Notification( $message, [ 'type' => Yoast_Notification::WARNING, 'id' => 'content-types-made-public', 'capabilities' => 'wpseo_manage_options', 'priority' => 0.8, ] ); $this->notification_center->add_notification( $notification ); } } Archives des En vedette - SOUTRAMARKET