validateRequiredPlugins() ) === 0 ) {
$this->initContainer();
if ( is_admin() ) {
new Admin();
} else {
new Frontend();
}
add_filter( 'plugin_action_links_' . plugin_basename( $this->getContainer()->getFileManager()->getMainFile() ), function ( $actions ) {
$actions[] = '' . __( 'Settings', 'order-messenger-for-woocommerce' ) . '';
if ( ! avfw_fs()->is_anonymous() && avfw_fs()->is_installed_on_site() ) {
$actions[] = '' . __( 'Account',
'todo' ) . '';
}
$actions[] = '' . __( 'Contact us',
'todo' ) . '';
if ( ! avfw_fs()->is_premium() ) {
$actions[] = '' . __( 'Go premium',
'todo' ) . '';
}
return $actions;
}, 10, 4 );
}
}
public function validateRequiredPlugins() {
$plugins = [];
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
/**
* Check if WooCommerce is active
**/
if ( ! ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) ) {
$plugins[] = 'WooCommerce';
}
return $plugins;
}
/**
* Check required plugins and push notifications
*/
public function checkRequirePlugins() {
$message = __( 'The %s plugin requires %s plugin to be active!', 'premmerce-url-manager' );
$plugins = $this->validateRequiredPlugins();
if ( count( $plugins ) ) {
foreach ( $plugins as $plugin ) {
$error = sprintf( $message, 'WooCommerce Permalink Manager', $plugin );
$this->getContainer()->getAdminNotifier()->push( $error, AdminNotifier::ERROR, false );
}
}
}
public function initContainer() {
$this->getContainer()->add( 'fileManager', FileManager::getInstance() );
$this->getContainer()->add( 'adminNotifier', new AdminNotifier() );
$this->getContainer()->add( 'settings', new Settings() );
$this->getContainer()->add( 'customizer', new Customizer() );
do_action( 'age_checker/container/main_services_init' );
}
/**
* Load plugin translations
*/
public function loadTextDomain() {
$name = $this->getContainer()->getFileManager()->getPluginName();
load_plugin_textdomain( 'age-verification-screen-for-woocommerce', false, $name . '/languages/' );
}
/**
* Fired when the plugin is activated
*/
public function activate() {
set_transient( 'woocommerce_age_verification_activated', true, 100 );
}
/**
* Fired when the plugin is deactivated
*/
public function deactivate() {
// TODO: Implement deactivate() method.
}
/**
* Fired during plugin uninstall
*/
public static function uninstall() {
// TODO: Implement uninstall() method.
}
}