PluginProbe
Tiered Pricing Table for WooCommerce / 6.1.0
Tiered Pricing Table for WooCommerce v6.1.0
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Integrations / Plugins / Yoast / Yoast.php

Yoast.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Integrations/Plugins/Yoast/Yoast.php

63 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 namespace TierPricingTable\Integrations\Plugins\Yoast;
4
5 use TierPricingTable\Integrations\Plugins\PluginIntegrationAbstract;
6 use TierPricingTable\Managers\FormatPriceManager;
7 use TierPricingTable\PriceManager;
8 use TierPricingTable\TierPricingTablePlugin;
9 use WC_Product;
10 class Yoast extends PluginIntegrationAbstract {
11 protected $product = null;
12
13 public function getTitle() : string {
14 return 'Yoast SEO';
15 }
16
17 public function getDescription() : string {
18 return __( 'Adds <b>%%lowest_price%%</b> and <b>%%price_range%%</b> variables to display the lowest and price range of products with tiered pricing.', 'tier-pricing-table' );
19 }
20
21 public function getSlug() : string {
22 return 'yoast-seo';
23 }
24
25 public function run() {
26 add_action( 'plugins_loaded', function () {
27 if ( !class_exists( 'WPSEO_Options' ) ) {
28 return;
29 }
30 add_filter( 'tiered_pricing_table/settings/sections', function ( $sections ) {
31 $sections[] = new Settings();
32 return $sections;
33 } );
34 } );
35 }
36
37 public function getIntegrationCategory() : string {
38 return 'seo';
39 }
40
41 public function getIconURL() : ?string {
42 return $this->getContainer()->getFileManager()->locateAsset( 'admin/integrations/yoast-icon.gif' );
43 }
44
45 public function get_product() {
46 if ( !is_null( $this->product ) ) {
47 return $this->product;
48 }
49 $product_id = get_queried_object_id();
50 $this->product = ( !function_exists( 'wc_get_product' ) || !$product_id || !is_admin() && !is_singular( 'product' ) ? null : wc_get_product( $product_id ) );
51 return $this->product;
52 }
53
54 public function isVariablesEnabled() : bool {
55 return $this->getContainer()->getSettings()->get( 'yoast_enable_variables', 'yes' ) === 'yes';
56 }
57
58 public function isEnhancedSchemaEnabled() : bool {
59 return $this->getContainer()->getSettings()->get( 'yoast_enhance_schema', 'no' ) === 'yes';
60 }
61
62 }
63