catalog-booster-for-woocommerce
Last commit date
css
2 years ago
functions
2 years ago
img
5 years ago
includes
9 months ago
lang
2 years ago
index.php
2 years ago
license.txt
2 years ago
readme.txt
2 weeks ago
woocommerce-catalog-booster.php
9 months ago
woocommerce-catalog-booster.php
110 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Plugin Name: Catalog Booster & Product Catalog Mode for WooCommerce |
| 5 | * Plugin URI: https://implecode.com |
| 6 | * Description: Switch WooCommerce into product catalog and/or customize the view for your purpose. |
| 7 | * Version: 1.2.8 |
| 8 | * Author: impleCode |
| 9 | * Author URI: https://implecode.com |
| 10 | * Text Domain: catalog-booster-for-woocommerce |
| 11 | * Domain Path: /lang/ |
| 12 | * WC requires at least: 3.0.0 |
| 13 | * WC tested up to: 10.1.2 |
| 14 | * |
| 15 | * Copyright: 2025 impleCode. |
| 16 | */ |
| 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | exit; // Exit if accessed directly |
| 19 | } |
| 20 | define( 'IC_WOOCAT_BASE_URL', plugins_url( '/', __FILE__ ) ); |
| 21 | define( 'IC_WOOCAT_BASE_PATH', dirname( __FILE__ ) ); |
| 22 | define( 'IC_WOOCAT_MAIN_FILE', __FILE__ ); |
| 23 | |
| 24 | add_action( 'after_setup_theme', 'start_ic_woocat' ); |
| 25 | |
| 26 | function start_ic_woocat() { |
| 27 | load_plugin_textdomain( 'catalog-booster-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); |
| 28 | if ( ic_is_woocommerce_active() ) { |
| 29 | require_once( IC_WOOCAT_BASE_PATH . '/includes/index.php' ); |
| 30 | } else { |
| 31 | require_once( IC_WOOCAT_BASE_PATH . '/functions/compatibility.php' ); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | //add_filter( 'is_ic_shortcode_integration', 'ic_disable_shortcode_integration' ); |
| 36 | |
| 37 | function ic_disable_shortcode_integration( $return ) { |
| 38 | if ( ic_is_woocommerce_active() ) { |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | return $return; |
| 43 | } |
| 44 | |
| 45 | add_action( 'admin_init', 'ic_woocat_register_admin_styles' ); |
| 46 | |
| 47 | /** |
| 48 | * Registers plugins stylesheets |
| 49 | * |
| 50 | */ |
| 51 | function ic_woocat_register_admin_styles() { |
| 52 | wp_register_style( 'ic_woocat_admin', IC_WOOCAT_BASE_URL . 'css/woocat-admin.min.css' . ic_filemtime( IC_WOOCAT_BASE_PATH . '/css/woocat-admin.min.css' ) ); |
| 53 | } |
| 54 | |
| 55 | add_action( 'admin_enqueue_scripts', 'ic_woocat_enqueue_admin_styles' ); |
| 56 | |
| 57 | /** |
| 58 | * Enqueues plugins stylesheets |
| 59 | * |
| 60 | */ |
| 61 | function ic_woocat_enqueue_admin_styles() { |
| 62 | if ( isset( $_GET['page'] ) && $_GET['page'] == 'ic-catalog-mode' ) { |
| 63 | wp_enqueue_style( 'ic_woocat_admin' ); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | register_activation_hook( __FILE__, 'IC_WOOCAT_install' ); |
| 68 | |
| 69 | if ( ! function_exists( 'IC_WOOCAT_install' ) ) { |
| 70 | |
| 71 | function IC_WOOCAT_install() { |
| 72 | require_once( IC_WOOCAT_BASE_PATH . '/includes/woocat_settings.php' ); |
| 73 | require_once( IC_WOOCAT_BASE_PATH . '/functions/activation.php' ); |
| 74 | ic_woocat_activation(); |
| 75 | } |
| 76 | |
| 77 | } |
| 78 | if ( ! function_exists( 'ic_is_woocommerce_active' ) ) { |
| 79 | |
| 80 | function ic_is_woocommerce_active() { |
| 81 | /* |
| 82 | $plugin_file = 'woocommerce/woocommerce.php'; |
| 83 | if ( !is_multisite() ) { |
| 84 | if ( in_array( $plugin_file, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 85 | return true; |
| 86 | } |
| 87 | } else { |
| 88 | $plugins = get_site_option( 'active_sitewide_plugins' ); |
| 89 | if ( isset( $plugins[ $plugin_file ] ) ) { |
| 90 | return true; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | return false; |
| 95 | * |
| 96 | */ |
| 97 | if ( class_exists( 'woocommerce' ) ) { |
| 98 | return true; |
| 99 | } else { |
| 100 | return false; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | } |
| 105 | |
| 106 | add_action( 'before_woocommerce_init', function () { |
| 107 | if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
| 108 | \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); |
| 109 | } |
| 110 | } ); |