PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.8
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.8
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 / initializers / silence-load-textdomain-just-in-time-notices.php

silence-load-textdomain-just-in-time-notices.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.8, at src/initializers/silence-load-textdomain-just-in-time-notices.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Initializers;
4
5 use Yoast\WP\SEO\Conditionals\WP_Tests_Conditional;
6
7 /**
8 * Silences load_textdomain_just_in_time issues when running WP tests.
9 *
10 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
11 */
12 class Silence_Load_Textdomain_Just_In_Time_Notices implements Initializer_Interface {
13
14 /**
15 * Returns the conditionals based in which this loadable should be active.
16 *
17 * @return array<string> The array of conditionals.
18 */
19 public static function get_conditionals() {
20 return [ WP_Tests_Conditional::class ];
21 }
22
23 /**
24 * Hooks our required hooks.
25 *
26 * @return void
27 */
28 public function initialize() {
29 \add_filter( 'doing_it_wrong_trigger_error', [ $this, 'silence_textdomain_notices' ], 10, 2 );
30 }
31
32 /**
33 * Silences textdomain notices.
34 *
35 * @param bool $trigger Whether to trigger the error. Default true.
36 * @param string $function_name The function name that triggered the error.
37 *
38 * @return bool
39 */
40 public function silence_textdomain_notices( $trigger, $function_name ) {
41 if ( $function_name === '_load_textdomain_just_in_time' ) {
42 // Silence the notice.
43 return false;
44 }
45
46 return $trigger;
47 }
48 }
49