esc_url( admin_url( 'admin-ajax.php' ) ), 'nonce' => wp_create_nonce( 'hoottheme-welcome-action' ), 'dismiss_action' => 'hoot_dismiss_welcome_notice', 'hoot_processplugin_action' => 'hoot_processplugin', 'hoot_processplugin_btntext' => esc_html__( 'Please Wait. This may take a while...', 'brigsby' ), ) ); } } add_action( 'admin_enqueue_scripts', 'hoot_admin_enqueue_notice_styles' ); /** * Display admin notice */ function hoot_add_welcome_notice() { $slug = hoot_abouttag( 'slug' ); $themename = hoot_abouttag( 'name' ); $fullshot = hoot_abouttag( 'fullshot' ); $import_config = apply_filters( 'hootimport_theme_config', array() ); // Hoot Import has been configured for active theme $display_import = ! empty( $import_config ) && ! get_option( "{$slug}-dismiss-import" ); ?>
" target="_blank"> <?php echo esc_attr( $themename ); ?>

', '' ); ?>

sanitize_key( wp_unslash( $plugin ) ), '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, ), ) ); if ( is_wp_error( $api ) ) { $response['errorInstall'] = $api->get_error_message(); } else { $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader( $skin ); $result = $upgrader->install( $api->download_link ); if ( $result ) { $state = 'installed'; } else { $pluginname = ucwords( str_replace( '-', ' ', $plugin ) ); /* Translators: 1 is line break, 2 is the link start markup, 3 is link markup end, 4 is the plugin name, 5 and 6 are strong tags */ $errormsg = sprintf( esc_html__( 'WordPress encountered an unexpected error during the plugin installation.%1$sPlease %2$sclick this link%3$s to install the %5$s%4$s plugin%6$s directly.', 'brigsby' ), '
', '', '', $pluginname, '', '' ); $response['errorInstall'] = $errormsg; } } } if ( 'installed' === $state ) { if ( current_user_can( 'activate_plugin' ) ) { $result = activate_plugin( "{$plugin}/{$plugin}.php" ); if ( ! is_wp_error( $result ) ) { $state = 'activated'; } else { $response['errorCode'] = $result->get_error_code(); $response['errorMessage'] = $result->get_error_message(); } } } if ( 'activated' === $state ) { if ( $plugin === 'hoot-import' ) { $response['redirect'] = esc_url( admin_url( 'themes.php?page=hoot-import' ) ); update_option( "{$slug}-dismiss-import", 1 ); } elseif ( $plugin === 'hootkit' ) { $response['redirect'] = esc_url( admin_url( 'options-general.php?page=hootkit' ) ); } } wp_send_json( $response ); exit(); } add_action( 'wp_ajax_hoot_processplugin', 'hoot_processplugin' );