| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Shopkeeper Extender |
| 5 |
* Plugin URI: https://shopkeeper.getbowtied.com |
| 6 |
* Description: Extends the functionality of Shopkeeper with theme specific features. |
| 7 |
* Version: 10.0.6 |
| 8 |
* Author: Get Bowtied |
| 9 |
* Author URI: https://getbowtied.com |
| 10 |
* License: GPL v2 or later |
| 11 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 12 |
* Text Domain: shopkeeper-extender |
| 13 |
* Domain Path: /languages/ |
| 14 |
* Requires at least: 6.0 |
| 15 |
* Tested up to: 7.1 |
| 16 |
* |
| 17 |
* @package Shopkeeper Extender |
| 18 |
* @author GetBowtied |
| 19 |
*/ |
| 20 |
|
| 21 |
if ( ! defined( 'ABSPATH' ) ) { |
| 22 |
exit; |
| 23 |
} |
| 24 |
|
| 25 |
if ( ! class_exists( 'ShopkeeperExtender' ) ) : |
| 26 |
|
| 27 |
class ShopkeeperExtender { |
| 28 |
|
| 29 |
private static $instance = null; |
| 30 |
private static $initialized = false; |
| 31 |
|
| 32 |
private function __construct() { |
| 33 |
// Empty constructor - initialization happens in init_instance |
| 34 |
} |
| 35 |
|
| 36 |
private function init_instance() { |
| 37 |
if (self::$initialized) { |
| 38 |
return; |
| 39 |
} |
| 40 |
|
| 41 |
if ( ! function_exists( 'is_plugin_active' ) ) { |
| 42 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 43 |
} |
| 44 |
|
| 45 |
define( 'SK_EXT_ENQUEUE_SUFFIX', SCRIPT_DEBUG ? '' : '.min' ); |
| 46 |
|
| 47 |
$version = ( isset(get_plugin_data( __FILE__ )['Version']) && !empty(get_plugin_data( __FILE__ )['Version']) ) ? get_plugin_data( __FILE__ )['Version'] : '1.0'; |
| 48 |
define ( 'SK_EXT_VERSION', $version ); |
| 49 |
|
| 50 |
// Move existing constructor code here |
| 51 |
if( function_exists('shopkeeper_theme_slug') ) { |
| 52 |
// Helpers |
| 53 |
include_once( dirname( __FILE__ ) . '/includes/helpers/helpers.php' ); |
| 54 |
|
| 55 |
// Vendor |
| 56 |
include_once( dirname( __FILE__ ) . '/includes/vendor/enqueue.php' ); |
| 57 |
|
| 58 |
// Customizer |
| 59 |
include_once( dirname( __FILE__ ) . '/includes/customizer/repeater/class-sk-ext-repeater-control.php' ); |
| 60 |
|
| 61 |
// Shortcodes |
| 62 |
include_once( dirname( __FILE__ ) . '/includes/shortcodes/index.php' ); |
| 63 |
|
| 64 |
// Social Media |
| 65 |
include_once( dirname( __FILE__ ) . '/includes/social-media/class-social-media.php' ); |
| 66 |
|
| 67 |
// Widgets |
| 68 |
include_once( 'includes/widgets/social-media.php' ); |
| 69 |
|
| 70 |
//Custom Menu |
| 71 |
include_once( dirname( __FILE__ ) . '/includes/custom-menu/index.php' ); |
| 72 |
|
| 73 |
// Social Sharing Buttons |
| 74 |
if ( is_plugin_active( 'woocommerce/woocommerce.php') ) { |
| 75 |
include_once( dirname( __FILE__ ) . '/includes/social-sharing/class-social-sharing.php' ); |
| 76 |
} |
| 77 |
|
| 78 |
// Addons |
| 79 |
if ( is_plugin_active( 'woocommerce/woocommerce.php') ) { |
| 80 |
include_once( dirname( __FILE__ ) . '/includes/addons/class-wc-category-header-image.php' ); |
| 81 |
} |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
self::$initialized = true; |
| 86 |
} |
| 87 |
|
| 88 |
public static function get_instance() { |
| 89 |
return self::init(); |
| 90 |
} |
| 91 |
|
| 92 |
public static function init() { |
| 93 |
if (self::$instance === null) { |
| 94 |
self::$instance = new self(); |
| 95 |
self::$instance->init_instance(); |
| 96 |
} |
| 97 |
return self::$instance; |
| 98 |
} |
| 99 |
|
| 100 |
private function __clone() {} |
| 101 |
|
| 102 |
public function __wakeup() { |
| 103 |
throw new Exception("Cannot unserialize singleton"); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
endif; |
| 108 |
|
| 109 |
// Theme updater: newest library version among active companions wins on plugins_loaded. |
| 110 |
require_once dirname( __FILE__ ) . '/core/theme-updater/loader.php'; |
| 111 |
|
| 112 |
add_action( 'after_setup_theme', function() { |
| 113 |
ShopkeeperExtender::init(); |
| 114 |
} ); |
| 115 |
|