$plugins_local = apply_filters( ‘active_plugins’, (array) get_option( ‘active_plugins’, [] ) );
if( !in_array( ‘alids/alids.php’, $plugins_local ) && !in_array( ‘woocommerce/woocommerce.php’, $plugins_local ) ) {
return ‘Please install and activate AliDropship original or WooCommerce to make Sellvia plugin work properly.’;
}
if( in_array( ‘alids/alids.php’, $plugins_local ) && in_array( ‘woocommerce/woocommerce.php’, $plugins_local ) ) {
return ‘You can\’t use Sellvia plugin with AliDropship original and Woocommerce plugin at the same time.’;
}
return false;
}
function sellvia_admin_notice__error() {
if( SELLVIA_ERROR ) {
$class = ‘notice notice-error’;
$message = __( ‘Sellvia plugin alert: Ooops!’, ‘sel’ ) . ‘ ‘ . SELLVIA_ERROR;
printf( ‘
%3$s
‘,
$class,
SELLVIA_URL . ‘/assets/images/icon_sellvia.svg’,
$message );
}
}
add_action( ‘admin_notices’, ‘sellvia_admin_notice__error’ );
/**
* Localization
*/
function sellvia_lang_init() {
load_plugin_textdomain(‘sel’);
}
add_action( ‘init’, ‘sellvia_lang_init’ );
require( SELLVIA_PATH . ‘core/autoloader.php’ );
require( SELLVIA_PATH . ‘core/core.php’ );
require( SELLVIA_PATH . ‘core/options.php’ );
require( SELLVIA_PATH . ‘core/update.php’);
if ( ! defined( ‘SELLVIA_PLUGIN’ ) ) {
define( ‘SELLVIA_PLUGIN’, sellvia_init_check_plugin() );
}
if( is_admin() ) {
require( SELLVIA_PATH . ‘install/install.php’);
register_activation_hook( __FILE__, ‘sellvia_lang_init’ );
register_activation_hook( __FILE__, ‘sellvia_install’ );
register_uninstall_hook( __FILE__, ‘sellvia_uninstall’ );
register_activation_hook( __FILE__, ‘sellvia_activate’ );
register_deactivation_hook( __FILE__, ‘sellvia_deactivate’ );
}
function sellvia_init_check_plugin() {
$label = false;
$plugins_local = apply_filters( ‘active_plugins’, (array) get_option( ‘active_plugins’, [] ) );
if( in_array( ‘alids/alids.php’, $plugins_local ) ) {
$label = ‘ADS’;
} elseif ( in_array(‘alidswoo/alidswoo.php’, $plugins_local) && in_array(‘woocommerce/woocommerce.php’, $plugins_local) ) {
$label = ‘ADSW’;
} elseif ( in_array(‘woocommerce/woocommerce.php’, $plugins_local) ) {
$label = ‘WOO’;
}
return $label;
}
if ( ! SELLVIA_ERROR && SELLVIA_PLUGIN ) {
require( SELLVIA_PATH . ‘core/init.php’ );
require( SELLVIA_PATH . ‘core/handler.php’ );
require( SELLVIA_PATH . ‘core/filters.php’ );
if ( ! defined(‘SELLVIA_NICE’) ) define( ‘SELLVIA_NICE’, serialize( sellvia_get_nice_attributes_settings() ) );
if( is_admin() ){
require( SELLVIA_PATH . ‘core/menu.php’ );
require( SELLVIA_PATH . ‘core/extra-fields.php’ );
} else {
$nice_enable = sellvia_get_nice_attr(‘enable’);
if ( $nice_enable && intval($nice_enable ) == 1 && in_array( SELLVIA_PLUGIN, [‘WOO’] ))
require( SELLVIA_PATH . ‘core/nice_attributes_hooks.php’ );
}