function wptouch_render_updates_page($page_options)
{
    global $wptouch_pro;
    if ($wptouch_pro->theme_upgrades_available() || $wptouch_pro->extension_upgrades_available() || wptouch_is_update_available() != WPTOUCH_VERSION) {
        $settings = wptouch_get_settings();
        wptouch_add_sub_page(WPTOUCH_ADMIN_UPDATES_AVAILABLE, 'updates-available', $page_options);
        wptouch_add_page_section(WPTOUCH_ADMIN_UPDATES_AVAILABLE, __('Updates Available', 'wptouch-pro'), 'updates-available', array(wptouch_add_setting('updates-available', 'theme-extension-updates-available', false, false, WPTOUCH_SETTING_BASIC, '4.0')), $page_options);
    }
    return $page_options;
}
	<div class="updates-plugin">
		<?php 
    if ($wptouch_pro->theme_upgrades_available()) {
        ?>
<h3><?php 
        _e('Core Plugin Updates', 'wptouch-pro');
        ?>
</h3><?php 
    }
    ?>
		<ul>
			<li>
				<h4>WPtouch Pro Plugin</h4>
				<span class="update-version">
					<?php 
    echo sprintf(__('Upgrade to %s', 'wptouch-pro'), wptouch_is_update_available());
    ?>
				</span>
			</li>
		</ul>
	</div>
<?php 
}
?>


<?php 
if ($wptouch_pro->theme_upgrades_available()) {
    ?>
	<div class="updates-themes">
		<h3><?php 
Ejemplo n.º 3
0
function wptouch_update_all_themes_addons()
{
    global $wptouch_pro;
    if (current_user_can('manage_options')) {
        $current_theme = $wptouch_pro->get_current_theme_info();
        $available_themes = $wptouch_pro->get_available_themes(true);
        $available_addons = $wptouch_pro->get_available_addons(true);
        $updates = 0;
        $errors = array();
        if (wptouch_is_update_available()) {
            include_once ABSPATH . 'wp-admin/includes/admin.php';
            include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
            $upgrader = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
            $upgrader->upgrade('wptouch-pro/wptouch-pro.php');
            if (is_array($upgrader->skin->result)) {
                $new_plugin_identifier = 'wptouch-pro/wptouch-pro.php';
                $active_plugins = get_option('active_plugins', array());
                if (!in_array($new_plugin_identifier, $active_plugins)) {
                    $active_plugins[] = $new_plugin_identifier;
                    update_option('active_plugins', $active_plugins);
                }
                wptouch_pro_handle_activation();
            }
            $updates++;
        }
        if (count($available_themes) > 0 || count($available_addons) > 0) {
            require_once WPTOUCH_DIR . '/core/addon-theme-installer.php';
            foreach ($available_themes as $name => $theme) {
                $skip_upgrade = false;
                if (isset($theme->theme_upgrade_available) && $theme->theme_upgrade_available && version_compare($theme->cloud_version, $theme->version, '>')) {
                    $installer = new WPtouchAddonThemeInstaller();
                    $installer->install($theme->base, $theme->download_url, 'themes');
                    if ($installer->had_error()) {
                        $errors[] = $installer->error_text();
                    } else {
                        $updates++;
                    }
                }
            }
            foreach ($available_addons as $name => $addon) {
                if (isset($addon->extension_upgrade_available) && $addon->extension_upgrade_available && isset($addon->download_url)) {
                    $installer = new WPtouchAddonThemeInstaller();
                    $installer->install($addon->base, $addon->download_url, 'extensions');
                    if ($installer->had_error()) {
                        $errors[] = $installer->error_text();
                    } else {
                        $updates++;
                    }
                }
            }
            if ($updates && count($errors) > 0) {
                echo json_encode(array('status' => '0', 'error' => __('Some themes or extensions could not be updated.', 'wptouch-pro')));
            } elseif ($updates) {
                echo json_encode(array('status' => '1'));
            }
        } else {
            echo json_encode(array('status' => '1'));
        }
    }
}
Ejemplo n.º 4
0
        }
        $show_keys = array_diff(array_keys($panel_options), $hide_keys);
        ?>
					<h2><?php 
        _e('Setup', 'wptouch-pro');
        ?>
</h2>
					<ul>
						<?php 
        if (!defined('WPTOUCH_IS_FREE') && (!wptouch_is_controlled_network() || wptouch_is_controlled_network() && is_network_admin())) {
            ?>
							<?php 
            global $wptouch_pro;
            ?>
							<?php 
            if ($wptouch_pro->theme_upgrades_available() || $wptouch_pro->extension_upgrades_available() || wptouch_is_update_available() != WPTOUCH_VERSION) {
                ?>
								<li><a href="#" class="updates-available<?php 
                if (isset($_COOKIE['wptouch-4-admin-menu']) && $_COOKIE['wptouch-4-admin-menu'] == 'updates-available') {
                    echo ' active';
                }
                ?>
" data-page-slug="updates-available"><?php 
                _e('Updates Available', 'wptouch-pro');
                ?>
</a></li>
							<?php 
            }
            ?>
						<?php 
        }