PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.0.0
ShopBuilder – WooCommerce Builder For Elementor v1.0.0
3.4.2 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 All 63 releases
← All changes | app/Controllers/SupportController.php +71 -112 3.4.21.0.0 View file →
@@ -1,112 +1,71 @@
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 -
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 - /**
25 - * Construct function
26 - */
27 - private function __construct() {
28 - add_action( 'init', [ $this, 'plugins_support' ], 9 );
29 - add_action( 'init', [ $this, 'themes_support' ], 9 );
30 - add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 2 );
31 - if ( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ) {
32 - $this->developer_support();
33 - }
34 - }
35 -
36 - /**
37 - * @return void
38 - */
39 - public function developer_support() {
40 - add_filter( 'rtsb/builder/preview/access', '__return_false', 5 );
41 - }
42 -
43 - /**
44 - * Theme Support
45 - *
46 - * @return void
47 - */
48 - public function plugins_support() {
49 - // Check for plugin using plugin name.
50 - $active_plugin = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
51 - $supports = [
52 - 'woo-address-book/woocommerce-address-book.php' => PluginsSupport\WooAddressBook::class,
53 - 'woo-product-variation-gallery/woo-product-variation-gallery.php' => PluginsSupport\RtwpvgSupport::class,
54 - 'woo-product-variation-swatches-pro/woo-product-variation-swatches-pro.php' => PluginsSupport\RtwpvsSupport::class,
55 - 'products-visibility-by-user-roles/addify_product_visibility.php' => PluginsSupport\AddifyVisibilityByRoles::class,
56 - 'woocommerce-payments/woocommerce-payments.php' => PluginsSupport\WooPaymentsSupport::class,
57 - 'woocommerce-paypal-payments/woocommerce-paypal-payments.php' => PluginsSupport\PayPalPPCPSupport::class,
58 - ];
59 - $supports = apply_filters( 'rtsb/plugins/support', $supports );
60 - foreach ( $supports as $active_path => $class ) {
61 - $is_active = in_array( $active_path, $active_plugin, true );
62 - if ( $is_active && class_exists( $class ) && method_exists( $class, 'instance' ) ) {
63 - $class::instance();
64 - }
65 - }
66 - }
67 - /**
68 - * Theme Support
69 - *
70 - * @return void
71 - */
72 - public function themes_support() {
73 - $themeClass = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) );
74 -
75 - $supportClass = apply_filters(
76 - 'RadiusTheme/SB/ThemesSupport/Class', // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
77 - [
78 - 'ThemesSupport' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $themeClass . '\\ThemeSupport',
79 - 'TheTheme' => '\ThemeSupport',
80 - ]
81 - );
82 -
83 - foreach ( $supportClass as $key => $theClass ) {
84 - $themeSupport = get_theme_file_path( '/shopbuilder/ThemeSupport.php' );
85 - if ( 'TheTheme' === $key && file_exists( $themeSupport ) ) {
86 - require_once $themeSupport;
87 - }
88 - if ( class_exists( $theClass ) && method_exists( $theClass, 'instance' ) ) {
89 - $theClass::instance();
90 - }
91 - }
92 - }
93 -
94 - /**
95 - * Filters and overrides the default WooCommerce template paths for specific templates
96 - * based on builder context and available Elementor widgets.
97 - *
98 - * - Replaces the checkout review order template if a custom widget is present.
99 - * - Replaces the single product description tab template if on a product page.
100 - *
101 - * @param string $template The path to the template to include.
102 - * @param string $template_name The name of the template.
103 - *
104 - * @return string Modified or original template path.
105 - */
106 - public function locate_template( $template, $template_name ) {
107 - if ( 'single-product/tabs/description.php' === $template_name && BuilderFns::is_product() ) {
108 - $template = Fns::locate_template( 'elementor/single-product/tab-description' );
109 - }
110 - return $template;
111 - }
112 -}
1 +<?php
2 +
3 +namespace RadiusTheme\SB\Controllers;
4 +
5 +use RadiusTheme\SB\Traits\SingletonTrait;
6 +use RadiusTheme\SB\Controllers\PluginsSupport;
7 +// Do not allow directly accessing this file.
8 +if ( ! defined( 'ABSPATH' ) ) {
9 + exit( 'This script cannot be accessed directly.' );
10 +}
11 +
12 +/**
13 + * Plugin Support
14 + */
15 +class SupportController {
16 + /**
17 + * SingletonTrait.
18 + */
19 + use SingletonTrait;
20 + /**
21 + * Construct function
22 + */
23 + private function __construct() {
24 + add_action( 'init' , [ $this, 'plugins_support' ]);
25 + add_action( 'init' , [ $this, 'themes_support' ]);
26 + }
27 +
28 + /**
29 + * Theme Support
30 + *
31 + * @return void
32 + */
33 + public function plugins_support() {
34 + // Check for plugin using plugin name.
35 + $active_plugin = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
36 + $supports = [
37 + 'woo-product-variation-gallery/woo-product-variation-gallery.php' => PluginsSupport\RtwpvgSupport::class,
38 + 'woo-product-variation-swatches-pro/woo-product-variation-swatches-pro.php' => PluginsSupport\RtwpvsSupport::class,
39 + ];
40 + foreach ( $supports as $active_path => $class ) {
41 + $is_active = in_array( $active_path, $active_plugin, true );
42 + if ( $is_active && class_exists( $class ) && method_exists( $class, 'instance' ) ) {
43 + $class::instance();
44 + }
45 + }
46 + }
47 + /**
48 + * Theme Support
49 + *
50 + * @return void
51 + */
52 + public function themes_support() {
53 + $themeClass = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) );
54 +
55 + $supportClass = apply_filters( 'RadiusTheme/SB/ThemesSupport/Class', [
56 + 'ThemesSupport' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $themeClass . '\\ThemeSupport',
57 + 'TheTheme' => '\ThemeSupport',
58 + ] );
59 +
60 + foreach ( $supportClass as $key => $theClass) {
61 + $themeSupport = get_theme_file_path('/shopbuilder/ThemeSupport.php');
62 + if ('TheTheme' === $key && file_exists($themeSupport)) {
63 + require_once $themeSupport;
64 + }
65 + if ( class_exists( $theClass ) && method_exists( $theClass, 'instance' ) ) {
66 + $theClass::instance();
67 + }
68 +
69 + }
70 + }
71 +}