public static function get_progress_page($theme_id, $plugin_ids) { ?> <!DOCTYPE html> <html> <head> <?php wp_print_styles('colors'); wp_print_scripts('jquery'); ?> <link rel="stylesheet" href="<?php echo One_And_One_Wizard::get_css_url() . 'welcome-panel.css'; ?> " type="text/css" media="all"> <link rel="stylesheet" href="<?php echo One_And_One_Wizard::get_css_url() . 'install-progress.css'; ?> " type="text/css" media="all"> </head> <body class="oneandone-install-progress wp-core-ui "> <?php include_once One_And_One_Wizard::get_inc_dir_path() . 'batch-installer.php'; $catalog = new One_And_One_Catalog(); $site_type = sanitize_text_field($_GET['sitetype']); if (isset($theme_id)) { $theme = $catalog->get_theme_by_id($site_type, $theme_id); } else { $theme = null; } $plugins = $catalog->get_plugins_by_ids($site_type, array_filter($plugin_ids)); $callback_url = wp_nonce_url($_SERVER['REQUEST_URI'], 'installation-progress'); $batch_installer = new One_And_One_Batch_Installer($theme, $plugins, $callback_url, null); $batch_installer->setup_plugins_and_theme(); ?> <script> jQuery("html, body").scrollTop(jQuery(document).height()); //jQuery("html, body").animate({ scrollTop: jQuery(document).height() }, "slow"); </script </body> </html> <?php }
private function download_and_activate_new_version($zip_url) { if (!One_And_One_Utility::check_credentials('plugins.php', null)) { return false; } $response_body = One_And_One_Utility::get_remote_response_body($zip_url); if (empty($response_body)) { return false; } $zip_file_path = One_And_One_Wizard::get_plugin_dir_path() . 'plugin.zip'; global $wp_filesystem; $wp_filesystem->put_contents($zip_file_path, $response_body, FS_CHMOD_FILE); // delete all transient data $transience_manager = new One_And_One_Transience_Manager(); $transience_manager->erase_transient_data(); $unzip = unzip_file($zip_file_path, WP_PLUGIN_DIR); @unlink($zip_file_path); activate_plugin(One_And_One_Wizard::get_plugin_file_path()); }
public function dispatcher_installer_action() { if (isset($_GET['setup_action']) && 'installation-progress' == $_GET['setup_action']) { wp_enqueue_script('jquery'); if (isset($_GET['theme'])) { $theme_id = $_GET['theme']; } //check nonce check_admin_referer('installation-progress'); if (isset($_GET['plugins'])) { $plugin_ids = explode(',', $_GET['plugins']); } else { $plugin_ids = array(); } include_once One_And_One_Wizard::get_views_dir_path() . 'installer-progress.php'; One_And_One_Plugin_Installation_Progress::get_progress_page($theme_id, $plugin_ids); die; } }
public function dispatch_wizard_actions() { // Check user permissions if (!current_user_can('manage_options')) { wp_die(__('Sorry, you do not have permission to access the 1&1 WP Wizard.', '1and1-wordpress-wizard')); } // Load styling wp_enqueue_style('1and1-wp-wizard'); // Before the use can choose the appearance, a sitetype needs to be selected! if ($this->is_action('choose_appearance') && isset($_POST['sitetype'])) { $site_type = key($_POST['sitetype']); //check nonce check_admin_referer('choose_appearance'); include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-theme-select-step.php'; One_And_One_Theme_Selection_Step::get_theme_selection($site_type); } elseif ($this->is_action('choose_functionality') && isset($_POST['sitetype'])) { $site_type = $_POST['sitetype']; //check nonce check_admin_referer('choose_functionality'); if (isset($_POST['theme'])) { $theme_id = key($_POST['theme']); } else { $theme_id = ''; } include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-plugins-select-step.php'; One_And_One_Plugin_Select_Step::get_plugin_selection($site_type, $theme_id); } elseif ($this->is_action('install') && isset($_POST['sitetype']) && isset($_POST['theme'])) { $site_type = $_POST['sitetype']; $theme_id = $_POST['theme']; //check nonce check_admin_referer('install'); if (isset($_POST['plugins'])) { $plugin_ids = join(',', $_POST['plugins']); } else { $plugin_ids = ''; } include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-installation-step.php'; One_And_One_Plugin_Installation_Step::get_installation($site_type, $theme_id, $plugin_ids); } else { include One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-site-select-step.php'; One_And_One_Site_Selection_Step::get_site_selection(); } }
public static function get_plugin_selection($site_type, $theme_id) { add_thickbox(); $catalog = new One_And_One_Catalog(); $recommended_plugins = $catalog->get_recommended_plugins($site_type); $default_plugins = $catalog->get_default_plugins($site_type); if (version_compare($GLOBALS['wp_version'], '4.0', '<')) { include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-plugin-item-compatibility.php'; } else { include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-plugin-item.php'; } ?> <script type="text/javascript"> function showBox(id, title) { tb_show(title, '#TB_inline?height=500&width=800&inlineId=' + id + '&modal=false', null); } jQuery(function($) { $( '.oneandone-plugin-browser' ).on( 'click', '.oneandone-install-checkbox input', function(evt) { $checkbox = $(this); if ( $checkbox.prop('checked') ) { $(this).closest('.oneandone-install-checkbox').addClass( 'checked' ); } else { $(this).closest('.oneandone-install-checkbox').removeClass( 'checked' ); } }); }); </script> <form action="<?php echo esc_url(add_query_arg(array('setup_action' => 'install'))); ?> " method="post"> <!-- Add nonce--> <?php wp_nonce_field('install'); ?> <input type="hidden" name="sitetype" value="<?php echo esc_attr($site_type); ?> "/> <input type="hidden" name="theme" value="<?php echo esc_attr($theme_id); ?> "/> <div class="wrap"> <?php include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-header.php'; One_And_One_Wizard_Header::get_wizard_header(3); ?> <h3 class="clear"><?php esc_html_e('Step 3 - Selecting plugins', '1and1-wordpress-wizard'); ?> </h3> <p> <?php $button_title = esc_attr__('Continue', '1and1-wordpress-wizard'); if (false === $default_plugins && false === $recommended_plugins) { esc_html_e("The plugins couldn't get retrieved. Please refresh the page.", '1and1-wordpress-wizard'); } else { if (!$default_plugins && !$recommended_plugins) { esc_html_e('You already installed all the plugins we recommend. Nice job!', '1and1-wordpress-wizard'); } else { $button_title = esc_attr__('Install all selected theme/plugins', '1and1-wordpress-wizard'); esc_html_e('Select the desired plugins to expand the range of functions in your WordPress installation.', '1and1-wordpress-wizard'); } } ?> </p> <br/> <div class="oneandone-functionality-choice"> <?php $index = 0; if ($default_plugins) { ?> <h3><?php esc_html_e('Recommended plugins:', '1and1-wordpress-wizard'); ?> </h3> <div class="oneandone-plugin-browser"> <?php foreach ($default_plugins as $plugin) { $popup_id = "Popup" . $index++; One_And_One_Plugin_Item::get_plugin_item($plugin, $popup_id, true); } ?> </div> <?php } ?> <?php if ($recommended_plugins) { ?> <h3><?php esc_html_e('These plugins are worth a try as well:', '1and1-wordpress-wizard'); ?> </h3> <div class="oneandone-plugin-browser"> <?php foreach ($recommended_plugins as $plugin) { $popup_id = "Popup" . $index++; One_And_One_Plugin_Item::get_plugin_item($plugin, $popup_id, false); } ?> </div> <?php } ?> </div> <br class="clear"> <input type="submit" name="install" value="<?php echo $button_title; ?> " class="button button-primary"/> <p> <a href="<?php echo esc_url(admin_url('tools.php?page=1and1-wordpress-wizard')); ?> "><?php esc_html_e('Back to the beginning', '1and1-wordpress-wizard'); ?> </a> </p> </div> <?php }
public static function get_theme_selection($site_type) { add_thickbox(); $current_theme_info = wp_get_theme(); $current_theme_info->screenshot_url = $current_theme_info->get_screenshot(); $current_theme_info->author = $current_theme_info->display('Author', false, true); $themes = self::get_available_themes($site_type, $current_theme_info->slug); ?> <script type="text/javascript"> function showBox(id) { tb_show('', '#TB_inline?height=500&width=900&inlineId=' + id + '&modal=false', null); } </script> <form action="<?php echo esc_url(add_query_arg(array('setup_action' => 'choose_functionality'))); ?> " method="post"> <!-- Add nonce--> <?php wp_nonce_field('choose_functionality'); ?> <input type="hidden" name="sitetype" value="<?php echo esc_attr($site_type); ?> "/> <div class="wrap"> <?php include One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-header.php'; One_And_One_Wizard_Header::get_wizard_header(2); ?> <h3 class="clear"><?php esc_html_e('Step 2 - Selecting appearance', '1and1-wordpress-wizard'); ?> </h3> <p><?php esc_html_e('You can select the desired design here.', '1and1-wordpress-wizard'); ?> </p> <br/> <div> <div class="oneandone-theme-browser"> <?php $popup_id = 'Popup'; $theme_submit_name = 'theme[]'; $theme_submit_value = esc_attr__('Keep Current Theme', '1and1-wordpress-wizard'); include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-theme-item.php'; One_And_One_Theme_Item::get_theme_item($current_theme_info, true, $popup_id, $theme_submit_name, $theme_submit_value); $index = 0; foreach ($themes as $theme) { $popup_id = 'Popup' . $index++; $theme_submit_name = 'theme[' . $theme->slug . ']'; $theme_submit_value = esc_attr__('Select', '1and1-wordpress-wizard'); One_And_One_Theme_Item::get_theme_item($theme, false, $popup_id, $theme_submit_name, $theme_submit_value); } ?> <br class="clear"> </div> <br class="clear"> <a href="<?php echo esc_url(admin_url('tools.php?page=1and1-wordpress-wizard')); ?> "><?php esc_html_e('Back to the beginning', '1and1-wordpress-wizard'); ?> </a> </div> </div> </form> <?php }
private static function get_category_name($category_name) { include_once One_And_One_Wizard::get_inc_dir_path() . 'plugin-categories-catalog.php'; return One_And_One_Plugin_Categories_Catalog::get_plugin_category_name($category_name); }
function setup_plugins_and_theme() { ignore_user_abort(true); set_time_limit(0); // check credentials first before starting the install process... if (!One_And_One_Utility::check_credentials($this->callback_url, $this->form_fields)) { // we don't have the credentials to install the plugin... return false; } do_action('one_and_one_batch_installer_start'); $this->install_and_activate_theme(); $this->install_and_activate_plugins(); do_action('one_and_one_batch_installer_end'); if (!$this->theme) { $this->theme = wp_get_theme(); } //Deactivate the 1&1 setup plugin... if (apply_filters('one_and_one_wizard_deactivate_on_end', true)) { deactivate_plugins(One_And_One_Wizard::get_plugin_file_path()); //Hide the menu item echo '<script>jQuery("#menu-tools .current", window.parent.document).hide();</script>'; echo '<br/><h3 style="font-size: 1.2em;">'; printf(esc_html__('The 1&1 WP Wizard has been deactivated, you can find it in the %s area.', '1and1-wordpress-wizard'), '<a href="' . admin_url('plugins.php') . '" target="_parent">' . esc_html_x('Plugins', 'area', '1and1-wordpress-wizard') . '</a>'); echo '</h3>'; } echo '<br/>'; echo '<h2>' . esc_html__('Installation completed.', '1and1-wordpress-wizard') . '</h2>'; echo '<p>' . esc_html__('You are now ready to use your WordPress installation. You can continue customizing the selected theme or write your first blog post.', '1and1-wordpress-wizard') . '</p>'; echo '<p><a href="' . wp_customize_url($this->theme->slug) . '" class="hide-if-no-customize button button-primary" title="' . sprintf(esc_attr('Customize “%s”'), $this->theme->name) . '" target="_parent">' . esc_html__('Customize the Theme', '1and1-wordpress-wizard') . '</a> '; _ex('or', 'between two buttons'); echo ' <a href="' . admin_url('post-new.php') . '" class="button" target="_parent">' . esc_html__('Write a post', '1and1-wordpress-wizard') . '</a></p>'; //Dismiss the welcom panel... $perisistent_manager = new One_And_One_Persistence_Manager(); $perisistent_manager->store(One_And_One_Persistence_Manager::WELCOME_PANEL_DISMISS_KEY, true); echo '<br/>'; $community_portal_link = esc_url(__('http://community.1and1.com', '1and1-wordpress-wizard')); ?> <div id="oneandone-community-panel" class="updated welcome-panel oneandone-setup-panel"> <div class="welcome-panel-content"> <div class="oneandone-community-image"> <a href="<?php echo $community_portal_link; ?> "> <img src="<?php echo One_And_One_Wizard::get_images_url('community-icon.png'); ?> " alt="<?php esc_attr_e('Community logo', '1and1-wordpress-wizard'); ?> " /> </a> </div> <div class="oneandone-setup-message"> <h3><?php _e('1&1 Community', '1and1-wordpress-wizard'); ?> </h3> <p><?php echo wpautop(__('Use the 1&1 Community to talk about interesting web projects with WordPress, and get to know the people behind the projects. Learn more about important strategies, themes, and plugins. Discuss both simple and complex solutions to promote your next project.', '1and1-wordpress-wizard')); ?> </p> <div class="oneandone-setup-links"> <a href="<?php echo $community_portal_link; ?> " class="button button-primary button-hero"> <?php _e('Go to our community site', '1and1-wordpress-wizard'); ?> </a> </div> </div> </div> </div> <?php $catalog = new One_And_One_Catalog(); $catalog->report_selection($this->theme->slug, wp_list_pluck($this->plugins, 'slug')); }
public static function get_site_selection() { ?> <form action="<?php echo esc_url(add_query_arg(array('setup_action' => 'choose_appearance'))); ?> " method="post"> <?php wp_nonce_field('choose_appearance'); ?> <div class="wrap"> <?php include_once One_And_One_Wizard::get_views_dir_path() . 'setup-wizard-header.php'; One_And_One_Wizard_Header::get_wizard_header(1); ?> <h3 class="clear"><?php esc_html_e('Step 1 - Selecting website type', '1and1-wordpress-wizard'); ?> </h3> <p><?php esc_html_e('Here you can select the desired website type.', '1and1-wordpress-wizard'); ?> </p> <br/> <div class="oneandone-site-type-browser"> <?php include_once One_And_One_Wizard::get_inc_dir_path() . 'site-types-catalog.php'; $site_type_catalog = new One_And_One_Site_Type_Catalog(); $site_types = $site_type_catalog->get_all_site_types(); if ($site_types) { foreach ($site_types as $site_type) { ?> <div class="oneandone-site-selection"> <div class="oneandone-site-type-picture"> <img src="<?php echo $site_type->get_pic_url(); ?> " alt=""/> </div> <span class="oneandone-site-type-description"><h3><?php echo $site_type->get_name(); ?> </h3><p><?php echo $site_type->get_description(); ?> </p></span> <h3 class="oneandone-site-type-name"><?php echo $site_type->get_name(); ?> </h3> <div class="oneandone-site-type-actions"> <input type="submit" name="sitetype[<?php echo $site_type->get_id(); ?> ]" value="<?php esc_attr_e('Select', '1and1-wordpress-wizard'); ?> " class="button button-primary"/> </div> </div> <?php } } else { echo '<strong style="font-size:14px;">'; esc_html_e("The website types couldn't get retrieved. Please refresh the page.", '1and1-wordpress-wizard'); echo '</strong>'; } ?> </div> <br class="clear"/> </div> </form> <script> jQuery(document).ready(function($) { $('.oneandone-site-type-browser').on( 'click' , '.oneandone-site-selection', function() { $( '.button-primary', this ).trigger('click'); }); $('.oneandone-site-type-browser').on( 'click' , '.button-primary', function(evt) { evt.stopPropagation(); }); }); </script> <?php }