function sp_check_for_updates() { $xml = sp_load_version_xml(); if ($xml) { $installed_version = sp_get_option('sfversion'); $installed_build = sp_get_option('sfbuild'); if (empty($installed_build)) { return; } if ($xml->core->build > $installed_build) { $up = get_site_transient('update_plugins'); $data = new stdClass(); $data->slug = 'simple-press'; $data->new_version = (string) $xml->core->version . ' Build ' . (string) $xml->core->build; $data->new_build = (string) $xml->core->build; $data->upgrade_notice = (string) $xml->core->message; $data->url = 'http://simple-press.com'; $data->package = (string) $xml->core->archive; $up->response['simple-press/sp-control.php'] = $data; set_site_transient('update_plugins', $up); } $update = false; $plugins = sp_get_plugins(); if (!empty($plugins)) { $up = new stdClass(); foreach ($plugins as $file => $installed) { foreach ($xml->plugins->plugin as $latest) { if ($installed['Name'] == $latest->name) { if (version_compare($latest->version, $installed['Version'], '>') == 1) { $data->slug = $file; $data->new_version = (string) $latest->version; $data->url = 'http://simple-press.com'; $data->package = (string) $latest->archive . '&wpupdate=1'; $up->response[$file] = $data; $update = true; } } } } } if ($update) { set_site_transient('sp_update_plugins', $up); } else { delete_site_transient('sp_update_plugins'); } include_once SF_PLUGIN_DIR . '/admin/panel-themes/support/spa-themes-prepare.php'; $update = false; $themes = sp_get_themes(); if (!empty($themes)) { $up = new stdClass(); foreach ($themes as $file => $installed) { foreach ($xml->themes->theme as $latest) { if ($installed['Name'] == $latest->name) { if (version_compare($latest->version, $installed['Version'], '>') == 1) { $data = new stdClass(); $data->slug = $file; $data->stylesheet = $installed['Stylesheet']; $data->new_version = (string) $latest->version; $data->url = 'http://simple-press.com'; $data->package = (string) $latest->archive . '&wpupdate=1'; $up->response[$file] = $data; $update = true; } } } } } if ($update) { set_site_transient('sp_update_themes', $up); } else { delete_site_transient('sp_update_themes'); } } }
function sp_get_themes_list_data() { $themes = sp_get_themes(); return $themes; }
function sp_update_check_sp_themes() { $xml = sp_load_version_xml(); if ($xml) { include_once SF_PLUGIN_DIR . '/admin/panel-themes/support/spa-themes-prepare.php'; $themes = sp_get_themes(); if (empty($themes)) { return; } $up = new stdClass(); $update = false; $header = true; foreach ($themes as $file => $installed) { foreach ($xml->themes->theme as $latest) { if ($installed['Name'] == $latest->name) { if (version_compare($latest->version, $installed['Version'], '>') == 1) { if ($header) { $form_action = 'update-core.php?action=do-sp-theme-upgrade'; ?> <h3><?php spa_etext('Simple:Press Themes'); ?> </h3> <p><?php spa_etext('The following themes have new versions available. Check the ones you want to update and then click Update Themes.'); ?> </p> <p><?php echo '<b>' . spa_text('Please Note:') . '</b> ' . spa_text('Any customizations you have made to theme files will be lost.'); ?> </p> <form method="post" action="<?php echo $form_action; ?> " name="upgrade-themes" class="upgrade"> <?php wp_nonce_field('upgrade-core'); ?> <p><input id="upgrade-themes" class="button" type="submit" value="<?php spa_etext('Update SP Themes'); ?> " name="upgrade" /></p> <table class="widefat" cellspacing="0" id="update-themes-table"> <thead> <tr> <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th> <th scope="col" class="manage-column"><label for="themes-select-all"><?php spa_etext('Select All'); ?> </label></th> </tr> </thead> <tfoot> <tr> <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th> <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php spa_etext('Select All'); ?> </label></th> </tr> </tfoot> <tbody class="plugins"> <?php $header = false; } $screenshot = SPTHEMEBASEURL . $file . '/' . $installed['Screenshot']; echo "\n\t\t\t\t\t\t\t<tr class='active'>\n\t\t\t\t\t\t\t<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($file) . "' /></th>\n\t\t\t\t\t\t\t<td class='plugin-title'><img src='{$screenshot}' width='64' height='64' style='float:left; padding: 5px' /><strong>{$installed['Name']}</strong>" . sprintf(spa_text('You have version %1$s installed. Update to %2$s. Requires SP Version %3$s.'), $installed['Version'], $latest->version, $latest->requires) . "</td>\n\t\t\t\t\t\t\t</tr>"; $data = new stdClass(); $data->slug = $file; $data->stylesheet = $installed['Stylesheet']; $data->new_version = (string) $latest->version; $data->url = 'http://simple-press.com'; $data->package = (string) $latest->archive . '&wpupdate=1'; $up->response[$file] = $data; $update = true; } } } } # any themes to update? if ($update) { set_site_transient('sp_update_themes', $up); } else { delete_site_transient('sp_update_themes'); } if (!$header) { ?> </tbody> </table> <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php spa_etext('Update SP Themes'); ?> " name="upgrade" /></p> </form> <?php } else { echo '<h3>' . spa_text('Simple:Press Themes') . '</h3>'; echo '<p>' . spa_text('Your SP themes are all up to date') . '</p>'; } } }