Esempio n. 1
0
 public function __construct()
 {
     $catalog = new One_And_One_Catalog();
     $site_types = $catalog->get_site_types();
     foreach ($site_types as $site_type) {
         $this->site_types[] = new One_And_One_Site_Type($site_type->id, esc_html($site_type->name), esc_url($site_type->image), esc_html($site_type->description));
     }
 }
Esempio n. 2
0
 public function start_auto_update()
 {
     if ($this->update_check_necessary()) {
         $catalog = new One_And_One_Catalog();
         $latest_version = $catalog->get_latest_version();
         if (!$latest_version) {
             return;
         }
         self::$latest_version = $latest_version->version;
         if ($this->newer_version_available()) {
             $this->download_and_activate_new_version($latest_version->zip);
         }
     }
 }
Esempio n. 3
0
    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 
    }
    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 
    }
 private static function get_available_themes($site_type, $current_theme_slug)
 {
     $catalog = new One_And_One_Catalog();
     $themes = $catalog->get_themes_by_site_type($site_type);
     // remove current theme from theme list
     foreach ($themes as $key => $theme) {
         if ($theme->slug == $current_theme_slug) {
             unset($themes->{$key});
             break;
         }
     }
     return $themes;
 }
Esempio n. 6
0
    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 &#8220;%s&#8221;'), $this->theme->name) . '" target="_parent">' . esc_html__('Customize the Theme', '1and1-wordpress-wizard') . '</a> &nbsp; ';
        _ex('or', 'between two buttons');
        echo ' &nbsp; <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'));
    }