nonce ) ) { if ( isset( $clean_get[ $this->dismiss_option ] ) ) { update_option( 'redux-framework_extendify_plugin_notice', 'hide' ); return; } } add_action( 'wp_ajax_redux_activation', array( $this, 'admin_ajax' ) ); // Executed when logged in. add_action( 'current_screen', array( $this, 'maybe_initialize_hooks' ) ); } /** * Get the URL for the current page to fall back if JS is broken. * * @param bool|string $location Used to determine the location of the banner for account creation. * @since 4.1.21 * @return array */ private function get_urls( $location = true ): array { if ( ! empty( $this->urls ) ) { return $this->urls; } global $pagenow; $clean_get = $_GET; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( isset( $clean_get[ $this->register_option ] ) ) { unset( $clean_get[ $this->register_option ] ); } if ( isset( $clean_get[ $this->dismiss_option ] ) ) { unset( $clean_get[ $this->dismiss_option ] ); } $base_url = admin_url( add_query_arg( $clean_get, $pagenow ) ); return array( 'dismiss' => wp_nonce_url( add_query_arg( $this->dismiss_option, true, $base_url ), $this->nonce ), 'register' => wp_nonce_url( add_query_arg( $this->register_option, $location, $base_url ), $this->nonce ), ); } /** * AJAX callback for dismissing the notice. */ public function admin_ajax() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, $this->nonce ) ) { die( __( 'Security check failed.', 'redux-framework' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if ( 'false' === $_REQUEST['activate'] ) { echo wp_json_encode( array( 'type' => 'close', 'msg' => '', ) ); update_option( 'redux-framework_extendify_plugin_notice', 'hide' ); die(); } $res = $this->install_extendify(); if ( true === $res ) { update_option( 'redux-framework_extendify_plugin_notice', 'hide' ); } die(); } /** * Install and activate Extendify Plugin. * * @return bool */ private function install_extendify(): bool { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/misc.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $api = plugins_api( 'plugin_information', array( 'slug' => 'extendify', 'fields' => array( 'short_description' => false, 'sections' => false, 'requires' => false, 'rating' => false, 'ratings' => false, 'downloaded' => false, 'last_updated' => false, 'added' => false, 'tags' => false, 'compatibility' => false, 'homepage' => false, 'donate_link' => false, ), ) ); $download_link = $api->download_link; if ( empty( $download_link ) ) { echo wp_json_encode( array( 'type' => 'error', 'msg' => esc_html__( 'Error: Install URL for Extendify could not be located.', 'redux-framework' ), ) ); return false; } ob_start(); $skin = new Redux_Installer_Muter( array( 'api' => $api ) ); $upgrader = new Plugin_Upgrader( $skin ); $install = $upgrader->install( $download_link ); if ( ob_get_contents() ) { ob_end_clean(); } if ( true !== $install ) { echo wp_json_encode( array( 'type' => 'error', 'msg' => esc_html__( 'Install process for Extendify failed.', 'redux-framework' ), ) ); return false; } $plugin_dir = WP_PLUGIN_DIR . '/extendify/extendify.php'; $activate = activate_plugin( $plugin_dir ); if ( is_wp_error( $activate ) ) { echo wp_json_encode( array( 'type' => 'error', 'msg' => esc_html__( 'Extendify activation failed.', 'redux-framework' ), ) ); } echo wp_json_encode( array( 'type' => 'success', 'msg' => esc_html__( 'Extendify installed and activated.', 'redux-framework' ), ) ); return true; } /** * AJAX callback for dismissing the notice. * * @param string|null $admin_body_class Class string. * * @return string */ public function admin_body_class( ?string $admin_body_class = '' ): string { $classes = explode( ' ', trim( $admin_body_class ) ); $classes[] = false ? 'redux-connected' : 'redux-disconnected'; $admin_body_class = implode( ' ', array_unique( $classes ) ); return " $admin_body_class "; } /** * Will initialize hooks to display the new (as of 4.4) connection banner if the current user can * connect Redux if Redux has not been deactivated, and if the current page is the plugin page. * * This method should not be called if the site is connected to WordPress.com or if the site is in development mode. * * @since 4.4.0 * @since 4.5.0 Made the new (as of 4.4) connection banner display to everyone by default. * @since 5.3.0 Running another split test between 4.4 banner and a new one in 5.3. * @since 7.2 B test was removed. * * @param $current_screen */ public function maybe_initialize_hooks( $current_screen ) { if ( Redux_Functions_Ex::is_plugin_installed( 'extendify' ) || 'hide' === get_option( 'redux-framework_extendify_plugin_notice', null ) ) { return; } if ( ! current_user_can( 'install_plugins' ) ) { return; } // Don't show the connection notice anywhere but the plugins.php after activating if ( 'plugins' !== $current_screen->base && 'dashboard' !== $current_screen->base ) { add_action( 'admin_head', array( $this, 'admin_head' ) ); return; } // Only show this notice when the plugin is installed. if ( class_exists( 'Redux_Framework_Plugin' ) && false === Redux_Framework_Plugin::$crash ) { add_action( 'admin_notices', array( $this, 'render_banner' ) ); add_action( 'network_admin_notices', array( $this, 'network_connect_notice' ) ); add_action( 'admin_head', array( $this, 'admin_head' ) ); add_filter( 'admin_body_class', array( $this, 'admin_body_class' ), 20 ); } } /** * Hide Individual Dashboard Pages * * @access public * @since 4.0.0 * @return void */ public function admin_head() { ?> href='inc/welcome/css/redux-banner.min.css' type='text/css' media='all'/> get_urls( 'main_banner' ); ?>

Redux is activated! Each site on your network must be connected individually by an admin on that site.', 'Redux' ), array( 'strong' => array() ) ); ?>