PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.3
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 / editors / framework / integrations / woocommerce.php

woocommerce.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.3, at src/editors/framework/integrations/woocommerce.php

57 lines 1.6 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 -- This namespace should reflect the namespace of the original class.
4 namespace Yoast\WP\SEO\Editors\Framework\Integrations;
5
6 use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
7 use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
8
9 /**
10 * Describes if the Woocommerce plugin is enabled.
11 */
12 class WooCommerce implements Integration_Data_Provider_Interface {
13
14 /**
15 * The WooCommerce conditional.
16 *
17 * @var WooCommerce_Conditional
18 */
19 private $woocommerce_conditional;
20
21 /**
22 * The constructor.
23 *
24 * @param WooCommerce_Conditional $woocommerce_conditional The WooCommerce conditional.
25 */
26 public function __construct( WooCommerce_Conditional $woocommerce_conditional ) {
27 $this->woocommerce_conditional = $woocommerce_conditional;
28 }
29
30 /**
31 * If the plugin is activated.
32 *
33 * @return bool If the plugin is activated.
34 */
35 public function is_enabled(): bool {
36 return $this->woocommerce_conditional->is_met();
37 }
38
39 /**
40 * Return this object represented by a key value array.
41 *
42 * @return array<string, bool> Returns the name and if the feature is enabled.
43 */
44 public function to_array(): array {
45 return [ 'isWooCommerceActive' => $this->is_enabled() ];
46 }
47
48 /**
49 * Returns this object represented by a key value structure that is compliant with the script data array.
50 *
51 * @return array<string, bool> Returns the legacy key and if the feature is enabled.
52 */
53 public function to_legacy_array(): array {
54 return [ 'isWooCommerceActive' => $this->is_enabled() ];
55 }
56 }
57