Example #1
0
 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());
 }
 private function get_api_data($callback, $args = array())
 {
     $args = wp_parse_args($args, array('locale' => get_locale()));
     $url = add_query_arg($args, $this->catalog_url . $callback);
     $data = One_And_One_Utility::get_remote_response_body($url);
     if (!$data) {
         $data = $this->api_call_fallback($callback);
     }
     $data = json_decode($data);
     return $data;
 }
Example #3
0
 private function get_api_data($callback, $args = array(), $method = 'GET')
 {
     $default_args = array('locale' => get_locale(), 'wizard_version' => One_And_One_Wizard::VERSION, 'wp_version' => $GLOBALS['wp_version'], 'php_version' => phpversion(), 'db_version' => $GLOBALS['wpdb']->db_version());
     $args = wp_parse_args($args, $default_args);
     $url = add_query_arg($args, $this->catalog_url . $callback);
     $data = One_And_One_Utility::get_remote_response_body($url, '', $method);
     if ('HEAD' == $method) {
         return $data;
     }
     if (!$data) {
         $data = $this->api_call_fallback($callback);
     }
     $data = json_decode($data);
     return $data;
 }
Example #4
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'));
    }