2323 */
2424// If this file is called directly, abort.
2525if ( !defined ( 'WPINC ' ) ) {
26- die;
26+ die;
27+ }
28+
29+ if ( !function_exists ( 'woo_is_plugin_active ' ) ) {
30+ function woo_is_plugin_active ( ) {
31+ return in_array ( 'woocommerce/woocommerce.php ' , ( array ) get_option ( 'active_plugins ' , array () ) ) || is_plugin_active_for_network ( 'woocommerce/woocommerce.php ' );
32+ }
2733}
2834
2935/* Check if WooCommerce is active */
30- if ( is_plugin_active ( ' woocommerce/woocommerce.php ' ) ){
31- /*
32- * Load library for simple and fast creation of Taxonomy
33- */
34-
35- require_once ( plugin_dir_path ( __FILE__ ) . 'includes/Taxonomy_Core/Taxonomy_Core.php ' );
36-
37- require_once ( plugin_dir_path ( __FILE__ ) . 'includes/Widgets-Helper/wph-widget-class.php ' );
38- require_once ( plugin_dir_path ( __FILE__ ) . 'includes/widgets/wc_tax.php ' );
39-
40- require_once ( plugin_dir_path ( __FILE__ ) . 'public/class-woo-taxonomy-report.php ' );
41- /*
42- * - 9999 is used for load the plugin as last for resolve some
43- * problems when the plugin use API of other plugins, remove
44- * if you don' want this
45- */
46-
47- add_action ( 'plugins_loaded ' , array ( 'Woo_Taxonomy_Report ' , 'get_instance ' ), 9999 );
48-
49- /*
50- * -----------------------------------------------------------------------------
51- * Dashboard and Administrative Functionality
52- * -----------------------------------------------------------------------------
53- */
54-
55- if ( is_admin () && (!defined ( 'DOING_AJAX ' ) || !DOING_AJAX ) ) {
56- require_once ( plugin_dir_path ( __FILE__ ) . 'admin/class-woo-taxonomy-report-admin.php ' );
57- add_action ( 'plugins_loaded ' , array ( 'Woo_Taxonomy_Report_Admin ' , 'get_instance ' ) );
58- }
36+ if ( woo_is_plugin_active ( ) ) {
37+ /*
38+ * Load library for simple and fast creation of Taxonomy
39+ */
40+
41+ require_once ( plugin_dir_path ( __FILE__ ) . 'includes/Taxonomy_Core/Taxonomy_Core.php ' );
42+
43+ require_once ( plugin_dir_path ( __FILE__ ) . 'includes/Widgets-Helper/wph-widget-class.php ' );
44+ require_once ( plugin_dir_path ( __FILE__ ) . 'includes/widgets/wc_tax.php ' );
45+
46+ require_once ( plugin_dir_path ( __FILE__ ) . 'public/class-woo-taxonomy-report.php ' );
47+ /*
48+ * - 9999 is used for load the plugin as last for resolve some
49+ * problems when the plugin use API of other plugins, remove
50+ * if you don' want this
51+ */
52+
53+ add_action ( 'plugins_loaded ' , array ( 'Woo_Taxonomy_Report ' , 'get_instance ' ), 9999 );
54+
55+ /*
56+ * -----------------------------------------------------------------------------
57+ * Dashboard and Administrative Functionality
58+ * -----------------------------------------------------------------------------
59+ */
60+
61+ if ( is_admin () && (!defined ( 'DOING_AJAX ' ) || !DOING_AJAX ) ) {
62+ require_once ( plugin_dir_path ( __FILE__ ) . 'admin/class-woo-taxonomy-report-admin.php ' );
63+ add_action ( 'plugins_loaded ' , array ( 'Woo_Taxonomy_Report_Admin ' , 'get_instance ' ) );
64+ }
5965}
0 commit comments