=' ) ) { add_action( 'admin_notices', array( $this, 'spectra_pro_fail_load_out_of_date' ) ); return; } if ( is_admin() ) { Core\Admin::init(); } ( new License_Handler() )->init(); Core\Base::init(); Core\Assets::init(); BlocksConfig\Config::init(); Core\Extensions_Manager::init(); } /** * Set Redirect flag on activation. * * @Hooked - register_activation_hook * * @return void * @since 1.0.0 */ public function activation_reset() { update_option( '__spectra_pro_do_redirect', true ); } /** * Check spectra core is installed or not. * * @return bool * @since 1.0.0 */ public function is_spectra_core_installed() { $path = 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php'; $plugins = get_plugins(); return isset( $plugins[ $path ] ); } /** * Admon Notice Callback if failed to load core. * * Hooked - admin_notices * * @return void * @since 1.0.0 */ public function spectra_pro_fail_load() { $screen = get_current_screen(); if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { return; } $plugin = 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php'; if ( $this->is_spectra_core_installed() ) { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); $message = '

' . esc_html__( 'Activate the Spectra Plugin', 'spectra-pro' ) . '

'; $message .= '

' . esc_html__( 'Before you can use all the features of Spectra Pro, you need to activate the Spectra plugin first.', 'spectra-pro' ) . '

'; $message .= '

' . sprintf( '%s', $activation_url, esc_html__( 'Activate Now', 'spectra-pro' ) ) . '

'; } else { if ( ! current_user_can( 'install_plugins' ) ) { return; } $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=ultimate-addons-for-gutenberg' ), 'install-plugin_ultimate-addons-for-gutenberg' ); $message = '

' . esc_html__( 'Install and Activate the Spectra Plugin', 'spectra-pro' ) . '

'; $message .= '

' . esc_html__( 'Before you can use all the features of Spectra Pro, you need to install and activate the Spectra plugin first.', 'spectra-pro' ) . '

'; $message .= '

' . sprintf( '%s', $install_url, esc_html__( 'Install Spectra', 'spectra-pro' ) ) . '

'; }//end if // Phpcs ignore comment is required as $message variable is already escaped. echo '
' . $message . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Admon Notice Callback if failed to load updated core. * * Hooked - admin_notices * * @return void * @since 1.0.0 */ public function spectra_pro_fail_load_out_of_date() { if ( ! current_user_can( 'update_plugins' ) ) { return; } $file_path = 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php'; $upgrade_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file_path, 'upgrade-plugin_' . $file_path ); $message = '

' . esc_html__( 'Spectra Pro is not working because you are using an old version of Spectra.', 'spectra-pro' ) . '

'; $message .= '

' . sprintf( '%s', $upgrade_link, esc_html__( 'Update Spectra Now', 'spectra-pro' ) ) . '

'; // Phpcs ignore comment is required as $message variable is already escaped. echo '
' . $message . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } /** * Kicking this off by calling 'get_instance()' method */ PluginLoader::get_instance();