PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.0
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 / conditionals / old-premium-ai-conditional.php

old-premium-ai-conditional.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.0, at src/conditionals/old-premium-ai-conditional.php

55 lines 1.3 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\Conditionals;
4
5 use Yoast\WP\SEO\Helpers\Product_Helper;
6
7 /**
8 * Conditional that is met when an older Yoast SEO Premium that predates the AI module restructure is active.
9 *
10 * Used to gate the legacy `src/ai-*` integrations and routes so they only run when an older Premium relies on them.
11 */
12 class Old_Premium_AI_Conditional implements Conditional {
13
14 /**
15 * The Premium version that ships with the new AI module structure.
16 *
17 * @var string
18 */
19 private const NEW_AI_STRUCTURE_PREMIUM_VERSION = '27.5-RC0';
20
21 /**
22 * Holds the Product_Helper.
23 *
24 * @var Product_Helper
25 */
26 private $product_helper;
27
28 /**
29 * Constructs Old_Premium_AI_Conditional.
30 *
31 * @param Product_Helper $product_helper The Product_Helper.
32 */
33 public function __construct( Product_Helper $product_helper ) {
34 $this->product_helper = $product_helper;
35 }
36
37 /**
38 * Returns whether the legacy AI code paths should load.
39 *
40 * @return bool `true` when Premium is active and predates the AI restructure.
41 */
42 public function is_met() {
43 if ( ! $this->product_helper->is_premium() ) {
44 return false;
45 }
46
47 $premium_version = $this->product_helper->get_premium_version();
48 if ( $premium_version === null ) {
49 return false;
50 }
51
52 return \version_compare( $premium_version, self::NEW_AI_STRUCTURE_PREMIUM_VERSION, '<' );
53 }
54 }
55