0 ) { add_action( 'admin_notices', array( $this, 'display_wc_absence_warning' ) ); } return; } spl_autoload_register( array( $this, 'awf_autoloader' ) ); add_action( 'init', array( $this, 'load_textdomain' ) ); add_action( 'widgets_init', array( $this, 'register_widget' ) ); add_action( 'init', array( $this, 'register_shortcode' ) ); self::$excluded_taxonomies = array( 'product_type', 'product_visibility', 'product_shipping_class' ); self::$presets = get_option( 'awf_presets', array() ); if ( !is_array( self::$presets ) ) { self::$presets = array(); } self::$modules = array( 'taxonomy', 'search', 'price', 'stock', 'featured', 'rating', 'onsale', 'ppp' ); // @ToDo 'orderby' if ( is_admin() ) { if ( wp_doing_ajax() && isset( $_REQUEST['awf_front'] ) ) { add_action( 'wp_ajax_awf', array( $this, 'frontend_ajax_controller' ) ); add_action( 'wp_ajax_nopriv_awf', array( $this, 'frontend_ajax_controller' ) ); } else { self::$admin = A_W_F_admin::get_instance(); } } else { self::$front = A_W_F_frontend::get_instance(); self::$front->filters_manager = 'A_W_F_filter_frontend'; } } public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } public static function activate_plugin() { if ( !current_user_can( 'activate_plugins' ) ) { return; } $plugin = ( isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : '' ); check_admin_referer( "activate-plugin_{$plugin}" ); if ( empty(get_option( 'awf_presets' )) ) { $presets = array( 1 => array( 'position' => 1, 'filters' => array(), 'associations' => array( 0 => 'shop-pages', ), 'overrides' => array(), ), ); update_option( 'awf_presets', $presets ); update_option( 'awf_preset_1_name', __( 'Default Preset', 'annasta-filters' ) ); } } public static function deactivate_plugin() { if ( !current_user_can( 'activate_plugins' ) ) { return; } require 'class-a-w-f-admin.php'; self::$admin = A_W_F_admin::get_instance(); self::$admin->clear_product_counts_cache(); } public static function uninstall_plugin() { if ( !current_user_can( 'activate_plugins' ) ) { return; } if ( empty(self::$admin) ) { require 'class-a-w-f-admin.php'; self::$admin = A_W_F_admin::get_instance(); } self::$admin->clear_product_counts_cache(); unregister_widget( 'A_W_F_widget' ); $all_options = wp_load_alloptions(); $awf_options = array( 'awf_version', 'awf_premium', 'awf_shortcode_pages', 'awf_force_products_display_on', 'awf_shop_columns', 'awf_redirect_search', 'awf_products_html_wrapper', 'awf_pretty_scrollbars', 'awf_ppp_default', 'awf_include_children_on', 'awf_cat_views_on', 'awf_presets', 'awf_custom_style' ); foreach ( $all_options as $name => $value ) { if ( 0 !== strpos( $name, 'awf_' ) ) { continue; } if ( stristr( $name, 'awf_preset_' ) || stristr( $name, 'awf_filter_' ) || substr( $name, -12 ) === '_pretty_name' || in_array( $name, $awf_options ) ) { delete_option( $name ); } } } public function display_wc_absence_warning() { echo '
', __( 'annasta Woocommerce Product Filters requires WooCommerce plugin to function properly. Please install WooCommerce online shop to use the annasta Woocommerce Product Filters plugin.', 'annasta-filters' ), '
";
print_r( $print );
print "";
//A_W_F::format_print_r( self::$features_by_parent[0] );
//error_log( 'before' . print_r( $filters[$preset_id], true ) );
}
}
}