PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.0.3
ShopBuilder – WooCommerce Builder For Elementor v2.0.3
3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.3.0 All 62 releases
shopbuilder / app / Controllers / SupportController.php

SupportController.php in ShopBuilder – WooCommerce Builder For Elementor 2.0.3, at app/Controllers/SupportController.php

101 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace RadiusTheme\SB\Controllers;
4
5 use RadiusTheme\SB\Helpers\BuilderFns;
6 use RadiusTheme\SB\Helpers\ElementorDataMap;
7 use RadiusTheme\SB\Helpers\Fns;
8 use RadiusTheme\SB\Traits\SingletonTrait;
9 use RadiusTheme\SB\Controllers\PluginsSupport;
10 // Do not allow directly accessing this file.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14
15 /**
16 * Plugin Support
17 */
18 class SupportController {
19 /**
20 * SingletonTrait.
21 */
22 use SingletonTrait;
23 /**
24 * Construct function
25 */
26 private function __construct() {
27 add_action( 'init', [ $this, 'plugins_support' ], 9 );
28 add_action( 'init', [ $this, 'themes_support' ], 9 );
29 add_filter( 'woocommerce_locate_template', [ $this, 'shipping_method_support' ], 10, 3 );
30
31 }
32
33 /**
34 * Theme Support
35 *
36 * @return void
37 */
38 public function plugins_support() {
39 // Check for plugin using plugin name.
40 $active_plugin = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
41 $supports = [
42 'woo-product-variation-gallery/woo-product-variation-gallery.php' => PluginsSupport\RtwpvgSupport::class,
43 'woo-product-variation-swatches-pro/woo-product-variation-swatches-pro.php' => PluginsSupport\RtwpvsSupport::class,
44 ];
45 foreach ( $supports as $active_path => $class ) {
46 $is_active = in_array( $active_path, $active_plugin, true );
47 if ( $is_active && class_exists( $class ) && method_exists( $class, 'instance' ) ) {
48 $class::instance();
49 }
50 }
51 }
52 /**
53 * Theme Support
54 *
55 * @return void
56 */
57 public function themes_support() {
58 $themeClass = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) );
59
60 $supportClass = apply_filters(
61 'RadiusTheme/SB/ThemesSupport/Class',
62 [
63 'ThemesSupport' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $themeClass . '\\ThemeSupport',
64 'TheTheme' => '\ThemeSupport',
65 ]
66 );
67
68 foreach ( $supportClass as $key => $theClass ) {
69 $themeSupport = get_theme_file_path( '/shopbuilder/ThemeSupport.php' );
70 if ( 'TheTheme' === $key && file_exists( $themeSupport ) ) {
71 require_once $themeSupport;
72 }
73 if ( class_exists( $theClass ) && method_exists( $theClass, 'instance' ) ) {
74 $theClass::instance();
75 }
76 }
77 }
78
79 /**
80 * Theme Support
81 *
82 * @return void
83 */
84 public function shipping_method_support( $template, $template_name, $template_path ) {
85 if ( 'checkout/review-order.php' !== $template_name || ! BuilderFns::is_checkout() ) {
86 return $template;
87 }
88
89 $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' );
90 $elmap = ElementorDataMap::instance();
91 $get_widget = $elmap->get_widget_data( 'rtsb-shipping-method', [], $id );
92 if ( ! empty( $get_widget ) ) {
93 $template = Fns::locate_template( 'elementor/checkout/customized-order-review' );
94 }
95
96 return $template;
97 }
98
99
100 }
101