required_php_version = $this->app->get_config( 'config', 'required_php_version' ); $this->required_wordpress_version = $this->app->get_config( 'config', 'required_wordpress_version' ); $this->not_enough_php_version = version_compare( phpversion(), $this->required_php_version, '<' ); $this->not_enough_wordpress_version = empty( $wp_version ) || version_compare( $wp_version, $this->required_wordpress_version, '<' ); if ( ! $this->is_enough_version() ) { $this->set_unsupported(); if ( $this->app->is_theme ) { $this->deactivate_theme(); } } elseif ( $this->app->is_uninstall() ) { $this->app_initialized(); } elseif ( ! self::$_setup_initialized_action ) { self::$_setup_initialized_action = true; add_action( 'init', function () { $this->do_framework_action( 'initialize' ); }, 9 ); } } /** * app initialized */ /** @noinspection PhpUnusedPrivateMethodInspection */ private function app_initialized() { if ( ! $this->is_enough_version() ) { return; } if ( $this->app->is_uninstall() ) { $this->app->load_all_packages(); $this->app->uninstall->get_class_list(); } $this->do_action( 'app_initialized', $this->app ); if ( ! $this->app->option->is_app_activated() ) { $this->do_action( 'app_activated', $this->app ); } } /** * deactivate theme */ private function deactivate_theme() { add_action( 'init', function () { switch_theme( WP_DEFAULT_THEME ); unset( $_GET['activated'] ); }, 999 ); } /** * @return bool */ public function is_enough_version() { return ! $this->not_enough_php_version && ! $this->not_enough_wordpress_version; } /** * set unsupported */ private function set_unsupported() { add_action( 'admin_notices', function () { ?>
e( $this->get_unsupported_php_version_message() ); ?>
not_enough_wordpress_version ): ?>e( $this->get_unsupported_wp_version_message() ); ?>
app->is_theme ): ?>e( $this->get_deactivate_message() ); ?>