include_extensions();
do_action('addonnest_before_load');
$this->run();
do_action('addonnest_after_load');
}
public function addonnest_check_elementor_status() {
if ( ! is_admin() ) {
return;
}
// Only show notice if Elementor is not active
if ( ! did_action( 'elementor/loaded' ) ) {
add_action( 'admin_notices', array( $this, 'addonnest_elementor_missing_notice' ) );
}
}
public function addonnest_elementor_missing_notice() {
$plugin_slug = 'elementor/elementor.php';
$is_installed = file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug );
if ( $is_installed ) {
// Elementor is installed but not active
$action_url = wp_nonce_url(
admin_url( 'plugins.php?action=activate&plugin=' . $plugin_slug ),
'activate-plugin_' . $plugin_slug
);
$button_text = __( 'Activate Elementor', 'addonnest' );
echo '
';
echo '
' . esc_html( $button_text ) . '
';
echo '
'. esc_html__( 'Activated on this website in order to use AddonNest For Elementor.', 'addonnest' ) .'
';
echo '
';
} else {
// Elementor is not installed
$action_url = wp_nonce_url(
self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ),
'install-plugin_elementor'
);
$button_text = __( 'Install Elementor', 'addonnest' );
$message = sprintf(
// translators: %s is the plugin name wrapped in tags.
esc_html__( '%s requires Elementor to be installed and activated to work properly.', 'addonnest' ),
'' . esc_html__( 'AddonNest for Elementor', 'addonnest' ) . ''
);
echo '';
}
}
//Checking Vendor
public function run() {
if ( in_array( 'elementor/elementor.php', apply_filters( 'addonnest_active_plugins', get_option( 'active_plugins' ) ) ) ) {
require_once ADDONNEST_DIR_PATH.'includes/elementor/AddonNest_Base.php';
new \AddonNest\elementor\AddonNest_Base();
}
}
// Include Addons directory
public function include_extensions() {
$extensions_dir = array_filter( glob( ADDONNEST_DIR_PATH.'extensions/*' ), 'is_dir' );
if (count($extensions_dir) > 0) {
foreach( $extensions_dir as $key => $value ) {
$addon_dir_name = str_replace(dirname($value).'/', '', $value);
$file_name = ADDONNEST_DIR_PATH . 'extensions/'.$addon_dir_name.'/'.$addon_dir_name.'.php';
if ( file_exists($file_name) ) {
include_once $file_name;
}
}
}
}
}