first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace DgoraWcas\Integrations\Themes\DFDRonneby;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class DFDRonneby extends ThemeIntegration {
public function __construct( $themeSlug, $themeName ) {
parent::__construct(
$themeSlug,
$themeName,
array(
'replaceSearchSuffix' => '<br><span style="color: red;">' . __( 'Note: We currently only support the header type: "Header 10"', 'ajax-search-for-woocommerce' ) . '</span>'
)
);
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace DgoraWcas\Integrations\Themes\Enfold;
use DgoraWcas\Abstracts\ThemeIntegration;
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Enfold extends ThemeIntegration {
public function extraFunctions() {
// Force enable overlay for mobile search
add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
return 'on';
} );
// Mark that the value of the option "mobile overlay" is forced
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[680]['disabled'] = true;
$settings[680]['label'] = Helpers::createOverrideTooltip( 'ovtt-storefront-mobile-overlay', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[680]['label'];
return $settings;
} );
// Change mobile breakpoint to 768
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_breakpoint', function () {
return 768;
} );
// Mark that the value of the option "mobile breakpoint" is forced
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[685]['disabled'] = true;
$settings[685]['label'] = Helpers::createOverrideTooltip( 'ovtt-storefront-breakpoint', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[685]['label'];
return $settings;
} );
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace DgoraWcas\Integrations\Themes;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class GenericTheme extends ThemeIntegration {
}

View File

@@ -0,0 +1,62 @@
<?php
namespace DgoraWcas\Integrations\Themes\Impreza;
use DgoraWcas\Abstracts\ThemeIntegration;
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Impreza extends ThemeIntegration {
public function init() {
add_filter( 'dgwt/wcas/settings', function ( $settings ) {
$articleLink = 'https://fibosearch.com/documentation/themes-integrations/impreza-theme/';
$articleText = sprintf( __( 'Here is <a href="%s" target="_blank">article</a> about how to do it using Impreza child-theme.', 'ajax-search-for-woocommerce' ), $articleLink );
if ( isset( $settings['dgwt_wcas_basic'][52]['desc'] ) ) {
$settings['dgwt_wcas_basic'][52]['desc'] .= '<br />' . $articleText;
}
return $settings;
}, 20 );
}
public function extraFunctions() {
add_filter( 'body_class', function ( $classes ) {
$classes[] = 'dgwt-wcas-theme-' . $this->themeSlug;
return $classes;
} );
// Force enable overlay for mobile search
add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
return 'on';
} );
// Mark that the value of the option "mobile overlay" is forced
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[680]['disabled'] = true;
$settings[680]['label'] = Helpers::createOverrideTooltip( 'ovtt-storefront-mobile-overlay', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[680]['label'];
return $settings;
} );
// Change mobile breakpoint to 768
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_breakpoint', function () {
return 899;
} );
// Mark that the value of the option "mobile breakpoint" is forced
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[685]['disabled'] = true;
$settings[685]['label'] = Helpers::createOverrideTooltip( 'ovtt-storefront-breakpoint', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[685]['label'];
return $settings;
} );
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace DgoraWcas\Integrations\Themes\OceanWP;
use DgoraWcas\Abstracts\ThemeIntegration;
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class OceanWP extends ThemeIntegration {
public function extraFunctions() {
// Force enable overlay for mobile search.
add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
return 'on';
} );
// Mark that the value of the option "mobile overlay" is forced.
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[680]['disabled'] = true;
$settings[680]['label'] = Helpers::createOverrideTooltip( 'ovtt-theme-mobile-overlay', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[680]['label'];
return $settings;
} );
// Change mobile breakpoint.
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_overlay_breakpoint', function () {
$mobile_menu_breakpoint = get_theme_mod( 'ocean_mobile_menu_breakpoints', '959' );
$mobile_menu_custom_breakpoint = get_theme_mod( 'ocean_mobile_menu_custom_breakpoint' );
if ( $mobile_menu_breakpoint === 'custom' && ! empty( $mobile_menu_custom_breakpoint ) ) {
$mobile_menu_breakpoint = $mobile_menu_custom_breakpoint;
}
return $mobile_menu_breakpoint;
} );
// Mark that the value of the option "mobile breakpoint" is forced.
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[685]['disabled'] = true;
$settings[685]['label'] = Helpers::createOverrideTooltip( 'ovtt-theme-breakpoint', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[685]['label'];
return $settings;
} );
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace DgoraWcas\Integrations\Themes\Restoration;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Restoration extends ThemeIntegration {
public function extraFunctions() {
add_filter( 'wc_get_template', function ( $template, $templateName ) {
if ( ! empty( $templateName ) && $templateName === 'product-searchform.php' ) {
$template = DGWT_WCAS_DIR . 'partials/themes/restoration-searchform.php';
}
return $template;
}, 10, 5 );
add_action( 'wp_head', function () { ?>
<style>
.thb-header-inline-search-inner .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
border: none;
background: transparent;
color: #fff;
text-align: center;
padding-right: 40px;
}
.thb-header-inline-search-inner .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:focus {
box-shadow: none;
}
.thb-header-inline-search-inner .dgwt-wcas-sf-wrapp .dgwt-wcas-ico-magnifier {
display: none;
}
.thb-header-inline-search-inner .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::placeholder {
opacity: 0.8 !important;
color: #fff;
}
</style>
<?php
} );
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace DgoraWcas\Integrations\Themes\Savoy;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Savoy extends ThemeIntegration {
public function extraFunctions() {
add_filter( 'wc_get_template', array( $this, 'getTemplate' ), 10, 5 );
add_filter( 'nm_header_default_links', array( $this, 'headerLinks' ) );
add_action( 'wp_footer', array( $this, 'overwriteMobileSearch' ), 100 );
}
/**
* Overwrite search template
*
* @return string
*/
public function getTemplate( $template, $template_name, $args, $template_path, $default_path ) {
if ( $template_name === 'product-searchform_nm.php' ) {
$template = DGWT_WCAS_DIR . 'partials/themes/savoy/product-searchform_nm.php';
}
return $template;
}
/**
* Replace search icon in header
*
* @return array
*/
public function headerLinks( $links ) {
if ( isset( $links['search'] ) ) {
$links['search'] = '<li class="nm-menu-search menu-item">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</li>';
}
return $links;
}
/**
* Overwrite search bar in mobile menu
*
* @return void
*/
public function overwriteMobileSearch() {
global $nm_globals;
if ( isset( $nm_globals['shop_search_header'] ) && $nm_globals['shop_search_header'] ) {
echo '<div id="wcas-savoy-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
(function ($) {
$(window).on('load', function () {
$('.nm-mobile-menu-item-search').replaceWith($('#wcas-savoy-mobile-search > div'));
});
}(jQuery));
</script>
<?php
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace DgoraWcas\Integrations\Themes\Shopkeeper;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Shopkeeper extends ThemeIntegration {
public function init() {
add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettingsExtra' ), 20 );
}
/**
* Add settings
*
* @param array $settings
*
* @return array
*/
public function registerSettingsExtra( $settings ) {
$key = 'dgwt_wcas_basic';
if ( class_exists( 'Shopkeeper_Opt' ) && ! \Shopkeeper_Opt::getOption( 'predictive_search', true ) ) {
$desc = '<p>' . __( 'To replace the search bar you have to enable the "Predictive Search" option in the Shopkeeper settings.', 'ajax-search-for-woocommerce' ) . '<p>';
$desc .= '<p>' . sprintf( __( 'Go to <code>Appearance -> <a target="_blank" href="%s">Customize</a> -> Header -> Search</code> and enable <code>Predictive Search</code>', 'ajax-search-for-woocommerce' ), admin_url( 'customize.php' ) ) . '<p>';
$settings[ $key ][58] = array(
'name' => 'shopkeeper_replace_search_info',
'label' => __( 'Warning!', 'ajax-search-for-woocommerce' ),
'desc' => $desc,
'type' => 'desc',
'class' => 'dgwt-wcas-sgs-themes-label',
);
}
return $settings;
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace DgoraWcas\Integrations\Themes\Storefront;
use DgoraWcas\Abstracts\ThemeIntegration;
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Storefront extends ThemeIntegration {
public function extraFunctions() {
// Force enabling the option "mobile overlay"
add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
return 'on';
} );
// Mark that the value of the option "mobile overlay" is forced
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[680]['disabled'] = true;
$settings[680]['label'] = Helpers::createOverrideTooltip( 'ovtt-storefront-mobile-overlay', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[680]['label'];
return $settings;
} );
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace DgoraWcas\Integrations\Themes\The7;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class The7 extends ThemeIntegration {
public function extraFunctions() {
add_action( 'wp_head', function () {
?>
<style>
.mini-widgets .dgwt-wcas-search-icon {
width: 17px;
margin-top: -2px;
}
.mini-widgets .dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow {
top: calc(100% + 5px);
}
</style>
<?php
} );
add_filter( 'presscore_template_manager_located_template', array( $this, 'changeTemplatePath' ), 10, 2 );
}
/**
* Change template path
*
* @param string $templateName
* @param array $templateNames
*/
public function changeTemplatePath( $templateName, $templateNames ) {
if ( strpos( $templateName, 'searchform.php' ) !== false ) {
$templateName = DGWT_WCAS_DIR . 'partials/themes/the7-searchform.php';
}
return $templateName;
}
}

View File

@@ -0,0 +1,125 @@
<?php
namespace DgoraWcas\Integrations\Themes\TheGem;
use DgoraWcas\Abstracts\ThemeIntegration;
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class TheGem extends ThemeIntegration {
public function extraFunctions() {
add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettingsExtra' ), 20 );
add_action( 'init', function () {
// Header Vertical
remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_search', 10, 2 );
add_filter( 'wp_nav_menu_items', array( $this, 'replaceSearchInMenu' ), 10, 2 );
// Header Fullwidth hamburger
remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_hamburger_widget', 100, 2 );
add_action( 'thegem_before_nav_menu', function () {
if ( in_array( thegem_get_option( 'header_layout' ), array( 'perspective', 'fullwidth_hamburger' ) ) ) {
echo do_shortcode( '[wcas-search-form]' );
}
} );
// Perspective header
remove_filter( 'get_search_form', 'thegem_serch_form_vertical_header' );
add_action( 'thegem_perspective_menu_buttons', function () {
echo do_shortcode( '[wcas-search-form]' );
} );
} );
add_filter( 'get_search_form', array( $this, 'removeSearchBarFromVerticalHeader' ), 100 );
add_action( 'thegem_before_header', array( $this, 'addSearchBarToVerticalHeader' ), 20 );
// Force enabling the option "mobile overlay"
add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
return 'on';
} );
// Mark that the value of the option "mobile overlay" is forced
add_filter( 'dgwt/wcas/settings/section=form', function ( $settings ) {
$settings[680]['disabled'] = true;
$settings[680]['label'] = Helpers::createOverrideTooltip( 'ovtt-storefront-mobile-overlay', Helpers::getOverrideOptionText( $this->themeName ) ) . $settings[680]['label'];
return $settings;
} );
}
/**
* Add settings
*
* @param array $settings
*
* @return array
*/
public function registerSettingsExtra( $settings ) {
// Remove overlay search from settings because enable mobile overlay will be forced
if ( $this->canReplaceSearch() ) {
unset( $settings['dgwt_wcas_form_body'][1300] );
unset( $settings['dgwt_wcas_form_body'][1400] );
}
return $settings;
}
/**
* Replace the search in main menu
*
* @param $items
* @param $args
*
* @return string
*/
public function replaceSearchInMenu( $items, $args ) {
if ( $args->theme_location == 'primary' && ! thegem_get_option( 'hide_search_icon' ) ) {
$items .= '<li class="menu-item menu-item-search dgwt-wcas-thegem-menu-search">';
$items .= '<a href="#"></a>';
$items .= '<div class="minisearch">';
$items .= do_shortcode( '[wcas-search-form]' );
$items .= '</div>';
$items .= '</li>';
}
return $items;
}
/**
* Remove the search bar from vertical header
*
* @param string $form
*
* @return string
*/
public function removeSearchBarFromVerticalHeader( $form ) {
if ( in_array( thegem_get_option( 'header_layout' ), array( 'fullwidth_hamburger', 'vertical' ) ) ) {
$form = '';
}
return $form;
}
/**
* Remove the search bar from vertical header
*
* @return void
*/
public function addSearchBarToVerticalHeader() {
if ( ! in_array( thegem_get_option( 'header_layout' ), array( 'vertical' ) ) ) {
return;
}
$html = '<div class="dgwt-wcas-thegem-vertical-search">';
$html .= do_shortcode( '[wcas-search-form]' );
$html .= '</div>';
echo $html;
}
}

View File

@@ -0,0 +1,479 @@
<?php
namespace DgoraWcas\Integrations\Themes;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class ThemesCompatibility {
private $themeSlug = '';
private $themeName = '';
private $parentThemeName = '';
private $theme = null;
private $supportActive = false;
public function __construct() {
$this->setCurrentTheme();
$this->loadCompatibilities();
}
private function setCurrentTheme() {
$theme = wp_get_theme();
if ( is_object( $theme ) && is_a( $theme, 'WP_Theme' ) ) {
$template = $theme->get_template();
$stylesheet = $theme->get_stylesheet();
$isChildTheme = $template !== $stylesheet;
$this->themeSlug = sanitize_title( $theme->Name );
if ( $isChildTheme ) {
$this->themeSlug = strtolower( $template );
}
$this->theme = $theme;
$this->themeName = $theme->name;
$this->parentThemeName = ! empty( $theme->parent_theme ) ? $theme->parent_theme : '';
}
$this->themeSlug = apply_filters( 'dgwt/wcas/integrations/themes/current_theme_slug', $this->themeSlug );
$this->themeName = apply_filters( 'dgwt/wcas/integrations/themes/current_theme_name', $this->themeName );
if ( $this->isChildTheme() ) {
$this->parentThemeName = apply_filters( 'dgwt/wcas/integrations/themes/current_parent_theme_name', $this->parentThemeName );
}
}
/**
* All supported themes
*
* @return array
*/
public function supportedThemes() {
return array(
'storefront' => array(
'slug' => 'storefront',
'name' => 'Storefront',
),
'flatsome' => array(
'slug' => 'flatsome',
'name' => 'Flatsome',
'args' => array(
'forceMobileOverlayBreakpoint' => 850,
'forceLayoutBreakpoint' => 850,
),
),
'astra' => array(
'slug' => 'astra',
'name' => 'Astra',
'args' => array(
'forceMobileOverlayBreakpoint' => true,
'forceLayoutBreakpoint' => true,
),
),
'thegem' => array(
'slug' => 'thegem',
'name' => 'TheGem',
),
'impreza' => array(
'slug' => 'impreza',
'name' => 'Impreza',
'args' => array(
'alwaysEnabled' => true,
),
),
'woodmart' => array(
'slug' => 'woodmart',
'name' => 'Woodmart',
),
'enfold' => array(
'slug' => 'enfold',
'name' => 'Enfold',
),
'shopkeeper' => array(
'slug' => 'shopkeeper',
'name' => 'Shopkeeper',
'args' => array(
'forceMobileOverlayBreakpoint' => 767,
'forceLayoutBreakpoint' => 767,
),
),
'the7' => array(
'slug' => 'the7',
'name' => 'The7',
),
'dt-the7' => array(
'slug' => 'dt-the7',
'name' => 'The7',
),
'avada' => array(
'slug' => 'avada',
'name' => 'Avada',
),
'shop-isle' => array(
'slug' => 'shop-isle',
'name' => 'Shop Isle',
),
'shopical' => array(
'slug' => 'shopical',
'name' => 'Shopical',
),
'shopical-pro' => array(
'slug' => 'shopical-pro',
'name' => 'ShopicalPro',
'args' => array(
'partialFilename' => 'shopical.php',
)
),
'ekommart' => array(
'slug' => 'ekommart',
'name' => 'Ekommart',
),
'savoy' => array(
'slug' => 'savoy',
'name' => 'Savoy',
),
'sober' => array(
'slug' => 'sober',
'name' => 'Sober',
),
'bridge' => array(
'slug' => 'bridge',
'name' => 'Bridge',
),
'divi' => array(
'slug' => 'divi',
'name' => 'Divi',
'args' => array(
'forceMobileOverlayBreakpoint' => 980,
'forceLayoutBreakpoint' => 980,
),
),
'block-shop' => array(
'slug' => 'block-shop',
'name' => 'BlockShop',
'args' => array(
'forceMobileOverlayBreakpoint' => 1200,
'forceLayoutBreakpoint' => 1200,
),
),
'dfd-ronneby' => array(
'slug' => 'dfd-ronneby',
'name' => 'DFDRonneby',
'args' => array(
'forceMobileOverlayBreakpoint' => 500,
'forceLayoutBreakpoint' => 500,
),
),
'restoration' => array(
'slug' => 'restoration',
'name' => 'Restoration',
),
'salient' => array(
'slug' => 'salient',
'name' => 'Salient',
'args' => array(
'forceMobileOverlayBreakpoint' => 1000,
'forceLayoutBreakpoint' => 1000,
),
),
'konte' => array(
'slug' => 'konte',
'name' => 'Konte',
'args' => array(
'forceMobileOverlayBreakpoint' => 1024,
'forceLayoutBreakpoint' => 1024,
),
),
'rehub-theme' => array(
'slug' => 'rehub-theme',
'name' => 'Rehub',
'args' => array(
'forceMobileOverlayBreakpoint' => 1200,
'forceLayoutBreakpoint' => 1200,
),
),
'supro' => array(
'slug' => 'supro',
'name' => 'Supro',
),
'open-shop' => array(
'slug' => 'open-shop',
'name' => 'OpenShop',
),
'ciyashop' => array(
'slug' => 'ciyashop',
'name' => 'CiyaShop',
),
'bigcart' => array(
'slug' => 'bigcart',
'name' => 'BigCart',
'args' => array(
'forceMobileOverlayBreakpoint' => 782,
'forceLayoutBreakpoint' => 782,
),
),
'top-store-pro' => array(
'slug' => 'top-store-pro',
'name' => 'TopStorePro',
),
'top-store' => array(
'slug' => 'top-store',
'name' => 'TopStore',
'args' => array(
'partialFilename' => 'top-store-pro.php',
)
),
'goya' => array(
'slug' => 'goya',
'name' => 'Goya',
),
'electro' => array(
'slug' => 'electro',
'name' => 'Electro',
),
'shopisle-pro' => array(
'slug' => 'shopisle-pro',
'name' => 'ShopIsle PRO',
'args' => array(
'partialFilename' => 'shop-isle.php',
)
),
'estore' => array(
'slug' => 'estore',
'name' => 'eStore',
),
'estore-pro' => array(
'slug' => 'estore-pro',
'name' => 'eStore Pro',
'args' => array(
'partialFilename' => 'estore.php',
)
),
'generatepress' => array(
'slug' => 'generatepress',
'name' => 'GeneratePress',
),
'open-shop-pro' => array(
'slug' => 'open-shop-pro',
'name' => 'Open Shop Pro',
'args' => array(
'partialFilename' => 'open-shop.php',
)
),
'uncode' => array(
'slug' => 'uncode',
'name' => 'Uncode',
'args' => array(
'forceMobileOverlayBreakpoint' => 960,
'forceLayoutBreakpoint' => 960,
),
),
'xstore' => array(
'slug' => 'xstore',
'name' => 'XStore',
),
'kadence' => array(
'slug' => 'kadence',
'name' => 'Kadence',
),
'thegem-elementor' => array(
'slug' => 'thegem-elementor',
'name' => 'TheGem (Elementor)',
),
'thegem-wpbakery' => array(
'slug' => 'thegem-wpbakery',
'name' => 'TheGem (WPBakery)',
'args' => array(
'partialFilename' => 'thegem-elementor.php',
)
),
'neve' => array(
'slug' => 'neve',
'name' => 'Neve',
),
'woostify' => array(
'slug' => 'woostify',
'name' => 'Woostify',
),
'oceanwp' => array(
'slug' => 'oceanwp',
'name' => 'OceanWP',
),
'webshop' => array(
'slug' => 'webshop',
'name' => 'WebShop',
'args' => array(
'forceMobileOverlay' => true,
'forceMobileOverlayBreakpoint' => 767,
),
),
'essentials' => array(
'slug' => 'essentials',
'name' => 'Essentials',
'args' => array(
'forceMobileOverlay' => true,
'forceMobileOverlayBreakpoint' => 991,
)
),
'blocksy' => array(
'slug' => 'blocksy',
'name' => 'Blocksy',
'args' => array(
'forceMobileOverlay' => true,
'forceMobileOverlayBreakpoint' => 689,
),
),
'qwery' => array(
'slug' => 'qwery',
'name' => 'Qwery',
'args' => array(
'forceMobileOverlay' => true,
'forceMobileOverlayBreakpoint' => 767,
),
),
'storebiz' => array(
'slug' => 'storebiz',
'name' => 'StoreBiz',
'args' => array(
'forceMobileOverlay' => true,
'forceMobileOverlayBreakpoint' => 767,
),
),
'minimog' => array(
'slug' => 'minimog',
'name' => 'Minimog',
),
'total' => array(
'slug' => 'total',
'name' => 'Total',
'args' => array(
'forceMobileOverlay' => true,
'forceMobileOverlayBreakpoint' => 959,
),
),
'bricks' => array(
'slug' => 'bricks',
'name' => 'Bricks',
'args' => array(
'alwaysEnabled' => true,
),
),
);
}
/**
* Load class with compatibilities logic for current theme
*
* @return void
*/
private function loadCompatibilities() {
foreach ( $this->supportedThemes() as $theme ) {
if ( $theme['slug'] === $this->themeSlug ) {
$this->supportActive = true;
$class = '\\DgoraWcas\\Integrations\\Themes\\';
if ( isset( $theme['className'] ) ) {
$class .= $theme['className'] . '\\' . $theme['className'];
} else {
$class .= $theme['name'] . '\\' . $theme['name'];
}
$args = isset( $theme['args'] ) && is_array( $theme['args'] ) ? $theme['args'] : array();
if ( $this->isWhiteLabel() ) {
$args['whiteLabel'] = true;
}
if ( class_exists( $class ) ) {
new $class( $this->themeSlug, $this->themeName, $args );
} else {
new GenericTheme( $this->themeSlug, $this->themeName, $args );
}
break;
}
}
}
/**
* Check if current theme is supported
*
* @return bool
*/
public function isCurrentThemeSupported() {
return $this->supportActive;
}
/**
* Get current theme info
*
* @return null|object
*/
public function getTheme() {
return $this->theme;
}
/**
* Get the name of the current theme
*
* @return string
*/
public function getThemeName() {
return ! empty( $this->themeName ) && is_string( $this->themeName ) ? $this->themeName : '';
}
/**
* Check if the current them is child theme
*
* @return bool
*/
public function isChildTheme() {
return ! empty( $this->parentThemeName );
}
/**
* Check if the integration is under white label
*
* @return bool
*/
public function isWhiteLabel() {
return apply_filters( 'dgwt/wcas/integrations/themes/white_label', false );
}
/**
* Get the name of the current parent theme
*
* @return string
*/
public function getParentThemeName() {
return ! empty( $this->parentThemeName ) ? $this->parentThemeName : '';
}
/**
* Get current theme image src
*
* @return string
*/
public function getThemeImageSrc() {
$src = '';
if ( ! empty( $this->theme ) ) {
foreach ( array( 'png', 'jpg' ) as $ext ) {
if ( empty( $src ) && file_exists( $this->theme->get_template_directory() . '/screenshot.' . $ext ) ) {
$src = $this->theme->get_template_directory_uri() . '/screenshot.' . $ext;
break;
}
}
}
return ! empty( $src ) ? esc_url( $src ) : '';
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace DgoraWcas\Integrations\Themes\Woodmart;
use DgoraWcas\Abstracts\ThemeIntegration;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Woodmart extends ThemeIntegration {
public function extraFunctions() {
add_filter( 'woodmart_shop_page_link', array( $this, 'shop_page_link' ), 10, 3 );
}
/**
* Add to the address of the shop a parameter informing that the search is done by our plugin
*
* @param string $link
* @param boolean $keep_query
* @param string $taxonomy
*
* @return string
*/
public function shop_page_link( $link, $keep_query, $taxonomy ) {
if ( $keep_query && isset( $_GET['dgwt_wcas'] ) ) {
$link = add_query_arg( 'dgwt_wcas', '1', $link );
}
return $link;
}
}