PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / llms-txt / application / file / file-failure-notification-presenter.php

file-failure-notification-presenter.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.5, at src/llms-txt/application/file/file-failure-notification-presenter.php

60 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4 namespace Yoast\WP\SEO\Llms_Txt\Application\File;
5
6 use WPSEO_Shortlinker;
7 use Yoast\WP\SEO\Llms_Txt\Application\File\Commands\Populate_File_Command_Handler;
8 use Yoast\WP\SEO\Presenters\Abstract_Presenter;
9
10 /**
11 * Class File_Failure_Notification_Presenter.
12 */
13 class File_Failure_Notification_Presenter extends Abstract_Presenter {
14
15 /**
16 * Returns the notification as an HTML string.
17 *
18 * @return string The notification in an HTML string representation.
19 */
20 public function present() {
21 $notification_text = '<p>';
22 $notification_text .= $this->get_message();
23 $notification_text .= '</p>';
24
25 return $notification_text;
26 }
27
28 /**
29 * Returns the message to show.
30 *
31 * @return string The message.
32 */
33 protected function get_message() {
34 $reason = \get_option( Populate_File_Command_Handler::GENERATION_FAILURE_OPTION, false );
35 switch ( $reason ) {
36 case 'not_managed_by_yoast_seo':
37 $message = \sprintf(
38 /* translators: 1: Link start tag to the WordPress Reading Settings page, 2: Link closing tag. */
39 \esc_html__( 'An existing llms.txt file wasn\'t created by Yoast or has been edited manually. Yoast won\'t overwrite it. %1$sDelete it manually%2$s or turn off this feature.', 'wordpress-seo' ),
40 '<a href="' . \esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/llms-txt-file-deletion' ) ) . '" target="_blank" rel="noopener noreferrer">',
41 '</a>',
42 );
43 break;
44 case 'filesystem_permissions':
45 $message =
46 \__( 'You have activated the Yoast llms.txt feature, but we couldn\'t generate an llms.txt file. It looks like there aren\'t sufficient permissions on the web server\'s filesystem.', 'wordpress-seo' );
47 break;
48 default:
49 $message = \__( 'You have activated the Yoast llms.txt feature, but we couldn\'t generate an llms.txt file, for unknown reasons.', 'wordpress-seo' );
50 break;
51 }
52
53 return \sprintf(
54 '<strong>%1$s</strong> %2$s',
55 \esc_html__( 'Your llms.txt file couldn\'t be auto-generated', 'wordpress-seo' ),
56 $message,
57 );
58 }
59 }
60