notification_id ) { WPSEO_Options::set( 'is-media-purge-relevant', false ); } } /** * Adds a hidden setting to the media tab. * * To make sure the setting is not reverted to the default when -anything- * is saved on the entire page (not just the media tab). * * @param string|null $input Current filter value. * * @return string|null */ public function output_hidden_setting( $input ) { $form = Yoast_Form::get_instance(); $form->hidden( 'is-media-purge-relevant' ); return $input; } /** * Manages if the notification should be shown or removed. * * @return void */ public function manage_notification() { $this->remove_notification(); } /** * Retrieves the notification that should be shown or removed. * * @return Yoast_Notification The notification to use. */ private function get_notification() { $content = sprintf( /* translators: %1$s expands to the link to the article, %2$s closes the link tag. */ __( 'Your site\'s settings currently allow attachment URLs on your site to exist. Please read %1$sthis post about a potential issue%2$s with attachment URLs and check whether you have the correct setting for your site.', 'wordpress-seo' ), '', '' ); $content .= '

'; $content .= sprintf( /* translators: %1$s dismiss link open tag, %2$s closes the link tag. */ __( 'If you know what this means and you do not want to see this message anymore, you can %1$sdismiss this message%2$s.', 'wordpress-seo' ), '', '' ); return new Yoast_Notification( $content, array( 'type' => Yoast_Notification::ERROR, 'id' => $this->notification_id, 'capabilities' => 'wpseo_manage_options', 'priority' => 1, ) ); } /** * Adds the notification to the notificaton center. * * @return void */ private function add_notification() { $notification_center = Yoast_Notification_Center::get(); $notification_center->add_notification( $this->get_notification() ); } /** * Removes the notification from the notification center. * * @return void */ private function remove_notification() { $notification_center = Yoast_Notification_Center::get(); $notification_center->remove_notification( $this->get_notification() ); } }