| @@ -614,9 +614,16 @@ | ||
| 614 | 614 | // Register hreflang / language alternates meta (JSON-encoded array). |
| 615 | 615 | // Gated on the Language Alternates feature flag: when the feature is |
| 616 | 616 | // disabled the meta is not registered for REST, so the Gutenberg panel |
| 617 | 617 | // has nothing to bind to. Saved values are kept regardless. |
| 618 | - if (class_exists('Metasync_Feature_Flags') && Metasync_Feature_Flags::is_enabled(Metasync_Feature_Flags::LANGUAGE_ALTERNATES)) { | |
| 618 | + // | |
| 619 | + // defined() rather than class_exists(): during the upgrade window a | |
| 620 | + // stale opcache copy of Metasync_Feature_Flags satisfies | |
| 621 | + // class_exists() while lacking a newly added constant, and reading | |
| 622 | + // LANGUAGE_ALTERNATES off it is a fatal. defined() checks the | |
| 623 | + // constant itself, which is the thing this line actually needs. | |
| 624 | + // @phpstan-ignore-next-line function.alreadyNarrowedType | |
| 625 | + if (defined('Metasync_Feature_Flags::LANGUAGE_ALTERNATES') && Metasync_Feature_Flags::is_enabled(Metasync_Feature_Flags::LANGUAGE_ALTERNATES)) { | |
| 619 | 626 | register_post_meta($post_type, self::META_HREFLANG, array( |
| 620 | 627 | 'show_in_rest' => true, |
| 621 | 628 | 'single' => true, |
| 622 | 629 | 'type' => 'string', |
| @@ -832,9 +839,9 @@ | ||
| 832 | 839 | } |
| 833 | 840 | |
| 834 | 841 | // Get current post ID (used for the LPS/custom-page check and WPML |
| 835 | 842 | // entries below) |
| 836 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : 0; | |
| 843 | + $post_id = isset($_GET['post']) ? intval($_GET['post']) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only post ID for editor script data | |
| 837 | 844 | |
| 838 | 845 | // LPS / custom-HTML pages bake their own SEO — suppress the editable sidebar |
| 839 | 846 | // panels and surface a read-only notice instead. |
| 840 | 847 | // otto_pixel.php (where metasync_is_custom_or_lps_page lives) is only |
| @@ -843,9 +850,14 @@ | ||
| 843 | 850 | |
| 844 | 851 | // Auto-detected WPML entries for the "Language Alternates" panel. |
| 845 | 852 | // Gated on the feature flag: when disabled the panel is hidden, so the |
| 846 | 853 | // entries are zeroed to avoid seeding data the UI cannot bind to. |
| 847 | - $language_alternates_enabled = class_exists('Metasync_Feature_Flags') | |
| 854 | + // | |
| 855 | + // defined() rather than class_exists(): see register_post_meta() above — | |
| 856 | + // a stale opcache copy of the class passes class_exists() but has no | |
| 857 | + // LANGUAGE_ALTERNATES constant, and reading it is a fatal. | |
| 858 | + // @phpstan-ignore-next-line function.alreadyNarrowedType | |
| 859 | + $language_alternates_enabled = defined('Metasync_Feature_Flags::LANGUAGE_ALTERNATES') | |
| 848 | 860 | && Metasync_Feature_Flags::is_enabled(Metasync_Feature_Flags::LANGUAGE_ALTERNATES); |
| 849 | 861 | $wpml_entries = $language_alternates_enabled |
| 850 | 862 | ? $this->get_wpml_entries_for_post($post_id) |
| 851 | 863 | : array(); |
| @@ -971,8 +983,9 @@ | ||
| 971 | 983 | 'serpMobile' => __('Mobile', 'metasync'), |
| 972 | 984 | 'characters' => __('characters', 'metasync'), |
| 973 | 985 | 'primaryCategoryNote' => __('Assign 2+ categories to enable this option.', 'metasync'), |
| 974 | 986 | 'ottoPrefillHelp' => sprintf( |
| 987 | + /* translators: %s: OTTO name (whitelabel). */ | |
| 975 | 988 | __('Pre-filled from %s. Edit to customize.', 'metasync'), |
| 976 | 989 | $otto_name |
| 977 | 990 | ), |
| 978 | 991 | 'importedPrefillHelp' => sprintf( |
| @@ -993,9 +1006,10 @@ | ||
| 993 | 1006 | 'primaryCategoryLabel' => __('Primary Category', 'metasync'), |
| 994 | 1007 | 'primaryCategoryHelp' => __('Select which category appears in the breadcrumb path when this post belongs to multiple categories.', 'metasync'), |
| 995 | 1008 | /* translators: %s: OTTO name (whitelabel) */ |
| 996 | 1009 | 'ottoOverrideNotice' => sprintf( |
| 997 | - __('%s is enabled. Any SEO title and description changes from %s will be overwritten by your custom values entered here.', 'metasync'), | |
| 1010 | + /* translators: 1: OTTO name (whitelabel), 2: OTTO name (whitelabel). */ | |
| 1011 | + __('%1$s is enabled. Any SEO title and description changes from %2$s will be overwritten by your custom values entered here.', 'metasync'), | |
| 998 | 1012 | $otto_name, |
| 999 | 1013 | $otto_name |
| 1000 | 1014 | ), |
| 1001 | 1015 | // Language Alternates (hreflang) panel strings |