function wptouch_repair_active_theme_from_cloud(&$error_condition) { global $wptouch_pro; $result = true; $error_condition = false; $settings = wptouch_get_settings(); $wptouch_pro->setup_bncapi(); // We need to download the theme and then repair it $themes = $wptouch_pro->get_available_themes(true); if (isset($themes[$settings->current_theme_friendly_name])) { require_once WPTOUCH_DIR . '/core/addon-theme-installer.php'; $theme_to_install = $themes[$settings->current_theme_friendly_name]; $addon_installer = new WPtouchAddonThemeInstaller(); $result = $addon_installer->install($theme_to_install->base, $theme_to_install->download_url, 'themes'); if ($result) { $wptouch_pro->repair_active_theme(WPTOUCH_BASE_CONTENT_DIR . '/themes', $settings->current_theme_friendly_name); } else { $error_condition = $addon_installer->get_error(); } } return $result; }