# shopbuilder/1.1.3/app/Controllers/SupportController.php

ShopBuilder – WooCommerce Builder For Elementor, version 1.1.3. 98 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/1.1.3/code/app/Controllers/SupportController.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/1.1.3/raw/app/Controllers/SupportController.php
- Modified: 2023-07-06T10:18:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shopbuilder/1.1.3/code/app/Controllers/SupportController.php#L10-L20`.

```php
<?php

namespace RadiusTheme\SB\Controllers;

use RadiusTheme\SB\Helpers\BuilderFns;
use RadiusTheme\SB\Helpers\ElementorDataMap;
use RadiusTheme\SB\Helpers\Fns;
use RadiusTheme\SB\Traits\SingletonTrait;
use RadiusTheme\SB\Controllers\PluginsSupport;
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}

/**
 * Plugin Support
 */
class SupportController {
	/**
	 * SingletonTrait.
	 */
	use SingletonTrait;
	/**
	 * Construct function
	 */
	private function __construct() {
        add_action( 'init' , [ $this, 'plugins_support' ]);
        add_action( 'init' , [ $this, 'themes_support' ]);
		add_filter( 'woocommerce_locate_template',  [ $this, 'shipping_method_support' ], 10, 3 );
	}

	/**
	 * Theme Support
	 *
	 * @return void
	 */
	public function plugins_support() {
		// Check for plugin using plugin name.
		$active_plugin = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
		$supports      = [
			'woo-product-variation-gallery/woo-product-variation-gallery.php' => PluginsSupport\RtwpvgSupport::class,
			'woo-product-variation-swatches-pro/woo-product-variation-swatches-pro.php' => PluginsSupport\RtwpvsSupport::class,
		];
		foreach ( $supports as $active_path => $class ) {
			$is_active = in_array( $active_path, $active_plugin, true );
			if ( $is_active && class_exists( $class ) && method_exists( $class, 'instance' ) ) {
				$class::instance();
			}
		}
	}
	/**
	 * Theme Support
	 *
	 * @return void
	 */
	public function themes_support() {
        $themeClass        = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) );

        $supportClass = apply_filters( 'RadiusTheme/SB/ThemesSupport/Class', [
            'ThemesSupport' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $themeClass . '\\ThemeSupport',
            'TheTheme' => '\ThemeSupport',
        ] );

        foreach ( $supportClass as $key => $theClass) {
            $themeSupport = get_theme_file_path('/shopbuilder/ThemeSupport.php');
            if ('TheTheme' === $key && file_exists($themeSupport)) {
                require_once $themeSupport;
            }
            if ( class_exists( $theClass ) && method_exists( $theClass, 'instance' ) ) {
                $theClass::instance();
            }

        }
	}


	/**
	 * Theme Support
	 *
	 * @return void
	 */
	public function shipping_method_support( $template, $template_name, $template_path ) {
		if( 'checkout/review-order.php'  !== $template_name || ! BuilderFns::is_checkout() ) {
			return $template;
		}

		$id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' );
		$elmap = ElementorDataMap::instance();
		$get_widget = $elmap->get_widget_data('rtsb-shipping-method', [], $id);
		if( ! empty( $get_widget ) ){
			$template = Fns::locate_template( 'elementor/checkout/customized-order-review' );
		}

		return $template;
	}

}

```
