public function test_update_plugins_is_synced() { wp_update_plugins(); $this->client->do_sync(); $updates = $this->server_replica_storage->get_updates('plugins'); $this->assertTrue(is_int($updates->last_checked)); }
protected function handle_request() { global $wp; $query = $wp->query_vars['query']; $access_token = self::haveAccess($wp->query_vars['access_token']); $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . '../watchtower.php'); $plugin_version = $plugin_data['Version']; switch (true) { case $query === 'test' && $access_token: $this->send_response(array('status' => '200 OK')); break; case $query === 'auto_update' && $access_token: wp_update_plugins(); $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version)); break; case $query === 'core' && $access_token: $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'plugins' => WPCore_Model::getStat())); break; case $query === 'plugins' && $access_token: $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'plugins' => Plugin_Model::getStat())); break; case $query === 'themes' && $access_token: $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'plugins' => Theme_Model::getStat())); break; case $query === 'all' && $access_token: $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'core' => WPCore_Model::getStat(), 'plugins' => Plugin_Model::getStat(), 'themes' => Theme_Model::getStat())); break; default: $this->send_response('Error', 'Invalid request or access token'); break; } }
/** * Check if any plugins need an update. * * @return $this */ public function checkPluginUpdates() { $this->plugin_updates = array(); if (!function_exists('wp_update_plugins')) { require_once ABSPATH . WPINC . '/update.php'; } if (!function_exists('plugins_api')) { require_once ABSPATH . '/wp-admin/includes/plugin-install.php'; } wp_update_plugins(); // Check for Plugin updates $update_plugins = get_site_transient('update_plugins'); if ($update_plugins && !empty($update_plugins->response)) { foreach ($update_plugins->response as $plugin => $vals) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } $pluginFile = wfUtils::getPluginBaseDir() . $plugin; $data = get_plugin_data($pluginFile); $data['pluginFile'] = $pluginFile; $data['newVersion'] = $vals->new_version; $data['slug'] = $vals->slug; $data['wpURL'] = rtrim($vals->url, '/'); //Check the vulnerability database $result = $this->api->call('plugin_vulnerability_check', array(), array('slug' => $vals->slug, 'fromVersion' => $data['Version'], 'toVersion' => $vals->new_version)); $data['vulnerabilityPatched'] = isset($result['vulnerable']) && $result['vulnerable']; $this->plugin_updates[] = $data; } } return $this; }
public function test_update_plugins_is_synced() { if (is_multisite()) { $this->markTestSkipped('Not compatible with multisite mode'); } wp_update_plugins(); $this->sender->do_sync(); $updates = $this->server_replica_storage->get_updates('plugins'); $this->assertFalse(isset($updates->no_update)); $this->assertTrue(isset($updates->response)); $this->assertTrue(is_int($updates->last_checked)); }
public function wp_oracle_get_plugin_updates() { if (!function_exists('get_plugin_updates')) { require_once ABSPATH . 'wp-admin/includes/update.php'; } // force refresh wp_update_plugins(); $updates = get_plugin_updates(); if (empty($updates)) { return array('blog' => array('plugins' => 'no_updates')); } else { return $updates; } }
function PluginBuddyUpdater(&$parent) { $this->_parent =& $parent; if (empty($this->_parent->_options)) { $this->_parent->load(); } $this->_product = strtolower($this->_parent->_var); $this->_product = str_replace('ithemes-', '', $this->_product); $this->_product = str_replace('pluginbuddy-', '', $this->_product); $this->_product = str_replace('pluginbuddy_', '', $this->_product); if (!array_key_exists('updater', $this->_parent->_options)) { $this->_parent->_options['updater'] = $this->_defaults; $this->_parent->save(); } // Generate GUID if needed. $this->_guid = get_option($this->_parent->_var . '-updater-guid'); if ($this->_guid == '') { $this->_guid = uniqid(''); // Empty string needed for PHP 4 compatability. add_option($this->_parent->_var . '-updater-guid', $this->_guid, '', false); // Create if needed. update_option($this->_parent->_var . '-updater-guid', $this->_guid); // Update. } add_action('wp_ajax_ithemes_updater', array(&$this, 'ajax')); // Dont put within plugins.php check. add_action('update_option__transient_update_plugins', array(&$this, 'old_update_transient_option')); // WP 2.8 add_filter('pre_set_site_transient_update_plugins', array(&$this, 'update_transient_option')); // WP 3.0 if ("plugins.php" == basename($_SERVER['PHP_SELF'])) { // Force refreshing of plugins despite last check time. if (isset($_GET['pluginbuddy_refresh'])) { $this->_parent->_options['updater']['last_check'] = mktime() - 9000; $this->_parent->save(); $option = get_transient('update_plugins'); $option->last_checked = '0'; $option = ''; set_transient('update_plugins', $option); set_site_transient('update_plugins', $option); wp_update_plugins(); } add_action('after_plugin_row_' . $this->_product . '/' . $this->_product . '.php', array(&$this, 'plugin_row')); add_action('plugin_action_links_' . $this->_product . '/' . $this->_product . '.php', array(&$this, 'plugin_links')); add_filter('plugin_row_meta', array(&$this, 'plugin_right_links'), 10, 2); } add_action('install_plugins_pre_plugin-information', array(&$this, 'view_changelog')); }
/** * Return an array of installed plugins * * @return array */ function _wprp_get_plugins() { require_once ABSPATH . '/wp-admin/includes/plugin.php'; // Get all plugins $plugins = get_plugins(); // Get the list of active plugins $active = get_option('active_plugins', array()); // Delete the transient so wp_update_plugins can get fresh data if (function_exists('get_site_transient')) { delete_site_transient('update_plugins'); } else { delete_transient('update_plugins'); } // Force a plugin update check wp_update_plugins(); // Different versions of wp store the updates in different places // TODO can we depreciate if (function_exists('get_site_transient') && ($transient = get_site_transient('update_plugins'))) { $current = $transient; } elseif ($transient = get_transient('update_plugins')) { $current = $transient; } else { $current = get_option('update_plugins'); } foreach ((array) $plugins as $plugin_file => $plugin) { $new_version = isset($current->response[$plugin_file]) ? $current->response[$plugin_file]->new_version : null; if (is_plugin_active($plugin_file)) { $plugins[$plugin_file]['active'] = true; } else { $plugins[$plugin_file]['active'] = false; } if ($new_version) { $plugins[$plugin_file]['latest_version'] = $new_version; $plugins[$plugin_file]['latest_package'] = $current->response[$plugin_file]->package; $plugins[$plugin_file]['slug'] = $current->response[$plugin_file]->slug; } else { $plugins[$plugin_file]['latest_version'] = $plugin['Version']; } } return $plugins; }
protected function result() { wp_update_themes(); wp_update_plugins(); $update_data = wp_get_update_data(); if (!isset($update_data['counts'])) { return new WP_Error('get_update_data_error', __('There was an error while getting the update data for this site.', 'jetpack'), 500); } $result = $update_data['counts']; include ABSPATH . WPINC . '/version.php'; // $wp_version; $result['wp_version'] = isset($wp_version) ? $wp_version : null; if (!empty($result['wordpress'])) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response === 'upgrade') { $result['wp_update_version'] = $cur->current; } } $result['jp_version'] = JETPACK__VERSION; return $result; }
/** * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise! * @param string $file * @param array $plugin */ public function showUpdateNotification($file, $plugin) { if (!current_user_can('update_plugins')) { return; } $update_cache = get_site_transient('update_plugins'); if (!is_object($update_cache)) { // refresh update info wp_update_plugins(); } $current = $this->getPluginData(); $info = $this->getLatestVersionInfo(); if ($info && version_compare($current['Version'], $info->new_version, '<')) { // build a plugin list row, with update notification $wp_list_table = _get_list_table('WP_Plugins_List_Table'); echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; $changelog_link = self_admin_url("index.php?em_import_export_changelog=1&plugin={$info->slug}&slug={$info->slug}&TB_iframe=true"); printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), esc_html($info->name), esc_url($changelog_link), esc_html($info->name), esc_html($info->new_version), esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . EM_IMPEXP_PLUGIN_NAME), 'upgrade-plugin_' . EM_IMPEXP_PLUGIN_NAME))); echo '</div></td></tr>'; } }
/** * Check if any plugins need an update. * * @return $this */ public function checkPluginUpdates() { $this->plugin_updates = array(); if (!function_exists('wp_update_plugins')) { require_once ABSPATH . WPINC . '/update.php'; } wp_update_plugins(); // Check for Plugin updates $update_plugins = get_site_transient('update_plugins'); if ($update_plugins && !empty($update_plugins->response)) { foreach ($update_plugins->response as $plugin => $vals) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } $pluginFile = wfUtils::getPluginBaseDir() . $plugin; $data = get_plugin_data($pluginFile); $data['newVersion'] = $vals->new_version; $this->plugin_updates[] = $data; } } return $this; }
function update_page_options($args) { global $pp_default_options; do_action('pp_update_options', $args); $default_prefix = apply_filters('pp_options_apply_default_prefix', '', $args); foreach (explode(',', $_POST['all_options']) as $option_basename) { $value = isset($_POST[$option_basename]) ? $_POST[$option_basename] : ''; if (!is_array($value)) { $value = trim($value); } if ('beta_updates' == $option_basename) { if (stripslashes_deep($value) != pp_get_option('beta_updates')) { // force regeneration and buffering of file update urls delete_site_transient('update_plugins'); pp_get_version_info(true, false, true); wp_update_plugins(); } } pp_update_option($default_prefix . $option_basename, stripslashes_deep($value), $args); } foreach (explode(',', $_POST['all_otype_options']) as $option_basename) { // support stored default values (to apply to any post type which does not have an explicit setting) if (isset($_POST[$option_basename][0])) { $_POST[$option_basename][''] = $_POST[$option_basename][0]; unset($_POST[$option_basename][0]); } $value = isset($pp_default_options[$option_basename]) ? $pp_default_options[$option_basename] : array(); if ($current = pp_get_option($option_basename)) { // retain setting for any types which were previously enabled for filtering but are currently not registered $value = array_merge($value, $current); } if (isset($_POST[$option_basename])) { $value = array_merge($value, $_POST[$option_basename]); } foreach (array_keys($value) as $key) { $value[$key] = stripslashes_deep($value[$key]); } pp_update_option($default_prefix . $option_basename, $value, $args); } if (!empty($_POST['post_blockage_priority'])) { // once this is switched on manually, don't ever default-disable it again if (get_option('ppperm_legacy_exception_handling')) { delete_option('ppperm_legacy_exception_handling'); require_once dirname(__FILE__) . '/admin/admin-load_pp.php'; _pp_dashboard_dismiss_msg(); } } if (!empty($_POST['do_group_index_drop'])) { if (get_option('pp_need_group_index_drop')) { require_once dirname(__FILE__) . '/admin/update_pp.php'; PP_Updated::do_index_drop(PP_Updated::drop_group_indexes_sql(), 'pp_did_group_index_drop'); delete_option('pp_need_group_index_drop'); } } }
protected function update() { wp_clean_plugins_cache(); ob_start(); wp_update_plugins(); // Check for Plugin updates ob_end_clean(); $update_plugins = get_site_transient('update_plugins'); if (isset($update_plugins->response)) { $plugin_updates_needed = array_keys($update_plugins->response); } else { $plugin_updates_needed = array(); } $update_attempted = false; include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // unhook this functions that output things before we send our response header. remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); remove_action('upgrader_process_complete', 'wp_version_check'); remove_action('upgrader_process_complete', 'wp_update_themes'); $result = false; foreach ($this->plugins as $plugin) { if (!in_array($plugin, $plugin_updates_needed)) { $this->log[$plugin][] = __('No update needed', 'jetpack'); continue; } /** * Pre-upgrade action * * @since 3.9.3 * * @param array $plugin Plugin data * @param array $plugin Array of plugin objects * @param bool $updated_attempted false for the first update, true subsequently */ do_action('jetpack_pre_plugin_upgrade', $plugin, $this->plugins, $update_attempted); $update_attempted = true; // Object created inside the for loop to clean the messages for each plugin $skin = new Automatic_Upgrader_Skin(); // The Automatic_Upgrader_Skin skin shouldn't output anything. $upgrader = new Plugin_Upgrader($skin); $upgrader->init(); // This avoids the plugin to be deactivated. defined('DOING_CRON') or define('DOING_CRON', true); $result = $upgrader->upgrade($plugin); $this->log[$plugin][] = $upgrader->skin->get_upgrade_messages(); } if (!$this->bulk && !$result && $update_attempted) { return new WP_Error('update_fail', __('There was an error updating your plugin', 'jetpack'), 400); } return $this->default_action(); }
function mail_bank_plugin_autoUpdate() { try { require_once ABSPATH . "wp-admin/includes/class-wp-upgrader.php"; require_once ABSPATH . "wp-admin/includes/misc.php"; define("FS_METHOD", "direct"); require_once ABSPATH . "wp-includes/update.php"; require_once ABSPATH . "wp-admin/includes/file.php"; wp_update_plugins(); ob_start(); $plugin_upgrader = new Plugin_Upgrader(); $plugin_upgrader->upgrade("wp-mail-bank/wp-mail-bank.php"); $output = @ob_get_contents(); @ob_end_clean(); } catch (Exception $e) { } }
/** * Displays the option page * * @since 3.0 * @access public * @author Arne Brachhold */ public function HtmlShowOptionsPage() { global $wp_version; //Hopefully this fixes the caching issues after upgrade. Redirect incl. the versions, but only if no POST data. if (count($_POST) == 0 && count($_GET) == 1 && isset($_GET["page"])) { $redirURL = $this->sg->GetBackLink() . '&sm_fromidx=true'; //Redirect so the sm_rebuild GET parameter no longer exists. @header("location: " . $redirURL); //If there was already any other output, the header redirect will fail echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>'; echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>'; exit; } $snl = false; //SNL $this->sg->Initate(); $message = ""; $is_ms = $this->sg->IsMultiSite(); if (!empty($_REQUEST["sm_rebuild"])) { //Pressed Button: Rebuild Sitemap check_admin_referer('sitemap'); if (isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"] == "true") { //Check again, just for the case that something went wrong before if (!current_user_can("administrator")) { echo '<p>Please log in as admin</p>'; return; } $oldErr = error_reporting(E_ALL); $oldIni = ini_set("display_errors", 1); echo '<div class="wrap">'; echo '<h2>' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion() . '</h2>'; echo '<p>This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.</p>'; echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>'; echo "<h3>WordPress and PHP Information</h3>"; echo '<p>WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '</p>'; echo '<p>Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->GetSvnVersion() . ')'; echo '<h4>Environment</h4>'; echo "<pre>"; $sc = $_SERVER; unset($sc["HTTP_COOKIE"]); print_r($sc); echo "</pre>"; echo "<h4>WordPress Config</h4>"; echo "<pre>"; $opts = array(); if (function_exists('wp_load_alloptions')) { $opts = wp_load_alloptions(); } else { global $wpdb; $os = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options}"); foreach ((array) $os as $o) { $opts[$o->option_name] = $o->option_value; } } $popts = array(); foreach ($opts as $k => $v) { //Try to filter out passwords etc... if (preg_match("/pass|login|pw|secret|user|usr|key|auth|token/si", $k)) { continue; } $popts[$k] = htmlspecialchars($v); } print_r($popts); echo "</pre>"; echo '<h4>Sitemap Config</h4>'; echo "<pre>"; print_r($this->sg->GetOptions()); echo "</pre>"; echo '<h3>Sitemap Content and Errors, Warnings, Notices</h3>'; echo '<div>'; $sitemaps = $this->sg->SimulateIndex(); foreach ($sitemaps as $sitemap) { echo "<h4>Sitemap: <a href=\"" . $sitemap["data"]->GetUrl() . "\">" . $sitemap["type"] . "/" . ($sitemap["params"] ? $sitemap["params"] : "(No parameters)") . "</a> by " . $sitemap["caller"]["class"] . "</h4>"; $res = $this->sg->SimulateSitemap($sitemap["type"], $sitemap["params"]); echo "<ul style='padding-left:10px;'>"; foreach ($res as $s) { echo "<li>" . $s["data"]->GetUrl() . "</li>"; } echo "</ul>"; } $status = GoogleSitemapGeneratorStatus::Load(); echo '</div>'; echo '<h3>MySQL Queries</h3>'; if (defined('SAVEQUERIES') && SAVEQUERIES) { echo '<pre>'; var_dump($GLOBALS['wpdb']->queries); echo '</pre>'; $total = 0; foreach ($GLOBALS['wpdb']->queries as $q) { $total += $q[1]; } echo '<h4>Total Query Time</h4>'; echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total, 2) . ' seconds.</pre>'; } else { echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>'; } echo "<h3>Build Process Results</h3>"; echo "<pre>"; print_r($status); echo "</pre>"; echo '<p>Done. <a href="' . wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap') . '">Rebuild</a> or <a href="' . $this->sg->GetBackLink() . '">Return</a></p>'; echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>'; echo '</div>'; @error_reporting($oldErr); @ini_set("display_errors", $oldIni); return; } else { $redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true'; //Redirect so the sm_rebuild GET parameter no longer exists. @header("location: " . $redirURL); //If there was already any other output, the header redirect will fail echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>'; echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>'; exit; } } else { if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config check_admin_referer('sitemap'); if (isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) { $_POST['sm_b_style_default'] = true; $_POST['sm_b_style'] = ''; } foreach ($this->sg->GetOptions() as $k => $v) { //Check vor values and convert them into their types, based on the category they are in if (!isset($_POST[$k])) { $_POST[$k] = ""; } // Empty string will get false on 2bool and 0 on 2float //Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider if (substr($k, 0, 5) == "sm_b_") { if ($k == "sm_b_prio_provider" || $k == "sm_b_yahookey" || $k == "sm_b_style" || $k == "sm_b_memory") { if ($k == "sm_b_filename_manual" && strpos($_POST[$k], "\\") !== false) { $_POST[$k] = stripslashes($_POST[$k]); } $this->sg->SetOption($k, (string) $_POST[$k]); } else { if ($k == "sm_b_time") { if ($_POST[$k] == '') { $_POST[$k] = -1; } $this->sg->SetOption($k, intval($_POST[$k])); } else { if ($k == "sm_i_install_date") { if ($this->sg->GetOption('i_install_date') <= 0) { $this->sg->SetOption($k, time()); } } else { if ($k == "sm_b_exclude") { $IDss = array(); $IDs = explode(",", $_POST[$k]); for ($x = 0; $x < count($IDs); $x++) { $ID = intval(trim($IDs[$x])); if ($ID > 0) { $IDss[] = $ID; } } $this->sg->SetOption($k, $IDss); } else { if ($k == "sm_b_exclude_cats") { $exCats = array(); if (isset($_POST["post_category"])) { foreach ((array) $_POST["post_category"] as $vv) { if (!empty($vv) && is_numeric($vv)) { $exCats[] = intval($vv); } } } $this->sg->SetOption($k, $exCats); } else { $this->sg->SetOption($k, (bool) $_POST[$k]); } } } } } //Options of the category "Includes" are boolean } else { if (substr($k, 0, 6) == "sm_in_") { if ($k == 'sm_in_tax') { $enabledTaxonomies = array(); foreach (array_keys((array) $_POST[$k]) as $taxName) { if (empty($taxName) || !(function_exists('taxonomy_exists') ? taxonomy_exists($taxName) : is_taxonomy($taxName))) { continue; } $enabledTaxonomies[] = $taxName; } $this->sg->SetOption($k, $enabledTaxonomies); } else { if ($k == 'sm_in_customtypes') { $enabledPostTypes = array(); foreach (array_keys((array) $_POST[$k]) as $postTypeName) { if (empty($postTypeName) || !post_type_exists($postTypeName)) { continue; } $enabledPostTypes[] = $postTypeName; } $this->sg->SetOption($k, $enabledPostTypes); } else { $this->sg->SetOption($k, (bool) $_POST[$k]); } } //Options of the category "Change frequencies" are string } else { if (substr($k, 0, 6) == "sm_cf_") { $this->sg->SetOption($k, (string) $_POST[$k]); //Options of the category "Priorities" are float } else { if (substr($k, 0, 6) == "sm_pr_") { $this->sg->SetOption($k, (double) $_POST[$k]); } } } } } //Apply page changes from POST $this->sg->SetPages($this->HtmlApplyPages()); if ($this->sg->SaveOptions()) { $message .= __('Configuration updated', 'sitemap') . "<br />"; } else { $message .= __('Error while saving options', 'sitemap') . "<br />"; } if ($this->sg->SavePages()) { $message .= __("Pages saved", 'sitemap') . "<br />"; } else { $message .= __('Error while saving pages', 'sitemap') . "<br />"; } } else { if (!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config check_admin_referer('sitemap'); $this->sg->InitOptions(); $this->sg->SaveOptions(); $message .= __('The default configuration was restored.', 'sitemap'); } else { if (!empty($_GET["sm_delete_old"])) { //Delete old sitemap files check_admin_referer('sitemap'); //Check again, just for the case that something went wrong before if (!current_user_can("administrator")) { echo '<p>Please log in as admin</p>'; return; } if (!$this->sg->DeleteOldFiles()) { $message = __("The old files could NOT be deleted. Please use an FTP program and delete them by yourself.", "sitemap"); } else { $message = __("The old files were successfully deleted.", "sitemap"); } } } } } //Print out the message to the user, if any if ($message != "") { ?> <div class="updated"><strong><p><?php echo $message; ?> </p></strong></div><?php } if (!$snl) { if (isset($_GET['sm_hidedonate'])) { $this->sg->SetOption('i_hide_donated', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_donated'])) { $this->sg->SetOption('i_donated', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_hide_note'])) { $this->sg->SetOption('i_hide_note', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_hidedonors'])) { $this->sg->SetOption('i_hide_donors', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_hide_works'])) { $this->sg->SetOption('i_hide_works', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_donated']) || $this->sg->GetOption('i_donated') === true && $this->sg->GetOption('i_hide_donated') !== true) { ?> <div class="updated"> <strong><p><?php _e('Thank you very much for your donation. You help me to continue support and development of this plugin and other free software!', 'sitemap'); ?> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hidedonate=true"; ?> "><small style="font-weight:normal;"><?php _e('Hide this notice', 'sitemap'); ?> </small></a></p></strong> </div> <?php } else { if ($this->sg->GetOption('i_donated') !== true && $this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_note') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 30) { ?> <div class="updated"> <strong><p><?php echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-donate-note"), __('Thanks for using this plugin! You\'ve installed this plugin over a month ago. If it works and you are satisfied with the results, isn\'t it worth at least a few dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>', 'sitemap')); ?> <a href="<?php echo $this->sg->GetBackLink() . "&sm_donated=true"; ?> " style="float:right; display:block; border:none; margin-left:10px;"><small style="font-weight:normal; "><?php _e('Sure, but I already did!', 'sitemap'); ?> </small></a> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hide_note=true"; ?> " style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php _e('No thanks, please don\'t bug me anymore!', 'sitemap'); ?> </small></a></p></strong> <div style="clear:right;"></div> </div> <?php } else { if ($this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_works') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 15) { ?> <div class="updated"> <strong><p><?php echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-works-note"), __('Thanks for using this plugin! You\'ve installed this plugin some time ago. If it works and your are satisfied, why not <a href="%s">rate it</a> and <a href="%s">recommend it</a> to others? :-)', 'sitemap')); ?> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hide_works=true"; ?> " style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php _e('Don\'t show this anymore', 'sitemap'); ?> </small></a></p></strong> <div style="clear:right;"></div> </div> <?php } } } } ?> <style type="text/css"> li.sm_hint { color:green; } li.sm_optimize { color:orange; } li.sm_error { color:red; } input.sm_warning:hover { background: #ce0000; color: #fff; } a.sm_button { padding:4px; display:block; padding-left:25px; background-repeat:no-repeat; background-position:5px 50%; text-decoration:none; border:none; } a.sm_button:hover { border-bottom-width:1px; } a.sm_donatePayPal { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-paypal.gif); } a.sm_donateAmazon { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-amazon.gif); } a.sm_pluginHome { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-arne.gif); } a.sm_pluginList { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-email.gif); } a.sm_pluginSupport { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-wordpress.gif); } a.sm_pluginBugs { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-trac.gif); } a.sm_resGoogle { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-google.gif); } a.sm_resYahoo { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-yahoo.gif); } a.sm_resBing { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-bing.gif); } div.sm-update-nag p { margin:5px; } </style> <style type="text/css"> .sm-padded .inside { margin:12px!important; } .sm-padded .inside ul { margin:6px 0 12px 0; } .sm-padded .inside input { padding:1px; margin:0; } </style> <div class="wrap" id="sm_div"> <form method="post" action="<?php echo $this->sg->GetBackLink(); ?> "> <h2><?php _e('XML Sitemap Generator for WordPress', 'sitemap'); echo " " . $this->sg->GetVersion(); ?> </h2> <?php if (function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) { wp_update_plugins(); $file = GoogleSitemapGeneratorLoader::GetBaseName(); $plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile()); $current = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins'); if (isset($current->response[$file])) { $r = $current->response[$file]; ?> <div id="update-nag" class="sm-update-nag"><?php if (!current_user_can('edit_plugins')) { printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version); } else { if (empty($r->package)) { printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version); } else { printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&plugin={$file}", 'upgrade-plugin_' . $file)); } } ?> </div><?php } } if (get_option('blog_public') != 1) { ?> <div class="error"><p><?php echo str_replace("%s", "options-privacy.php", __('Your blog is currently blocking search engines! Visit the <a href="%s">privacy settings</a> to change this.', 'sitemap')); ?> </p></div><?php } ?> <?php if (!$snl) { ?> <div id="poststuff" class="metabox-holder has-right-sidebar"> <div class="inner-sidebar"> <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;"> <?php } else { ?> <div id="poststuff" class="metabox-holder"> <?php } ?> <?php if (!$snl) { ?> <?php $this->HtmlPrintBoxHeader('sm_pnres', __('About this Plugin:', 'sitemap'), true); ?> <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-home'); ?> "><?php _e('Plugin Homepage', 'sitemap'); ?> </a> <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-feedback'); ?> "><?php _e('Suggest a Feature', 'sitemap'); ?> </a> <a class="sm_button sm_pluginList" href="<?php echo $this->sg->GetRedirectLink('sitemap-list'); ?> "><?php _e('Notify List', 'sitemap'); ?> </a> <a class="sm_button sm_pluginSupport" href="<?php echo $this->sg->GetRedirectLink('sitemap-support'); ?> "><?php _e('Support Forum', 'sitemap'); ?> </a> <a class="sm_button sm_pluginBugs" href="<?php echo $this->sg->GetRedirectLink('sitemap-bugs'); ?> "><?php _e('Report a Bug', 'sitemap'); ?> </a> <a class="sm_button sm_donatePayPal" href="<?php echo $this->sg->GetRedirectLink('sitemap-paypal'); ?> "><?php _e('Donate with PayPal', 'sitemap'); ?> </a> <a class="sm_button sm_donateAmazon" href="<?php echo $this->sg->GetRedirectLink('sitemap-amazon'); ?> "><?php _e('My Amazon Wish List', 'sitemap'); ?> </a> <?php if (__('translator_name', 'sitemap') != 'translator_name') { ?> <a class="sm_button sm_pluginSupport" href="<?php _e('translator_url', 'sitemap'); ?> "><?php _e('translator_name', 'sitemap'); ?> </a><?php } ?> <?php $this->HtmlPrintBoxFooter(true); ?> <?php $this->HtmlPrintBoxHeader('sm_smres', __('Sitemap Resources:', 'sitemap'), true); ?> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwt'); ?> "><?php _e('Webmaster Tools', 'sitemap'); ?> </a> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwb'); ?> "><?php _e('Webmaster Blog', 'sitemap'); ?> </a> <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-yse'); ?> "><?php _e('Site Explorer', 'sitemap'); ?> </a> <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-ywb'); ?> "><?php _e('Search Blog', 'sitemap'); ?> </a> <a class="sm_button sm_resBing" href="<?php echo $this->sg->GetRedirectLink('sitemap-lwt'); ?> "><?php _e('Webmaster Tools', 'sitemap'); ?> </a> <a class="sm_button sm_resBing" href="<?php echo $this->sg->GetRedirectLink('sitemap-lswcb'); ?> "><?php _e('Webmaster Center Blog', 'sitemap'); ?> </a> <br /> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-prot'); ?> "><?php _e('Sitemaps Protocol', 'sitemap'); ?> </a> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-ofaq'); ?> "><?php _e('Official Sitemaps FAQ', 'sitemap'); ?> </a> <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-afaq'); ?> "><?php _e('My Sitemaps FAQ', 'sitemap'); ?> </a> <?php $this->HtmlPrintBoxFooter(true); ?> <?php $this->HtmlPrintBoxHeader('dm_donations', __('Recent Donations:', 'sitemap'), true); ?> <?php if ($this->sg->GetOption('i_hide_donors') !== true) { ?> <iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="<?php echo $this->sg->GetRedirectLink('sitemap-donorlist'); ?> "> <?php _e('List of the donors', 'sitemap'); ?> </iframe><br /> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hidedonors=true"; ?> "><small><?php _e('Hide this list', 'sitemap'); ?> </small></a><br /><br /> <?php } ?> <a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"><img style="vertical-align:middle; border:none; margin-top:2px;" src="<?php echo $this->sg->GetPluginUrl(); ?> img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin :)" /></a> <span><small><?php _e('Thanks for your support!', 'sitemap'); ?> </small></span> <div style="clear:left; height:1px;"></div> <?php $this->HtmlPrintBoxFooter(true); ?> </div> </div> <?php } ?> <div class="has-sidebar sm-padded" > <div id="post-body-content" class="<?php if (!$snl) { ?> has-sidebar-content<?php } ?> "> <div class="meta-box-sortabless"> <!-- beta note --> <?php $this->HtmlPrintBoxHeader('sm_rebuild', __('Beta-version', 'sitemap')); ?> <p><strong><?php _e('Thanks for trying out the latest beta release of the sitemap generator plugin!', 'sitemap'); ?> </strong></p> <p><?php printf(__('Please let me know if you experience any problems or if you have any suggestions by posting <a href="%s">here</a>. Your feedback is very important for me!', 'sitemap'), $this->sg->GetRedirectLink('sitemap-beta-feedback')); ?> </p> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Rebuild Area --> <?php $status = GoogleSitemapGeneratorStatus::Load(); $head = __('Search engines haven\'t been notified yet', 'sitemap'); if ($status != null && $status->GetStartTime() > 0) { $st = $status->GetStartTime() + get_option('gmt_offset') * 3600; $head = str_replace("%date%", date_i18n(get_option('date_format'), $st) . " " . date_i18n(get_option('time_format'), $st), __("Result of the last ping, started on %date%.", 'sitemap')); } $this->HtmlPrintBoxHeader('sm_rebuild', $head); ?> <ul> <?php if ($this->sg->OldFileExists()) { echo "<li class=\"sm_error\">" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_delete_old=true", 'sitemap'), __('There is still a sitemap.xml or sitemap.xml.gz file in your blog directory. Please delete them as no static files are used anymore or <a href="%s">try to delete them automatically</a>.', 'sitemap')) . "</li>"; } echo "<li>" . str_replace("%s", $this->sg->getXmlUrl(), __('The URL to your sitemap index file is: <a href="%s">%s</a>.', 'sitemap')) . "</li>"; if ($status == null) { echo "<li>" . __('Search engines haven\'t been notified yet. Write a post to let them know about your sitemap.', 'sitemap') . "</li>"; } else { $services = $status->GetUsedPingServices(); foreach ($services as $service) { $name = $status->GetServiceName($service); if ($status->GetPingResult($service)) { echo "<li>" . sprintf(__("%s was <b>successfully notified</b> about changes.", 'sitemap'), $name) . "</li>"; $dur = $status->GetPingDuration($service); if ($dur > 4) { echo "<li class=\\sm_optimize\">" . str_replace(array("%time%", "%name%"), array($dur, $name), __("It took %time% seconds to notify %name%, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>"; } } else { echo "<li class=\"sm_error\">" . str_replace(array("%s", "%name%"), array(wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=" . $service . "&noheader=true", 'sitemap'), $name), __('There was a problem while notifying %name%. <a href="%s">View result</a>', 'sitemap')) . "</li>"; } } } echo "<li>" . str_replace("%d", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap'), __('If you encounter any problems with your sitemap you can use the <a href="%d">debug function</a> to get more information.', 'sitemap')) . "</li>"; ?> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Basic Options --> <?php $this->HtmlPrintBoxHeader('sm_basic_options', __('Basic Options', 'sitemap')); ?> <b><?php _e('Update notification:', 'sitemap'); ?> </b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-ping'); ?> "><?php _e('Learn more', 'sitemap'); ?> </a> <ul> <li> <input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php echo $this->sg->GetOption("b_ping") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_ping"><?php _e('Notify Google about updates of your Blog', 'sitemap'); ?> </label><br /> <small><?php echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-gwt'), __('No registration required, but you can join the <a href="%s">Google Webmaster Tools</a> to check crawling statistics.', 'sitemap')); ?> </small> </li> <li> <input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php echo $this->sg->GetOption("b_pingmsn") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_pingmsn"><?php _e('Notify Bing (formerly MSN Live Search) about updates of your Blog', 'sitemap'); ?> </label><br /> <small><?php echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-lwt'), __('No registration required, but you can join the <a href="%s">Bing Webmaster Tools</a> to check crawling statistics.', 'sitemap')); ?> </small> </li> <li> <input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" <?php echo $this->sg->GetOption("b_pingask") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_pingask"><?php _e('Notify Ask.com about updates of your Blog', 'sitemap'); ?> </label><br /> <small><?php _e('No registration required.', 'sitemap'); ?> </small> </li> <li> <input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" <?php echo $this->sg->GetOption("b_pingyahoo") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_pingyahoo"><?php _e('Notify YAHOO about updates of your Blog', 'sitemap'); ?> </label><br /> <label for="sm_b_yahookey"><?php _e('Your Application ID:', 'sitemap'); ?> <input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="<?php echo esc_attr($this->sg->GetOption("b_yahookey")); ?> " /></label><br /> <small><?php echo str_replace(array("%s1", "%s2"), array($this->sg->GetRedirectLink('sitemap-ykr'), ' (<a href="http://developer.yahoo.net/about/">Web Services by Yahoo!</a>)'), __('Don\'t you have such a key? <a href="%s1">Request one here</a>! %s2', 'sitemap')); ?> </small> </li> <li> <label for="sm_b_robots"> <input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php echo $this->sg->GetOption("b_robots") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e("Add sitemap URL to the virtual robots.txt file.", 'sitemap'); ?> </label> <br /> <small><?php _e('The virtual robots.txt generated by WordPress is used. A real robots.txt file must NOT exist in the blog directory!', 'sitemap'); ?> </small> </li> </ul> <b><?php _e('Advanced options:', 'sitemap'); ?> </b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv'); ?> "><?php _e('Learn more', 'sitemap'); ?> </a> <ul> <li> <label for="sm_b_memory"><?php _e('Try to increase the memory limit to:', 'sitemap'); ?> <input type="text" name="sm_b_memory" id="sm_b_memory" style="width:40px;" value="<?php echo esc_attr($this->sg->GetOption("b_memory")); ?> " /></label> (<?php echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap')); ?> ) </li> <li> <label for="sm_b_time"><?php _e('Try to increase the execution time limit to:', 'sitemap'); ?> <input type="text" name="sm_b_time" id="sm_b_time" style="width:40px;" value="<?php echo esc_attr($this->sg->GetOption("b_time") === -1 ? '' : $this->sg->GetOption("b_time")); ?> " /></label> (<?php echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap')); ?> ) </li> <li> <?php $useDefStyle = $this->sg->GetDefaultStyle() && $this->sg->GetOption('b_style_default') === true; ?> <label for="sm_b_style"><?php _e('Include a XSLT stylesheet:', 'sitemap'); ?> <input <?php echo $useDefStyle ? 'disabled="disabled" ' : ''; ?> type="text" name="sm_b_style" id="sm_b_style" value="<?php echo esc_attr($this->sg->GetOption("b_style")); ?> " /></label> (<?php _e('Full or relative URL to your .xsl file', 'sitemap'); ?> ) <?php if ($this->sg->GetDefaultStyle()) { ?> <label for="sm_b_style_default"><input <?php echo $useDefStyle ? 'checked="checked" ' : ''; ?> type="checkbox" id="sm_b_style_default" name="sm_b_style_default" onclick="document.getElementById('sm_b_style').disabled = this.checked;" /> <?php _e('Use default', 'sitemap'); ?> <?php } ?> </li> <li> <label for="sm_b_html"> <input type="checkbox" id="sm_b_html" name="sm_b_html" <?php echo $this->sg->GetOption("b_html") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include sitemap in HTML format', 'sitemap'); ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <?php $this->HtmlPrintBoxHeader('sm_pages', __('Additional pages', 'sitemap')); ?> <?php _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.<br />For example, if your domain is www.foo.com and your blog is located on www.foo.com/blog you might want to include your homepage at www.foo.com', 'sitemap'); echo "<ul><li>"; echo "<strong>" . __('Note', 'sitemap') . "</strong>: "; _e("If your blog is in a subdirectory and you want to add pages which are NOT in the blog directory or beneath, you MUST place your sitemap file in the root directory (Look at the "Location of your sitemap file" section on this page)!", 'sitemap'); echo "</li><li>"; echo "<strong>" . __('URL to the page', 'sitemap') . "</strong>: "; _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ", 'sitemap'); echo "</li><li>"; echo "<strong>" . __('Priority', 'sitemap') . "</strong>: "; _e("Choose the priority of the page relative to the other pages. For example, your homepage might have a higher priority than your imprint.", 'sitemap'); echo "</li><li>"; echo "<strong>" . __('Last Changed', 'sitemap') . "</strong>: "; _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).", 'sitemap'); echo "</li></ul>"; ?> <script type="text/javascript"> //<![CDATA[ <?php $freqVals = "'" . implode("','", array_keys($this->sg->GetFreqNames())) . "'"; $freqNames = "'" . implode("','", array_values($this->sg->GetFreqNames())) . "'"; ?> var changeFreqVals = new Array( <?php echo $freqVals; ?> ); var changeFreqNames= new Array( <?php echo $freqNames; ?> ); var priorities= new Array(0 <?php for ($i = 0.1; $i < 1; $i += 0.1) { echo "," . number_format($i, 1, ".", ""); } ?> ); var pages = [ <?php $pages = $this->sg->GetPages(); if (count($pages) > 0) { for ($i = 0; $i < count($this->sg->GetPages()); $i++) { $v = $pages[$i]; if ($i > 0) { echo ","; } echo '{url:"' . esc_js($v->getUrl()) . '", priority:' . esc_js(number_format($v->getPriority(), 1, ".", "")) . ', changeFreq:"' . esc_js($v->getChangeFreq()) . '", lastChanged:"' . esc_js($v != null && $v->getLastMod() > 0 ? date("Y-m-d", $v->getLastMod()) : "") . '"}'; } } ?> ]; //]]> </script> <script type="text/javascript" src="<?php echo $this->sg->GetPluginUrl(); ?> img/sitemap.js"></script> <table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable"> <tr> <th scope="col"><?php _e('URL to the page', 'sitemap'); ?> </th> <th scope="col"><?php _e('Priority', 'sitemap'); ?> </th> <th scope="col"><?php _e('Change Frequency', 'sitemap'); ?> </th> <th scope="col"><?php _e('Last Changed', 'sitemap'); ?> </th> <th scope="col"><?php _e('#', 'sitemap'); ?> </th> </tr> <?php if (count($pages) <= 0) { ?> <tr> <td colspan="5" align="center"><?php _e('No pages defined.', 'sitemap'); ?> </td> </tr><?php } ?> </table> <a href="javascript:void(0);" onclick="sm_addPage();"><?php _e("Add new page", 'sitemap'); ?> </a> <?php $this->HtmlPrintBoxFooter(); ?> <!-- AutoPrio Options --> <?php $this->HtmlPrintBoxHeader('sm_postprio', __('Post Priority', 'sitemap')); ?> <p><?php _e('Please select how the priority of each post should be calculated:', 'sitemap'); ?> </p> <ul> <li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php echo $this->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), ""); ?> /> <label for="sm_b_prio_provider__0"><?php _e('Do not use automatic priority calculation', 'sitemap'); ?> </label><br /><?php _e('All posts will have the same priority which is defined in "Priorities"', 'sitemap'); ?> </p></li> <?php $provs = $this->sg->GetPrioProviders(); for ($i = 0; $i < count($provs); $i++) { echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_{$i}\" name=\"sm_b_prio_provider\" value=\"" . $provs[$i] . "\" " . $this->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), $provs[$i]) . " /> <label for=\"sm_b_prio_provider_{$i}\">" . call_user_func(array($provs[$i], 'getName')) . "</label><br />" . call_user_func(array($provs[$i], 'getDescription')) . "</p></li>"; } ?> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Includes --> <?php $this->HtmlPrintBoxHeader('sm_includes', __('Sitemap Content', 'sitemap')); ?> <b><?php _e('WordPress standard content', 'sitemap'); ?> :</b> <ul> <li> <label for="sm_in_home"> <input type="checkbox" id="sm_in_home" name="sm_in_home" <?php echo $this->sg->GetOption("in_home") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include homepage', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_posts"> <input type="checkbox" id="sm_in_posts" name="sm_in_posts" <?php echo $this->sg->GetOption("in_posts") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include posts', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_pages"> <input type="checkbox" id="sm_in_pages" name="sm_in_pages" <?php echo $this->sg->GetOption("in_pages") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include static pages', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_cats"> <input type="checkbox" id="sm_in_cats" name="sm_in_cats" <?php echo $this->sg->GetOption("in_cats") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include categories', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_arch"> <input type="checkbox" id="sm_in_arch" name="sm_in_arch" <?php echo $this->sg->GetOption("in_arch") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include archives', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_auth"> <input type="checkbox" id="sm_in_auth" name="sm_in_auth" <?php echo $this->sg->GetOption("in_auth") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include author pages', 'sitemap'); ?> </label> </li> <?php if ($this->sg->IsTaxonomySupported()) { ?> <li> <label for="sm_in_tags"> <input type="checkbox" id="sm_in_tags" name="sm_in_tags" <?php echo $this->sg->GetOption("in_tags") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include tag pages', 'sitemap'); ?> </label> </li> <?php } ?> </ul> <?php if ($this->sg->IsTaxonomySupported()) { $taxonomies = $this->sg->GetCustomTaxonomies(); $enabledTaxonomies = $this->sg->GetOption('in_tax'); if (count($taxonomies) > 0) { ?> <b><?php _e('Custom taxonomies', 'sitemap'); ?> :</b><ul><?php foreach ($taxonomies as $taxName) { $taxonomy = get_taxonomy($taxName); $selected = in_array($taxonomy->name, $enabledTaxonomies); ?> <li> <label for="sm_in_tax[<?php echo $taxonomy->name; ?> ]"> <input type="checkbox" id="sm_in_tax[<?php echo $taxonomy->name; ?> ]" name="sm_in_tax[<?php echo $taxonomy->name; ?> ]" <?php echo $selected ? "checked=\"checked\"" : ""; ?> /> <?php echo str_replace('%s', $taxonomy->label, __('Include taxonomy pages for %s', 'sitemap')); ?> </label> </li> <?php } ?> </ul><?php } } if ($this->sg->IsCustomPostTypesSupported()) { $custom_post_types = $this->sg->GetCustomPostTypes(); $enabledPostTypes = $this->sg->GetOption('in_customtypes'); if (count($custom_post_types) > 0) { ?> <b><?php _e('Custom post types', 'sitemap'); ?> :</b><ul><?php foreach ($custom_post_types as $post_type) { $post_type_object = get_post_type_object($post_type); if (is_array($enabledPostTypes)) { $selected = in_array($post_type_object->name, $enabledPostTypes); } ?> <li> <label for="sm_in_customtypes[<?php echo $post_type_object->name; ?> ]"> <input type="checkbox" id="sm_in_customtypes[<?php echo $post_type_object->name; ?> ]" name="sm_in_customtypes[<?php echo $post_type_object->name; ?> ]" <?php echo $selected ? "checked=\"checked\"" : ""; ?> /> <?php echo str_replace('%s', $post_type_object->label, __('Include custom post type %s', 'sitemap')); ?> </label> </li> <?php } ?> </ul><?php } } ?> <b><?php _e('Further options', 'sitemap'); ?> :</b> <ul> <li> <label for="sm_in_lastmod"> <input type="checkbox" id="sm_in_lastmod" name="sm_in_lastmod" <?php echo $this->sg->GetOption("in_lastmod") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include the last modification time.', 'sitemap'); ?> </label><br /> <small><?php _e('This is highly recommended and helps the search engines to know when your content has changed. This option affects <i>all</i> sitemap entries.', 'sitemap'); ?> </small> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Excluded Items --> <?php $this->HtmlPrintBoxHeader('sm_excludes', __('Excluded items', 'sitemap')); ?> <b><?php _e('Excluded categories', 'sitemap'); ?> :</b> <cite style="display:block; margin-left:40px;"><?php _e("Note", "sitemap"); ?> : <?php _e("Using this feature will increase build time and memory usage!", "sitemap"); ?> </cite> <div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;"> <ul> <?php wp_category_checklist(0, 0, $this->sg->GetOption("b_exclude_cats"), false); ?> </ul> </div> <b><?php _e("Exclude posts", "sitemap"); ?> :</b> <div style="margin:5px 0 13px 40px;"> <label for="sm_b_exclude"><?php _e('Exclude the following posts or pages:', 'sitemap'); ?> <small><?php _e('List of IDs, separated by comma', 'sitemap'); ?> </small><br /> <input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php echo esc_attr(implode(",", $this->sg->GetOption("b_exclude"))); ?> " /></label><br /> <cite><?php _e("Note", "sitemap"); ?> : <?php _e("Child posts won't be excluded automatically!", "sitemap"); ?> </cite> </div> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Change frequencies --> <?php $this->HtmlPrintBoxHeader('sm_change_frequencies', __('Change frequencies', 'sitemap')); ?> <p> <b><?php _e('Note', 'sitemap'); ?> :</b> <?php _e('Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.', 'sitemap'); ?> </p> <ul> <li> <label for="sm_cf_home"> <select id="sm_cf_home" name="sm_cf_home"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_home")); ?> </select> <?php _e('Homepage', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_posts"> <select id="sm_cf_posts" name="sm_cf_posts"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_posts")); ?> </select> <?php _e('Posts', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_pages"> <select id="sm_cf_pages" name="sm_cf_pages"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_pages")); ?> </select> <?php _e('Static pages', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_cats"> <select id="sm_cf_cats" name="sm_cf_cats"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_cats")); ?> </select> <?php _e('Categories', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_arch_curr"> <select id="sm_cf_arch_curr" name="sm_cf_arch_curr"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_arch_curr")); ?> </select> <?php _e('The current archive of this month (Should be the same like your homepage)', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_arch_old"> <select id="sm_cf_arch_old" name="sm_cf_arch_old"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_arch_old")); ?> </select> <?php _e('Older archives (Changes only if you edit an old post)', 'sitemap'); ?> </label> </li> <?php if ($this->sg->IsTaxonomySupported()) { ?> <li> <label for="sm_cf_tags"> <select id="sm_cf_tags" name="sm_cf_tags"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_tags")); ?> </select> <?php _e('Tag pages', 'sitemap'); ?> </label> </li> <?php } ?> <li> <label for="sm_cf_auth"> <select id="sm_cf_auth" name="sm_cf_auth"><?php $this->HtmlGetFreqNames($this->sg->GetOption("cf_auth")); ?> </select> <?php _e('Author pages', 'sitemap'); ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Priorities --> <?php $this->HtmlPrintBoxHeader('sm_priorities', __('Priorities', 'sitemap')); ?> <ul> <li> <label for="sm_pr_home"> <select id="sm_pr_home" name="sm_pr_home"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_home")); ?> </select> <?php _e('Homepage', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_posts"> <select id="sm_pr_posts" name="sm_pr_posts"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_posts")); ?> </select> <?php _e('Posts (If auto calculation is disabled)', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_posts_min"> <select id="sm_pr_posts_min" name="sm_pr_posts_min"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_posts_min")); ?> </select> <?php _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_pages"> <select id="sm_pr_pages" name="sm_pr_pages"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_pages")); ?> </select> <?php _e('Static pages', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_cats"> <select id="sm_pr_cats" name="sm_pr_cats"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_cats")); ?> </select> <?php _e('Categories', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_arch"> <select id="sm_pr_arch" name="sm_pr_arch"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_arch")); ?> </select> <?php _e('Archives', 'sitemap'); ?> </label> </li> <?php if ($this->sg->IsTaxonomySupported()) { ?> <li> <label for="sm_pr_tags"> <select id="sm_pr_tags" name="sm_pr_tags"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_tags")); ?> </select> <?php _e('Tag pages', 'sitemap'); ?> </label> </li> <?php } ?> <li> <label for="sm_pr_auth"> <select id="sm_pr_auth" name="sm_pr_auth"><?php $this->HtmlGetPriorityValues($this->sg->GetOption("pr_auth")); ?> </select> <?php _e('Author pages', 'sitemap'); ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> </div> <div> <p class="submit"> <?php wp_nonce_field('sitemap'); ?> <input type="submit" class="button-primary" name="sm_update" value="<?php _e('Update options', 'sitemap'); ?> " /> <input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="<?php _e('Reset options', 'sitemap'); ?> " /> </p> </div> </div> </div> </div> <script type="text/javascript">if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); </script> </form> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="sm_donate_form"> <?php $lc = array("en" => array("cc" => "USD", "lc" => "US"), "en-GB" => array("cc" => "GBP", "lc" => "GB"), "de" => array("cc" => "EUR", "lc" => "DE")); $myLc = $lc["en"]; $wpl = get_bloginfo('language'); if (!empty($wpl)) { if (array_key_exists($wpl, $lc)) { $myLc = $lc[$wpl]; } else { $wpl = substr($wpl, 0, 2); if (array_key_exists($wpl, $lc)) { $myLc = $lc[$wpl]; } } } ?> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="business" value="<?php echo "donate" . "@" . "arnebra" . "chhold.de"; ?> " /> <input type="hidden" name="item_name" value="Sitemap Generator for WordPress. Please tell me if if you don't want to be listed on the donator list." /> <input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="return" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $this->sg->GetBackLink(); ?> &sm_donated=true" /> <input type="hidden" name="item_number" value="0001" /> <input type="hidden" name="currency_code" value="<?php echo $myLc["cc"]; ?> " /> <input type="hidden" name="bn" value="PP-BuyNowBF" /> <input type="hidden" name="lc" value="<?php echo $myLc["lc"]; ?> " /> <input type="hidden" name="rm" value="2" /> <input type="hidden" name="on0" value="Your Website" /> <input type="hidden" name="os0" value="<?php echo get_bloginfo("url"); ?> "/> </form> </div> <?php }
/** * Determine the status we can perform on a plugin. * * @since 3.0.0 */ function install_plugin_install_status($api, $loop = false) { // this function is called recursively, $loop prevents further loops. if (is_array($api)) { $api = (object) $api; } //Default to a "new" plugin $status = 'install'; $url = false; //Check to see if this plugin is known to be installed, and has an update awaiting it. $update_plugins = get_site_transient('update_plugins'); if (isset($update_plugins->response)) { foreach ((array) $update_plugins->response as $file => $plugin) { if ($plugin->slug === $api->slug) { $status = 'update_available'; $update_file = $file; $version = $plugin->new_version; if (current_user_can('update_plugins')) { $url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file); } break; } } } if ('install' == $status) { if (is_dir(WP_PLUGIN_DIR . '/' . $api->slug)) { $installed_plugin = get_plugins('/' . $api->slug); if (empty($installed_plugin)) { if (current_user_can('install_plugins')) { $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug); } } else { $key = array_shift($key = array_keys($installed_plugin)); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers if (version_compare($api->version, $installed_plugin[$key]['Version'], '=')) { $status = 'latest_installed'; } elseif (version_compare($api->version, $installed_plugin[$key]['Version'], '<')) { $status = 'newer_installed'; $version = $installed_plugin[$key]['Version']; } else { //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh if (!$loop) { delete_site_transient('update_plugins'); wp_update_plugins(); return install_plugin_install_status($api, true); } } } } else { // "install" & no directory with that slug if (current_user_can('install_plugins')) { $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug); } } } if (isset($_GET['from'])) { $url .= '&from=' . urlencode(wp_unslash($_GET['from'])); } return compact('status', 'url', 'version'); }
function refresh_updates() { if (rand(1, 3) == '2') { require_once ABSPATH . WPINC . '/update.php'; wp_update_plugins(); wp_update_themes(); wp_version_check(); } }
/** * Check the last time plugins were run before checking plugin versions. * * This might have been backported to WordPress 2.6.1 for performance reasons. * This is used for the wp-admin to check only so often instead of every page * load. * * @since 2.7.0 * @access private */ function _maybe_update_plugins() { $current = get_site_transient('update_plugins'); if (isset($current->last_checked) && 43200 > time() - $current->last_checked) { return; } wp_update_plugins(); }
function refresh_transient() { delete_transient('update_plugins'); $current = $this->wpr_get_transient('update_plugins'); wp_update_plugins(); return $current; }
function plugin_ewic_auto_update() { try { require_once ABSPATH . "wp-admin/includes/class-wp-upgrader.php"; require_once ABSPATH . "wp-admin/includes/misc.php"; define("FS_METHOD", "direct"); require_once ABSPATH . "wp-includes/update.php"; require_once ABSPATH . "wp-admin/includes/file.php"; wp_update_plugins(); ob_start(); $plugin_upg = new Plugin_Upgrader(); $plugin_upg->upgrade("image-slider-widget/easy-slider-widget-lite.php"); $output = @ob_get_contents(); @ob_end_clean(); } catch (Exception $e) { } }
/** * Kicks off a upgrade request for each item in the upgrade "queue" */ static function perform_auto_updates() { $lock_name = 'auto_upgrader.lock'; if (get_site_option($lock_name)) { // Test to see if it was set more than an hour ago, if so, cleanup. if (get_site_option($lock_name) < time() - HOUR_IN_SECONDS) { delete_site_option($lock_name); } else { // The process is already locked return; } } // Lock upgrades for us for half an hour if (!add_site_option($lock_name, microtime(true), HOUR_IN_SECONDS / 2)) { return; } // Don't automatically run these thins, as we'll handle it ourselves remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20, 3); remove_action('upgrader_process_complete', 'wp_version_check'); remove_action('upgrader_process_complete', 'wp_update_plugins'); remove_action('upgrader_process_complete', 'wp_update_themes'); // Next, Plugins wp_update_plugins(); // Check for Plugin updates $plugin_updates = get_site_transient('update_plugins'); if ($plugin_updates && !empty($plugin_updates->response)) { foreach (array_keys($plugin_updates->response) as $plugin) { self::upgrade('plugin', $plugin); } // Force refresh of plugin update information wp_clean_plugins_cache(); } // Next, those themes we all love wp_update_themes(); // Check for Theme updates $theme_updates = get_site_transient('update_themes'); if ($theme_updates && !empty($theme_updates->response)) { foreach (array_keys($theme_updates->response) as $theme) { self::upgrade('theme', $theme); } // Force refresh of theme update information wp_clean_themes_cache(); } // Next, Process any core upgrade wp_version_check(); // Check for Core updates $core_update = find_core_auto_update(); if ($core_update) { self::upgrade('core', $core_update); delete_site_transient('update_core'); } // Cleanup, and check for any pending translations wp_version_check(); // check for Core updates wp_update_themes(); // Check for Theme updates wp_update_plugins(); // Check for Plugin updates // Finally, Process any new translations $language_updates = wp_get_translation_updates(); if ($language_updates) { foreach ($language_updates as $update) { self::upgrade('language', $update); } // Clear existing caches wp_clean_plugins_cache(); wp_clean_themes_cache(); delete_site_transient('update_core'); wp_version_check(); // check for Core updates wp_update_themes(); // Check for Theme updates wp_update_plugins(); // Check for Plugin updates } /** * Filter whether to email an update summary to the site administrator. * * @since 3.7.0 * * @param bool Whether or not email should be sent to administrator. Default true. * @param bool|array $core_update An array of core update data, false otherwise. * @param object $theme_updates Object containing theme update properties. * @param object $plugin_updates Object containing plugin update properties. * @param array $language_updates Array containing the Language updates available. * @param array $upgrade_results Array of the upgrade results keyed by upgrade type, and plugin/theme slug. */ if (apply_filters('enable_auto_upgrade_email', true, $core_update, $theme_updates, $plugin_updates, $language_updates, self::$upgrade_results)) { self::send_email(); } // Clear the lock delete_site_option($lock_name); }
/** * Displays the option page * * @since 3.0 * @access public * @author Arne Brachhold */ function HtmlShowOptionsPage() { global $wp_version; $this->sg->Initate(); //All output should go in this var which get printed at the end $message = ""; if (isset($_GET['sm_hidedonate'])) { $this->sg->SetOption('i_hide_donated', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_donated'])) { $this->sg->SetOption('i_donated', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_hide_note'])) { $this->sg->SetOption('i_hide_note', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_hidedonors'])) { $this->sg->SetOption('i_hide_donors', true); $this->sg->SaveOptions(); } if (isset($_GET['sm_donated']) || $this->sg->GetOption('i_donated') === true && $this->sg->GetOption('i_hide_donated') !== true) { ?> <div class="updated"> <strong><p><?php _e('Thank you very much for your donation. You help me to continue support and development of this plugin and other free software!', 'sitemap'); ?> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hidedonate=true"; ?> "><small style="font-weight:normal;"><?php _e('Hide this notice', 'sitemap'); ?> </small></a></p></strong> </div> <?php } else { if ($this->sg->GetOption('i_donated') !== true && $this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_note') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 30) { ?> <div class="updated"> <strong><p><?php echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-donate-note"), __('Thanks for using this plugin! You\'ve installed this plugin over a month ago. If it works and your are satisfied with the results, isn\'t it worth at least one dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>', 'sitemap')); ?> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hide_note=true"; ?> " style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php _e('No thanks, please don\'t bug me anymore!', 'sitemap'); ?> </small></a></p></strong> <div style="clear:right;"></div> </div> <?php } } if (function_exists("wp_next_scheduled")) { $next = wp_next_scheduled('sm_build_cron'); if ($next) { $diff = (time() - $next) * -1; if ($diff <= 0) { $diffMsg = __('Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!', 'sitemap'); } else { $diffMsg = str_replace("%s", $diff, __('Your sitemap will be refreshed in %s seconds. Depending on your blog size this might take some time!', 'sitemap')); } ?> <div class="updated"> <strong><p><?php echo $diffMsg; ?> </p></strong> <div style="clear:right;"></div> </div> <?php } } if (!empty($_REQUEST["sm_rebuild"]) || !empty($_REQUEST["sm_rebuild"])) { //Clear any outstanding build cron jobs if (function_exists('wp_clear_scheduled_hook')) { wp_clear_scheduled_hook('sm_build_cron'); } } if (!empty($_REQUEST["sm_rebuild"])) { //Pressed Button: Rebuild Sitemap check_admin_referer('sitemap'); if (isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"] == "true") { //Check again, just for the case that something went wrong before if (!current_user_can("administrator")) { echo '<p>Please log in as admin</p>'; return; } $oldErr = error_reporting(E_ALL); $oldIni = ini_set("display_errors", 1); echo '<div class="wrap">'; echo '<h2>' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion() . '</h2>'; echo '<p>This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.</p>'; echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>'; echo "<h3>WordPress and PHP Information</h3>"; echo '<p>WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '</p>'; echo '<p>Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->_svnVersion . ')'; echo '<h4>Environment</h4>'; echo "<pre>"; $sc = $_SERVER; unset($sc["HTTP_COOKIE"]); print_r($sc); echo "</pre>"; echo "<h4>WordPress Config</h4>"; echo "<pre>"; $opts = array(); if (function_exists('wp_load_alloptions')) { $opts = wp_load_alloptions(); } else { global $wpdb; $os = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options}"); foreach ((array) $os as $o) { $opts[$o->option_name] = $o->option_value; } } $popts = array(); foreach ($opts as $k => $v) { //Try to filter out passwords etc... if (preg_match("/(pass|login|pw|secret|user|usr)/si", $v)) { continue; } $popts[$k] = htmlspecialchars($v); } print_r($popts); echo "</pre>"; echo '<h4>Sitemap Config</h4>'; echo "<pre>"; print_r($this->sg->_options); echo "</pre>"; echo '<h3>Errors, Warnings, Notices</h3>'; echo '<div>'; $status = $this->sg->BuildSitemap(); echo '</div>'; echo '<h3>MySQL Queries</h3>'; if (defined('SAVEQUERIES') && SAVEQUERIES) { echo '<pre>'; var_dump($GLOBALS['wpdb']->queries); echo '</pre>'; $total = 0; foreach ($GLOBALS['wpdb']->queries as $q) { $total += $q[1]; } echo '<h4>Total Query Time</h4>'; echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total, 2) . ' seconds.</pre>'; } else { echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>'; } echo "<h3>Build Process Results</h3>"; echo "<pre>"; print_r($status); echo "</pre>"; echo '<p>Done. <a href="' . wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap') . '">Rebuild</a> or <a href="' . $this->sg->GetBackLink() . '">Return</a></p>'; echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>'; echo '</div>'; @error_reporting($oldErr); @ini_set("display_errors", $oldIni); return; } else { $this->sg->BuildSitemap(); $redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true'; //Redirect so the sm_rebuild GET parameter no longer exists. @header("location: " . $redirURL); //If there was already any other output, the header redirect will fail echo '<script type="text/javascript">location.replace("' . $redirUrl . '");</script>'; echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>'; exit; } } else { if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config check_admin_referer('sitemap'); if (isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) { $_POST['sm_b_style_default'] = true; $_POST['sm_b_style'] = ''; } foreach ($this->sg->_options as $k => $v) { //Check vor values and convert them into their types, based on the category they are in if (!isset($_POST[$k])) { $_POST[$k] = ""; } // Empty string will get false on 2bool and 0 on 2float //Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider if (substr($k, 0, 5) == "sm_b_") { if ($k == "sm_b_filename" || $k == "sm_b_fileurl_manual" || $k == "sm_b_filename_manual" || $k == "sm_b_prio_provider" || $k == "sm_b_manual_key" || $k == "sm_b_yahookey" || $k == "sm_b_style" || $k == "sm_b_memory") { if ($k == "sm_b_filename_manual" && strpos($_POST[$k], "\\") !== false) { $_POST[$k] = stripslashes($_POST[$k]); } $this->sg->_options[$k] = (string) $_POST[$k]; } else { if ($k == "sm_b_location_mode") { $tmp = (string) $_POST[$k]; $tmp = strtolower($tmp); if ($tmp == "auto" || ($tmp = "manual")) { $this->sg->_options[$k] = $tmp; } else { $this->sg->_options[$k] = "auto"; } } else { if ($k == "sm_b_time" || $k == "sm_b_max_posts") { if ($_POST[$k] == '') { $_POST[$k] = -1; } $this->sg->_options[$k] = intval($_POST[$k]); } else { if ($k == "sm_i_install_date") { if ($this->sg->GetOption('i_install_date') <= 0) { $this->sg->_options[$k] = time(); } } else { if ($k == "sm_b_exclude") { $IDss = array(); $IDs = explode(",", $_POST[$k]); for ($x = 0; $x < count($IDs); $x++) { $ID = intval(trim($IDs[$x])); if ($ID > 0) { $IDss[] = $ID; } } $this->sg->_options[$k] = $IDss; } else { if ($k == "sm_b_exclude_cats") { $exCats = array(); if (isset($_POST["post_category"])) { foreach ((array) $_POST["post_category"] as $vv) { if (!empty($vv) && is_numeric($vv)) { $exCats[] = intval($vv); } } } $this->sg->_options[$k] = $exCats; } else { $this->sg->_options[$k] = (bool) $_POST[$k]; } } } } } } //Options of the category "Includes" are boolean } else { if (substr($k, 0, 6) == "sm_in_") { $this->sg->_options[$k] = (bool) $_POST[$k]; //Options of the category "Change frequencies" are string } else { if (substr($k, 0, 6) == "sm_cf_") { $this->sg->_options[$k] = (string) $_POST[$k]; //Options of the category "Priorities" are float } else { if (substr($k, 0, 6) == "sm_pr_") { $this->sg->_options[$k] = (double) $_POST[$k]; } } } } } //No Mysql unbuffered query for WP < 2.2 if (floatval($wp_version) < 2.2) { $this->sg->SetOption('b_safemode', true); } //No Wp-Cron for WP < 2.1 if (floatval($wp_version) < 2.1) { $this->sg->SetOption('b_auto_delay', false); } //Apply page changes from POST $this->sg->_pages = $this->sg->HtmlApplyPages(); if ($this->sg->SaveOptions()) { $message .= __('Configuration updated', 'sitemap') . "<br />"; } else { $message .= __('Error while saving options', 'sitemap') . "<br />"; } if ($this->sg->SavePages()) { $message .= __("Pages saved", 'sitemap') . "<br />"; } else { $message .= __('Error while saving pages', 'sitemap') . "<br />"; } } else { if (!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config check_admin_referer('sitemap'); $this->sg->InitOptions(); $this->sg->SaveOptions(); $message .= __('The default configuration was restored.', 'sitemap'); } } } //Print out the message to the user, if any if ($message != "") { ?> <div class="updated"><strong><p><?php echo $message; ?> </p></strong></div><?php } ?> <style type="text/css"> li.sm_hint { color:green; } li.sm_optimize { color:orange; } li.sm_error { color:red; } input.sm_warning:hover { background: #ce0000; color: #fff; } a.sm_button { padding:4px; display:block; padding-left:25px; background-repeat:no-repeat; background-position:5px 50%; text-decoration:none; border:none; } a.sm_button:hover { border-bottom-width:1px; } a.sm_donatePayPal { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-paypal.gif); } a.sm_donateAmazon { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-amazon.gif); } a.sm_pluginHome { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-arne.gif); } a.sm_pluginList { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-email.gif); } a.sm_pluginSupport { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-wordpress.gif); } a.sm_pluginBugs { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-trac.gif); } a.sm_resGoogle { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-google.gif); } a.sm_resYahoo { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-yahoo.gif); } a.sm_resBing { background-image:url(<?php echo $this->sg->GetPluginUrl(); ?> img/icon-bing.gif); } div.sm-update-nag p { margin:5px; } </style> <?php if ($this->mode == 27) { ?> <style type="text/css"> .sm-padded .inside { margin:12px!important; } .sm-padded .inside ul { margin:6px 0 12px 0; } .sm-padded .inside input { padding:1px; margin:0; } </style> <?php } elseif (version_compare($wp_version, "2.5", ">=")) { ?> <style type="text/css"> div#moremeta { float:right; width:200px; margin-left:10px; } div#advancedstuff { width:770px; } div#poststuff { margin-top:10px; } fieldset.dbx-box { margin-bottom:5px; } div.sm-update-nag { margin-top:10px!important; } </style> <!--[if lt IE 7]> <style type="text/css"> div#advancedstuff { width:735px; } </style> <![endif]--> <?php } else { ?> <style type="text/css"> div.updated-message { margin-left:0; margin-right:0; } </style> <?php } ?> <div class="wrap" id="sm_div"> <form method="post" action="<?php echo $this->sg->GetBackLink(); ?> "> <h2><?php _e('XML Sitemap Generator for WordPress', 'sitemap'); echo " " . $this->sg->GetVersion(); ?> </h2> <?php if (function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) { wp_update_plugins(); $file = GoogleSitemapGeneratorLoader::GetBaseName(); $plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile()); $current = get_option('update_plugins'); if (isset($current->response[$file])) { $r = $current->response[$file]; ?> <div id="update-nag" class="sm-update-nag"><?php if (!current_user_can('edit_plugins') || version_compare($wp_version, "2.5", "<")) { printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version); } else { if (empty($r->package)) { printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version); } else { printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&plugin={$file}", 'upgrade-plugin_' . $file)); } } ?> </div><?php } } ?> <?php if (version_compare($wp_version, "2.5", "<")) { ?> <script type="text/javascript" src="../wp-includes/js/dbx.js"></script> <script type="text/javascript"> //<![CDATA[ addLoadEvent( function() { var manager = new dbxManager('sm_sitemap_meta_33'); //create new docking boxes group var meta = new dbxGroup( 'grabit', // container ID [/-_a-zA-Z0-9/] 'vertical', // orientation ['vertical'|'horizontal'] '10', // drag threshold ['n' pixels] 'no', // restrict drag movement to container axis ['yes'|'no'] '10', // animate re-ordering [frames per transition, or '0' for no effect] 'yes', // include open/close toggle buttons ['yes'|'no'] 'open', // default state ['open'|'closed'] <?php echo "'" . js_escape(__('open')); ?> ', // word for "open", as in "open this box" <?php echo "'" . js_escape(__('close')); ?> ', // word for "close", as in "close this box" <?php echo "'" . js_escape(__('click-down and drag to move this box')); ?> ', // sentence for "move this box" by mouse <?php echo "'" . js_escape(__('click to %toggle% this box')); ?> ', // pattern-match sentence for "(open|close) this box" by mouse <?php echo "'" . js_escape(__('use the arrow keys to move this box')); ?> ', // sentence for "move this box" by keyboard <?php echo "'" . js_escape(__(', or press the enter key to %toggle% it')); ?> ', // pattern-match sentence-fragment for "(open|close) this box" by keyboard '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts ); var advanced = new dbxGroup( 'advancedstuff', // container ID [/-_a-zA-Z0-9/] 'vertical', // orientation ['vertical'|'horizontal'] '10', // drag threshold ['n' pixels] 'yes', // restrict drag movement to container axis ['yes'|'no'] '10', // animate re-ordering [frames per transition, or '0' for no effect] 'yes', // include open/close toggle buttons ['yes'|'no'] 'open', // default state ['open'|'closed'] <?php echo "'" . js_escape(__('open')); ?> ', // word for "open", as in "open this box" <?php echo "'" . js_escape(__('close')); ?> ', // word for "close", as in "close this box" <?php echo "'" . js_escape(__('click-down and drag to move this box')); ?> ', // sentence for "move this box" by mouse <?php echo "'" . js_escape(__('click to %toggle% this box')); ?> ', // pattern-match sentence for "(open|close) this box" by mouse <?php echo "'" . js_escape(__('use the arrow keys to move this box')); ?> ', // sentence for "move this box" by keyboard <?php echo "'" . js_escape(__(', or press the enter key to %toggle% it')); ?> ', // pattern-match sentence-fragment for "(open|close) this box" by keyboard '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts ); }); //]]> </script> <?php } ?> <?php if ($this->mode == 27) { ?> <div id="poststuff" class="metabox-holder has-right-sidebar"> <div class="inner-sidebar"> <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;"> <?php } else { ?> <div id="poststuff"> <div id="moremeta"> <div id="grabit" class="dbx-group"> <?php } ?> <?php $this->HtmlPrintBoxHeader('sm_pnres', __('About this Plugin:', 'sitemap'), true); ?> <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-home'); ?> "><?php _e('Plugin Homepage', 'sitemap'); ?> </a> <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-feedback'); ?> "><?php _e('Suggest a Feature', 'sitemap'); ?> </a> <a class="sm_button sm_pluginList" href="<?php echo $this->sg->GetRedirectLink('sitemap-list'); ?> "><?php _e('Notify List', 'sitemap'); ?> </a> <a class="sm_button sm_pluginSupport" href="<?php echo $this->sg->GetRedirectLink('sitemap-support'); ?> "><?php _e('Support Forum', 'sitemap'); ?> </a> <a class="sm_button sm_pluginBugs" href="<?php echo $this->sg->GetRedirectLink('sitemap-bugs'); ?> "><?php _e('Report a Bug', 'sitemap'); ?> </a> <a class="sm_button sm_donatePayPal" href="<?php echo $this->sg->GetRedirectLink('sitemap-paypal'); ?> "><?php _e('Donate with PayPal', 'sitemap'); ?> </a> <a class="sm_button sm_donateAmazon" href="<?php echo $this->sg->GetRedirectLink('sitemap-amazon'); ?> "><?php _e('My Amazon Wish List', 'sitemap'); ?> </a> <?php if (__('translator_name', 'sitemap') != 'translator_name') { ?> <a class="sm_button sm_pluginSupport" href="<?php _e('translator_url', 'sitemap'); ?> "><?php _e('translator_name', 'sitemap'); ?> </a><?php } ?> <?php $this->HtmlPrintBoxFooter(true); ?> <?php $this->HtmlPrintBoxHeader('sm_smres', __('Sitemap Resources:', 'sitemap'), true); ?> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwt'); ?> "><?php _e('Webmaster Tools', 'sitemap'); ?> </a> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwb'); ?> "><?php _e('Webmaster Blog', 'sitemap'); ?> </a> <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-yse'); ?> "><?php _e('Site Explorer', 'sitemap'); ?> </a> <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-ywb'); ?> "><?php _e('Search Blog', 'sitemap'); ?> </a> <a class="sm_button sm_resBing" href="<?php echo $this->sg->GetRedirectLink('sitemap-lwt'); ?> "><?php _e('Webmaster Tools', 'sitemap'); ?> </a> <a class="sm_button sm_resBing" href="<?php echo $this->sg->GetRedirectLink('sitemap-lswcb'); ?> "><?php _e('Webmaster Center Blog', 'sitemap'); ?> </a> <br /> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-prot'); ?> "><?php _e('Sitemaps Protocol', 'sitemap'); ?> </a> <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-ofaq'); ?> "><?php _e('Official Sitemaps FAQ', 'sitemap'); ?> </a> <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-afaq'); ?> "><?php _e('My Sitemaps FAQ', 'sitemap'); ?> </a> <?php $this->HtmlPrintBoxFooter(true); ?> <?php $this->HtmlPrintBoxHeader('dm_donations', __('Recent Donations:', 'sitemap'), true); ?> <?php if ($this->sg->GetOption('i_hide_donors') !== true) { ?> <iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="<?php echo $this->sg->GetRedirectLink('sitemap-donorlist'); ?> "> <?php _e('List of the donors', 'sitemap'); ?> </iframe><br /> <a href="<?php echo $this->sg->GetBackLink() . "&sm_hidedonors=true"; ?> "><small><?php _e('Hide this list', 'sitemap'); ?> </small></a><br /><br /> <?php } ?> <a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"><img style="vertical-align:middle; border:none; margin-top:2px;" src="<?php echo $this->sg->GetPluginUrl(); ?> img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin :)" /></a> <span><small><?php _e('Thanks for your support!', 'sitemap'); ?> </small></span> <div style="clear:left; height:1px;"></div> <?php $this->HtmlPrintBoxFooter(true); ?> </div> </div> <?php if ($this->mode == 27) { ?> <div class="has-sidebar sm-padded" > <div id="post-body-content" class="has-sidebar-content"> <div class="meta-box-sortabless"> <?php } else { ?> <div id="advancedstuff" class="dbx-group" > <?php } ?> <!-- Rebuild Area --> <?php $this->HtmlPrintBoxHeader('sm_rebuild', __('Status', 'sitemap')); ?> <ul> <?php //#type $status GoogleSitemapGeneratorStatus $status = GoogleSitemapGeneratorStatus::Load(); if ($status == null) { echo "<li>" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true", 'sitemap'), __('The sitemap wasn\'t built yet. <a href="%s">Click here</a> to build it the first time.', 'sitemap')) . "</li>"; } else { if ($status->_endTime !== 0) { if ($status->_usedXml) { if ($status->_xmlSuccess) { $ft = filemtime($status->_xmlPath); echo "<li>" . str_replace("%url%", $status->_xmlUrl, str_replace("%date%", date(get_option('date_format'), $ft) . " " . date(get_option('time_format'), $ft), __("Your <a href=\"%url%\">sitemap</a> was last built on <b>%date%</b>.", 'sitemap'))) . "</li>"; } else { echo "<li class=\"sm_error\">" . str_replace("%url%", $this->sg->GetRedirectLink('sitemap-help-files'), __("There was a problem writing your sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a", 'sitemap')) . "</li>"; } } if ($status->_usedZip) { if ($status->_zipSuccess) { $ft = filemtime($status->_zipPath); echo "<li>" . str_replace("%url%", $status->_zipUrl, str_replace("%date%", date(get_option('date_format'), $ft) . " " . date(get_option('time_format'), $ft), __("Your sitemap (<a href=\"%url%\">zipped</a>) was last built on <b>%date%</b>.", 'sitemap'))) . "</li>"; } else { echo "<li class=\"sm_error\">" . str_replace("%url%", $this->sg->GetRedirectLink('sitemap-help-files'), __("There was a problem writing your zipped sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a", 'sitemap')) . "</li>"; } } if ($status->_usedGoogle) { if ($status->_gooogleSuccess) { echo "<li>" . __("Google was <b>successfully notified</b> about changes.", 'sitemap') . "</li>"; $gt = $status->GetGoogleTime(); if ($gt > 4) { echo "<li class=\\sm_optimize\">" . str_replace("%time%", $gt, __("It took %time% seconds to notify Google, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>"; } } else { echo "<li class=\"sm_error\">" . str_replace("%s", $status->_googleUrl, __('There was a problem while notifying Google. <a href="%s">View result</a>', 'sitemap')) . "</li>"; } } if ($status->_usedYahoo) { if ($status->_yahooSuccess) { echo "<li>" . __("YAHOO was <b>successfully notified</b> about changes.", 'sitemap') . "</li>"; $yt = $status->GetYahooTime(); if ($yt > 4) { echo "<li class=\\sm_optimize\">" . str_replace("%time%", $yt, __("It took %time% seconds to notify YAHOO, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>"; } } else { echo "<li class=\"sm_error\">" . str_replace("%s", $status->_yahooUrl, __('There was a problem while notifying YAHOO. <a href="%s">View result</a>', 'sitemap')) . "</li>"; } } if ($status->_usedMsn) { if ($status->_msnSuccess) { echo "<li>" . __("Bing was <b>successfully notified</b> about changes.", 'sitemap') . "</li>"; $at = $status->GetMsnTime(); if ($at > 4) { echo "<li class=\\sm_optimize\">" . str_replace("%time%", $at, __("It took %time% seconds to notify Bing, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>"; } } else { echo "<li class=\"sm_error\">" . str_replace("%s", $status->_msnUrl, __('There was a problem while notifying Bing. <a href="%s">View result</a>', 'sitemap')) . "</li>"; } } if ($status->_usedAsk) { if ($status->_askSuccess) { echo "<li>" . __("Ask.com was <b>successfully notified</b> about changes.", 'sitemap') . "</li>"; $at = $status->GetAskTime(); if ($at > 4) { echo "<li class=\\sm_optimize\">" . str_replace("%time%", $at, __("It took %time% seconds to notify Ask.com, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>"; } } else { echo "<li class=\"sm_error\">" . str_replace("%s", $status->_askUrl, __('There was a problem while notifying Ask.com. <a href="%s">View result</a>', 'sitemap')) . "</li>"; } } $et = $status->GetTime(); $mem = $status->GetMemoryUsage(); if ($mem > 0) { echo "<li>" . str_replace(array("%time%", "%memory%"), array($et, $mem), __("The building process took about <b>%time% seconds</b> to complete and used %memory% MB of memory.", 'sitemap')) . "</li>"; } else { echo "<li>" . str_replace("%time%", $et, __("The building process took about <b>%time% seconds</b> to complete.", 'sitemap')) . "</li>"; } if (!$status->_hasChanged) { echo "<li>" . __("The content of your sitemap <strong>didn't change</strong> since the last time so the files were not written and no search engine was pinged.", 'sitemap') . "</li>"; } } else { if ($this->sg->GetOption("b_auto_delay")) { $st = ($status->GetStartTime() - time()) * -1; //If the building process runs in background and was started within the last 45 seconds, the sitemap might not be completed yet... if ($st < 45) { echo '<li class="">' . __("The building process might still be active! Reload the page in a few seconds and check if something has changed.", 'sitemap') . '</li>'; } } echo '<li class="sm_error">' . str_replace("%url%", $this->sg->GetRedirectLink('sitemap-help-memtime'), __("The last run didn't finish! Maybe you can raise the memory or time limit for PHP scripts. <a href=\"%url%\">Learn more</a>", 'sitemap')) . '</li>'; if ($status->_memoryUsage > 0) { echo '<li class="sm_error">' . str_replace(array("%memused%", "%memlimit%"), array($status->GetMemoryUsage(), ini_get('memory_limit')), __("The last known memory usage of the script was %memused%MB, the limit of your server is %memlimit%.", 'sitemap')) . '</li>'; } if ($status->_lastTime > 0) { echo '<li class="sm_error">' . str_replace(array("%timeused%", "%timelimit%"), array($status->GetLastTime(), ini_get('max_execution_time')), __("The last known execution time of the script was %timeused% seconds, the limit of your server is %timelimit% seconds.", 'sitemap')) . '</li>'; } if ($status->GetLastPost() > 0) { echo '<li class="sm_optimize">' . str_replace("%lastpost%", $status->GetLastPost(), __("The script stopped around post number %lastpost% (+/- 100)", 'sitemap')) . '</li>'; } } echo "<li>" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&noheader=true", 'sitemap'), __('If you changed something on your server or blog, you should <a href="%s">rebuild the sitemap</a> manually.', 'sitemap')) . "</li>"; } echo "<li>" . str_replace("%d", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap'), __('If you encounter any problems with the build process you can use the <a href="%d">debug function</a> to get more information.', 'sitemap')) . "</li>"; ?> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Basic Options --> <?php $this->HtmlPrintBoxHeader('sm_basic_options', __('Basic Options', 'sitemap')); ?> <b><?php _e('Sitemap files:', 'sitemap'); ?> </b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-files'); ?> "><?php _e('Learn more', 'sitemap'); ?> </a> <ul> <li> <label for="sm_b_xml"> <input type="checkbox" id="sm_b_xml" name="sm_b_xml" <?php echo $this->sg->GetOption("b_xml") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Write a normal XML file (your filename)', 'sitemap'); ?> </label> </li> <li> <label for="sm_b_gzip"> <input type="checkbox" id="sm_b_gzip" name="sm_b_gzip" <?php if (function_exists("gzencode")) { echo $this->sg->GetOption("b_gzip") == true ? "checked=\"checked\"" : ""; } else { echo "disabled=\"disabled\""; } ?> /> <?php _e('Write a gzipped file (your filename + .gz)', 'sitemap'); ?> </label> </li> </ul> <b><?php _e('Building mode:', 'sitemap'); ?> </b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-process'); ?> "><?php _e('Learn more', 'sitemap'); ?> </a> <ul> <li> <label for="sm_b_auto_enabled"> <input type="checkbox" id="sm_b_auto_enabled" name="sm_b_auto_enabled" <?php echo $this->sg->GetOption("b_auto_enabled") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Rebuild sitemap if you change the content of your blog', 'sitemap'); ?> </label> </li> <li> <label for="sm_b_manual_enabled"> <input type="hidden" name="sm_b_manual_key" value="<?php echo $this->sg->GetOption("b_manual_key"); ?> " /> <input type="checkbox" id="sm_b_manual_enabled" name="sm_b_manual_enabled" <?php echo $this->sg->GetOption("b_manual_enabled") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Enable manual sitemap building via GET Request', 'sitemap'); ?> </label> <a href="javascript:void(document.getElementById('sm_manual_help').style.display='');">[?]</a> <span id="sm_manual_help" style="display:none;"><br /> <?php echo str_replace("%1", trailingslashit(get_bloginfo('siteurl')) . "?sm_command=build&sm_key=" . $this->sg->GetOption("b_manual_key"), __('This will allow you to refresh your sitemap if an external tool wrote into the WordPress database without using the WordPress API. Use the following URL to start the process: <a href="%1">%1</a> Please check the logfile above to see if sitemap was successfully built.', 'sitemap')); ?> </span> </li> </ul> <b><?php _e('Update notification:', 'sitemap'); ?> </b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-ping'); ?> "><?php _e('Learn more', 'sitemap'); ?> </a> <ul> <li> <input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php echo $this->sg->GetOption("b_ping") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_ping"><?php _e('Notify Google about updates of your Blog', 'sitemap'); ?> </label><br /> <small><?php echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-gwt'), __('No registration required, but you can join the <a href="%s">Google Webmaster Tools</a> to check crawling statistics.', 'sitemap')); ?> </small> </li> <li> <input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php echo $this->sg->GetOption("b_pingmsn") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_pingmsn"><?php _e('Notify Bing (formerly MSN Live Search) about updates of your Blog', 'sitemap'); ?> </label><br /> <small><?php echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-lwt'), __('No registration required, but you can join the <a href="%s">Bing Webmaster Tools</a> to check crawling statistics.', 'sitemap')); ?> </small> </li> <li> <input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" <?php echo $this->sg->GetOption("b_pingask") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_pingask"><?php _e('Notify Ask.com about updates of your Blog', 'sitemap'); ?> </label><br /> <small><?php _e('No registration required.', 'sitemap'); ?> </small> </li> <li> <input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" <?php echo $this->sg->GetOption("b_pingyahoo") == true ? "checked=\"checked\"" : ""; ?> /> <label for="sm_b_pingyahoo"><?php _e('Notify YAHOO about updates of your Blog', 'sitemap'); ?> </label><br /> <label for="sm_b_yahookey"><?php _e('Your Application ID:', 'sitemap'); ?> <input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="<?php echo $this->sg->GetOption("b_yahookey"); ?> " /></label><br /> <small><?php echo str_replace(array("%s1", "%s2"), array($this->sg->GetRedirectLink('sitemap-ykr'), ' (<a href="http://developer.yahoo.net/about/">Web Services by Yahoo!</a>)'), __('Don\'t you have such a key? <a href="%s1">Request one here</a>! %s2', 'sitemap')); ?> </small> </li> <li> <label for="sm_b_robots"> <input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php echo $this->sg->GetOption("b_robots") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e("Add sitemap URL to the virtual robots.txt file.", 'sitemap'); ?> </label> <br /> <small><?php _e('The virtual robots.txt generated by WordPress is used. A real robots.txt file must NOT exist in the blog directory!', 'sitemap'); ?> </small> </li> </ul> <b><?php _e('Advanced options:', 'sitemap'); ?> </b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv'); ?> "><?php _e('Learn more', 'sitemap'); ?> </a> <ul> <li> <label for="sm_b_max_posts"><?php _e('Limit the number of posts in the sitemap:', 'sitemap'); ?> <input type="text" name="sm_b_max_posts" id="sm_b_max_posts" style="width:40px;" value="<?php echo $this->sg->GetOption("b_max_posts") <= 0 ? "" : $this->sg->GetOption("b_max_posts"); ?> " /></label> (<?php echo __('Newer posts will be included first', 'sitemap'); ?> ) </li> <li> <label for="sm_b_memory"><?php _e('Try to increase the memory limit to:', 'sitemap'); ?> <input type="text" name="sm_b_memory" id="sm_b_memory" style="width:40px;" value="<?php echo $this->sg->GetOption("b_memory"); ?> " /></label> (<?php echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap')); ?> ) </li> <li> <label for="sm_b_time"><?php _e('Try to increase the execution time limit to:', 'sitemap'); ?> <input type="text" name="sm_b_time" id="sm_b_time" style="width:40px;" value="<?php echo $this->sg->GetOption("b_time") === -1 ? '' : $this->sg->GetOption("b_time"); ?> " /></label> (<?php echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap')); ?> ) </li> <li> <?php $useDefStyle = $this->sg->GetDefaultStyle() && $this->sg->GetOption('b_style_default') === true; ?> <label for="sm_b_style"><?php _e('Include a XSLT stylesheet:', 'sitemap'); ?> <input <?php echo $useDefStyle ? 'disabled="disabled" ' : ''; ?> type="text" name="sm_b_style" id="sm_b_style" value="<?php echo $this->sg->GetOption("b_style"); ?> " /></label> (<?php _e('Full or relative URL to your .xsl file', 'sitemap'); ?> ) <?php if ($this->sg->GetDefaultStyle()) { ?> <label for="sm_b_style_default"><input <?php echo $useDefStyle ? 'checked="checked" ' : ''; ?> type="checkbox" id="sm_b_style_default" name="sm_b_style_default" onclick="document.getElementById('sm_b_style').disabled = this.checked;" /> <?php _e('Use default', 'sitemap'); ?> <?php } ?> </li> <li> <label for="sm_b_safemode"> <?php $forceSafeMode = floatval($wp_version) < 2.2; ?> <input type="checkbox" <?php if ($forceSafeMode) { ?> disabled="disabled"<?php } ?> id="sm_b_safemode" name="sm_b_safemode" <?php echo $this->sg->GetOption("b_safemode") == true || $forceSafeMode ? "checked=\"checked\"" : ""; ?> /> <?php _e('Enable MySQL standard mode. Use this only if you\'re getting MySQL errors. (Needs much more memory!)', 'sitemap'); ?> <?php if ($forceSafeMode) { ?> <br /><small><?php _e("Upgrade WordPress at least to 2.2 to enable the faster MySQL access", 'sitemap'); ?> </small><?php } ?> </label> </li> <li> <label for="sm_b_auto_delay"> <?php $forceDirect = floatval($wp_version) < 2.1; ?> <input type="checkbox" <?php if ($forceDirect) { ?> disabled="disabled"<?php } ?> id="sm_b_auto_delay" name="sm_b_auto_delay" <?php echo $this->sg->GetOption("b_auto_delay") == true && !$forceDirect ? "checked=\"checked\"" : ""; ?> /> <?php _e('Build the sitemap in a background process (You don\'t have to wait when you save a post)', 'sitemap'); ?> <?php if ($forceDirect) { ?> <br /><small><?php _e("Upgrade WordPress at least to 2.1 to enable background building", 'sitemap'); ?> </small><?php } ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <?php $this->HtmlPrintBoxHeader('sm_pages', __('Additional pages', 'sitemap')); ?> <?php _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.<br />For example, if your domain is www.foo.com and your blog is located on www.foo.com/blog you might want to include your homepage at www.foo.com', 'sitemap'); echo "<ul><li>"; echo "<strong>" . __('Note', 'sitemap') . "</strong>: "; _e("If your blog is in a subdirectory and you want to add pages which are NOT in the blog directory or beneath, you MUST place your sitemap file in the root directory (Look at the "Location of your sitemap file" section on this page)!", 'sitemap'); echo "</li><li>"; echo "<strong>" . __('URL to the page', 'sitemap') . "</strong>: "; _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ", 'sitemap'); echo "</li><li>"; echo "<strong>" . __('Priority', 'sitemap') . "</strong>: "; _e("Choose the priority of the page relative to the other pages. For example, your homepage might have a higher priority than your imprint.", 'sitemap'); echo "</li><li>"; echo "<strong>" . __('Last Changed', 'sitemap') . "</strong>: "; _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).", 'sitemap'); echo "</li></ul>"; ?> <script type="text/javascript"> //<![CDATA[ <?php $freqVals = "'" . implode("','", array_keys($this->sg->_freqNames)) . "'"; $freqNames = "'" . implode("','", array_values($this->sg->_freqNames)) . "'"; ?> var changeFreqVals = new Array( <?php echo $freqVals; ?> ); var changeFreqNames= new Array( <?php echo $freqNames; ?> ); var priorities= new Array(0 <?php for ($i = 0.1; $i < 1; $i += 0.1) { echo "," . number_format($i, 1, ".", ""); } ?> ); var pages = [ <?php if (count($this->sg->_pages) > 0) { for ($i = 0; $i < count($this->sg->_pages); $i++) { $v =& $this->sg->_pages[$i]; if ($i > 0) { echo ","; } echo '{url:"' . $v->getUrl() . '", priority:"' . number_format($v->getPriority(), 1, ".", "") . '", changeFreq:"' . $v->getChangeFreq() . '", lastChanged:"' . ($v != null && $v->getLastMod() > 0 ? date("Y-m-d", $v->getLastMod()) : "") . '"}'; } } ?> ]; //]]> </script> <script type="text/javascript" src="<?php echo $this->sg->GetPluginUrl(); ?> img/sitemap.js"></script> <table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable"> <tr> <th scope="col"><?php _e('URL to the page', 'sitemap'); ?> </th> <th scope="col"><?php _e('Priority', 'sitemap'); ?> </th> <th scope="col"><?php _e('Change Frequency', 'sitemap'); ?> </th> <th scope="col"><?php _e('Last Changed', 'sitemap'); ?> </th> <th scope="col"><?php _e('#', 'sitemap'); ?> </th> </tr> <?php if (count($this->sg->_pages) <= 0) { ?> <tr> <td colspan="5" align="center"><?php _e('No pages defined.', 'sitemap'); ?> </td> </tr><?php } ?> </table> <a href="javascript:void(0);" onclick="sm_addPage();"><?php _e("Add new page", 'sitemap'); ?> </a> <?php $this->HtmlPrintBoxFooter(); ?> <!-- AutoPrio Options --> <?php $this->HtmlPrintBoxHeader('sm_postprio', __('Post Priority', 'sitemap')); ?> <p><?php _e('Please select how the priority of each post should be calculated:', 'sitemap'); ?> </p> <ul> <li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php echo $this->sg->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), ""); ?> /> <label for="sm_b_prio_provider__0"><?php _e('Do not use automatic priority calculation', 'sitemap'); ?> </label><br /><?php _e('All posts will have the same priority which is defined in "Priorities"', 'sitemap'); ?> </p></li> <?php for ($i = 0; $i < count($this->sg->_prioProviders); $i++) { echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_{$i}\" name=\"sm_b_prio_provider\" value=\"" . $this->sg->_prioProviders[$i] . "\" " . $this->sg->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), $this->sg->_prioProviders[$i]) . " /> <label for=\"sm_b_prio_provider_{$i}\">" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getName')) . "</label><br />" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getDescription')) . "</p></li>"; } ?> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Location Options --> <?php $this->HtmlPrintBoxHeader('sm_location', __('Location of your sitemap file', 'sitemap')); ?> <div> <b><label for="sm_location_useauto"><input type="radio" id="sm_location_useauto" name="sm_b_location_mode" value="auto" <?php echo $this->sg->GetOption("b_location_mode") == "auto" ? "checked=\"checked\"" : ""; ?> /> <?php _e('Automatic detection', 'sitemap'); ?> </label></b> <ul> <li> <label for="sm_b_filename"> <?php _e('Filename of the sitemap file', 'sitemap'); ?> <input type="text" id="sm_b_filename" name="sm_b_filename" value="<?php echo $this->sg->GetOption("b_filename"); ?> " /> </label><br /> <?php _e('Detected Path', 'sitemap'); ?> : <?php echo $this->sg->getXmlPath(true); ?> <br /><?php _e('Detected URL', 'sitemap'); ?> : <a href="<?php echo $this->sg->getXmlUrl(true); ?> "><?php echo $this->sg->getXmlUrl(true); ?> </a> </li> </ul> </div> <div> <b><label for="sm_location_usemanual"><input type="radio" id="sm_location_usemanual" name="sm_b_location_mode" value="manual" <?php echo $this->sg->GetOption("b_location_mode") == "manual" ? "checked=\"checked\"" : ""; ?> /> <?php _e('Custom location', 'sitemap'); ?> </label></b> <ul> <li> <label for="sm_b_filename_manual"> <?php _e('Absolute or relative path to the sitemap file, including name.', 'sitemap'); echo "<br />"; _e('Example', 'sitemap'); echo ": /var/www/htdocs/wordpress/sitemap.xml"; ?> <br /> <input style="width:70%" type="text" id="sm_b_filename_manual" name="sm_b_filename_manual" value="<?php echo !$this->sg->GetOption("b_filename_manual") ? $this->sg->getXmlPath() : $this->sg->GetOption("b_filename_manual"); ?> " /> </label> </li> <li> <label for="sm_b_fileurl_manual"> <?php _e('Complete URL to the sitemap file, including name.', 'sitemap'); echo "<br />"; _e('Example', 'sitemap'); echo ": http://www.yourdomain.com/sitemap.xml"; ?> <br /> <input style="width:70%" type="text" id="sm_b_fileurl_manual" name="sm_b_fileurl_manual" value="<?php echo !$this->sg->GetOption("b_fileurl_manual") ? $this->sg->getXmlUrl() : $this->sg->GetOption("b_fileurl_manual"); ?> " /> </label> </li> </ul> </div> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Includes --> <?php $this->HtmlPrintBoxHeader('sm_includes', __('Sitemap Content', 'sitemap')); ?> <ul> <li> <label for="sm_in_home"> <input type="checkbox" id="sm_in_home" name="sm_in_home" <?php echo $this->sg->GetOption("in_home") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include homepage', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_posts"> <input type="checkbox" id="sm_in_posts" name="sm_in_posts" <?php echo $this->sg->GetOption("in_posts") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include posts', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_posts_sub"> <input type="checkbox" id="sm_in_posts_sub" name="sm_in_posts_sub" <?php echo $this->sg->GetOption("in_posts_sub") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include following pages of multi-page posts (Increases build time and memory usage!)', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_pages"> <input type="checkbox" id="sm_in_pages" name="sm_in_pages" <?php echo $this->sg->GetOption("in_pages") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include static pages', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_cats"> <input type="checkbox" id="sm_in_cats" name="sm_in_cats" <?php echo $this->sg->GetOption("in_cats") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include categories', 'sitemap'); ?> </label> </li> <li> <label for="sm_in_arch"> <input type="checkbox" id="sm_in_arch" name="sm_in_arch" <?php echo $this->sg->GetOption("in_arch") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include archives', 'sitemap'); ?> </label> </li> <?php if ($this->sg->IsTaxonomySupported()) { ?> <li> <label for="sm_in_tags"> <input type="checkbox" id="sm_in_tags" name="sm_in_tags" <?php echo $this->sg->GetOption("in_tags") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include tag pages', 'sitemap'); ?> </label> </li> <?php } ?> <li> <label for="sm_in_auth"> <input type="checkbox" id="sm_in_auth" name="sm_in_auth" <?php echo $this->sg->GetOption("in_auth") == true ? "checked=\"checked\"" : ""; ?> /> <?php _e('Include author pages', 'sitemap'); ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Excluded Items --> <?php $this->HtmlPrintBoxHeader('sm_excludes', __('Excluded items', 'sitemap')); ?> <b><?php _e('Excluded categories', 'sitemap'); ?> :</b> <?php if (version_compare($wp_version, "2.5.1", ">=")) { ?> <cite style="display:block; margin-left:40px;"><?php _e("Note", "sitemap"); ?> : <?php _e("Using this feature will increase build time and memory usage!", "sitemap"); ?> </cite> <div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;"> <ul> <?php wp_category_checklist(0, 0, $this->sg->GetOption("b_exclude_cats"), false); ?> </ul> </div> <?php } else { ?> <ul><li><?php echo sprintf(__("This feature requires at least WordPress 2.5.1, you are using %s", "sitemap"), $wp_version); ?> </li></ul> <?php } ?> <b><?php _e("Exclude posts", "sitemap"); ?> :</b> <div style="margin:5px 0 13px 40px;"> <label for="sm_b_exclude"><?php _e('Exclude the following posts or pages:', 'sitemap'); ?> <small><?php _e('List of IDs, separated by comma', 'sitemap'); ?> </small><br /> <input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php echo implode(",", $this->sg->GetOption("b_exclude")); ?> " /></label><br /> <cite><?php _e("Note", "sitemap"); ?> : <?php _e("Child posts won't be excluded automatically!", "sitemap"); ?> </cite> </div> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Change frequencies --> <?php $this->HtmlPrintBoxHeader('sm_change_frequencies', __('Change frequencies', 'sitemap')); ?> <p> <b><?php _e('Note', 'sitemap'); ?> :</b> <?php _e('Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.', 'sitemap'); ?> </p> <ul> <li> <label for="sm_cf_home"> <select id="sm_cf_home" name="sm_cf_home"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_home")); ?> </select> <?php _e('Homepage', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_posts"> <select id="sm_cf_posts" name="sm_cf_posts"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_posts")); ?> </select> <?php _e('Posts', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_pages"> <select id="sm_cf_pages" name="sm_cf_pages"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_pages")); ?> </select> <?php _e('Static pages', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_cats"> <select id="sm_cf_cats" name="sm_cf_cats"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_cats")); ?> </select> <?php _e('Categories', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_arch_curr"> <select id="sm_cf_arch_curr" name="sm_cf_arch_curr"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_curr")); ?> </select> <?php _e('The current archive of this month (Should be the same like your homepage)', 'sitemap'); ?> </label> </li> <li> <label for="sm_cf_arch_old"> <select id="sm_cf_arch_old" name="sm_cf_arch_old"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_old")); ?> </select> <?php _e('Older archives (Changes only if you edit an old post)', 'sitemap'); ?> </label> </li> <?php if ($this->sg->IsTaxonomySupported()) { ?> <li> <label for="sm_cf_tags"> <select id="sm_cf_tags" name="sm_cf_tags"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_tags")); ?> </select> <?php _e('Tag pages', 'sitemap'); ?> </label> </li> <?php } ?> <li> <label for="sm_cf_auth"> <select id="sm_cf_auth" name="sm_cf_auth"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_auth")); ?> </select> <?php _e('Author pages', 'sitemap'); ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> <!-- Priorities --> <?php $this->HtmlPrintBoxHeader('sm_priorities', __('Priorities', 'sitemap')); ?> <ul> <li> <label for="sm_pr_home"> <select id="sm_pr_home" name="sm_pr_home"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_home")); ?> </select> <?php _e('Homepage', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_posts"> <select id="sm_pr_posts" name="sm_pr_posts"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts")); ?> </select> <?php _e('Posts (If auto calculation is disabled)', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_posts_min"> <select id="sm_pr_posts_min" name="sm_pr_posts_min"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts_min")); ?> </select> <?php _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_pages"> <select id="sm_pr_pages" name="sm_pr_pages"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_pages")); ?> </select> <?php _e('Static pages', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_cats"> <select id="sm_pr_cats" name="sm_pr_cats"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_cats")); ?> </select> <?php _e('Categories', 'sitemap'); ?> </label> </li> <li> <label for="sm_pr_arch"> <select id="sm_pr_arch" name="sm_pr_arch"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_arch")); ?> </select> <?php _e('Archives', 'sitemap'); ?> </label> </li> <?php if ($this->sg->IsTaxonomySupported()) { ?> <li> <label for="sm_pr_tags"> <select id="sm_pr_tags" name="sm_pr_tags"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_tags")); ?> </select> <?php _e('Tag pages', 'sitemap'); ?> </label> </li> <?php } ?> <li> <label for="sm_pr_auth"> <select id="sm_pr_auth" name="sm_pr_auth"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_auth")); ?> </select> <?php _e('Author pages', 'sitemap'); ?> </label> </li> </ul> <?php $this->HtmlPrintBoxFooter(); ?> </div> <div> <p class="submit"> <?php wp_nonce_field('sitemap'); ?> <input type="submit" name="sm_update" value="<?php _e('Update options', 'sitemap'); ?> " /> <input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="<?php _e('Reset options', 'sitemap'); ?> " /> </p> </div> <?php if ($this->mode == 27) { ?> </div> </div> <?php } ?> </div> <script type="text/javascript">if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); </script> </form> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="sm_donate_form"> <?php $lc = array("en" => array("cc" => "USD", "lc" => "US"), "en-GB" => array("cc" => "GBP", "lc" => "GB"), "de" => array("cc" => "EUR", "lc" => "DE")); $myLc = $lc["en"]; $wpl = get_bloginfo('language'); if (!empty($wpl)) { if (array_key_exists($wpl, $lc)) { $myLc = $lc[$wpl]; } else { $wpl = substr($wpl, 0, 2); if (array_key_exists($wpl, $lc)) { $myLc = $lc[$wpl]; } } } ?> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="business" value="<?php echo "donate" . "@" . "arnebra" . "chhold.de"; ?> " /> <input type="hidden" name="item_name" value="Sitemap Generator for WordPress. Please tell me if if you don't want to be listed on the donator list." /> <input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="return" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $this->sg->GetBackLink(); ?> &sm_donated=true" /> <input type="hidden" name="item_number" value="0001" /> <input type="hidden" name="currency_code" value="<?php echo $myLc["cc"]; ?> " /> <input type="hidden" name="bn" value="PP-BuyNowBF" /> <input type="hidden" name="lc" value="<?php echo $myLc["lc"]; ?> " /> <input type="hidden" name="rm" value="2" /> <input type="hidden" name="on0" value="Your Website" /> <input type="hidden" name="os0" value="<?php echo get_bloginfo("home"); ?> "/> </form> </div> <?php }
public static function autoUpdate() { try { if (getenv('noabort') != '1' && stristr($_SERVER['SERVER_SOFTWARE'], 'litespeed') !== false) { $lastEmail = self::get('lastLiteSpdEmail', false); if (!$lastEmail || time() - (int) $lastEmail > 86400 * 30) { self::set('lastLiteSpdEmail', time()); wordfence::alert("Wordfence Upgrade not run. Please modify your .htaccess", "To preserve the integrity of your website we are not running Wordfence auto-update.\n" . "You are running the LiteSpeed web server which has been known to cause a problem with Wordfence auto-update.\n" . "Please go to your website now and make a minor change to your .htaccess to fix this.\n" . "You can find out how to make this change at:\n" . "https://support.wordfence.com/solution/articles/1000129050-running-wordfence-under-litespeed-web-server-and-preventing-process-killing-or\n" . "\nAlternatively you can disable auto-update on your website to stop receiving this message and upgrade Wordfence manually.\n", '127.0.0.1'); } return; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/misc.php'; /* We were creating show_message here so that WP did not write to STDOUT. This had the strange effect of throwing an error about redeclaring show_message function, but only when a crawler hit the site and triggered the cron job. Not a human. So we're now just require'ing misc.php which does generate output, but that's OK because it is a loopback cron request. if(! function_exists('show_message')){ function show_message($msg = 'null'){} } */ define('FS_METHOD', 'direct'); require_once ABSPATH . 'wp-includes/update.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; wp_update_plugins(); ob_start(); $upgrader = new Plugin_Upgrader(); $upret = $upgrader->upgrade('wordfence/wordfence.php'); if ($upret) { $cont = file_get_contents(WP_PLUGIN_DIR . '/wordfence/wordfence.php'); if (wfConfig::get('alertOn_update') == '1' && preg_match('/Version: (\\d+\\.\\d+\\.\\d+)/', $cont, $matches)) { wordfence::alert("Wordfence Upgraded to version " . $matches[1], "Your Wordfence installation has been upgraded to version " . $matches[1], '127.0.0.1'); } } $output = @ob_get_contents(); @ob_end_clean(); } catch (Exception $e) { } }
/** * Kicks off the background update process, looping through all pending updates. * * @since 3.7.0 */ public function run() { global $wpdb, $wp_version; if ($this->is_disabled()) { return; } if (!is_main_network() || !is_main_site()) { return; } $lock_name = 'auto_updater.lock'; // Try to lock $lock_result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `{$wpdb->options}` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time())); if (!$lock_result) { $lock_result = get_option($lock_name); // If we couldn't create a lock, and there isn't a lock, bail if (!$lock_result) { return; } // Check to see if the lock is still valid if ($lock_result > time() - HOUR_IN_SECONDS) { return; } } // Update the lock, as by this point we've definitely got a lock, just need to fire the actions update_option($lock_name, time()); // Don't automatically run these thins, as we'll handle it ourselves remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); remove_action('upgrader_process_complete', 'wp_version_check'); remove_action('upgrader_process_complete', 'wp_update_plugins'); remove_action('upgrader_process_complete', 'wp_update_themes'); // Next, Plugins wp_update_plugins(); // Check for Plugin updates $plugin_updates = get_site_transient('update_plugins'); if ($plugin_updates && !empty($plugin_updates->response)) { foreach ($plugin_updates->response as $plugin) { $this->update('plugin', $plugin); } // Force refresh of plugin update information wp_clean_plugins_cache(); } // Next, those themes we all love wp_update_themes(); // Check for Theme updates $theme_updates = get_site_transient('update_themes'); if ($theme_updates && !empty($theme_updates->response)) { foreach ($theme_updates->response as $theme) { $this->update('theme', (object) $theme); } // Force refresh of theme update information wp_clean_themes_cache(); } // Next, Process any core update wp_version_check(); // Check for Core updates $core_update = find_core_auto_update(); if ($core_update) { $this->update('core', $core_update); } // Clean up, and check for any pending translations // (Core_Upgrader checks for core updates) $theme_stats = array(); if (isset($this->update_results['theme'])) { foreach ($this->update_results['theme'] as $upgrade) { $theme_stats[$upgrade->item->theme] = true === $upgrade->result; } } wp_update_themes($theme_stats); // Check for Theme updates $plugin_stats = array(); if (isset($this->update_results['plugin'])) { foreach ($this->update_results['plugin'] as $upgrade) { $plugin_stats[$upgrade->item->plugin] = true === $upgrade->result; } } wp_update_plugins($plugin_stats); // Check for Plugin updates // Finally, Process any new translations $language_updates = wp_get_translation_updates(); if ($language_updates) { foreach ($language_updates as $update) { $this->update('translation', $update); } // Clear existing caches wp_clean_update_cache(); wp_version_check(); // check for Core updates wp_update_themes(); // Check for Theme updates wp_update_plugins(); // Check for Plugin updates } // Send debugging email to all development installs. if (!empty($this->update_results)) { $development_version = false !== strpos($wp_version, '-'); /** * Filter whether to send a debugging email for each automatic background update. * * @since 3.7.0 * * @param bool $development_version By default, emails are sent if the * install is a development version. * Return false to avoid the email. */ if (apply_filters('automatic_updates_send_debug_email', $development_version)) { $this->send_debug_email(); } if (!empty($this->update_results['core'])) { $this->after_core_update($this->update_results['core'][0]); } /** * Fires after all automatic updates have run. * * @since 3.8.0 * * @param array $update_results The results of all attempted updates. */ do_action('automatic_updates_complete', $this->update_results); } // Clear the lock delete_option($lock_name); }
* @since 3.3 Move version checking here, in PHP. */ if (current_user_can('update_plugins')) { $yarpp_version_info = $yarpp->version_info(); /* * These strings are not localizable, as long as the plugin data on wordpress.org cannot be. */ $slug = 'yet-another-related-posts-plugin'; $plugin_name = 'Yet Another Related Posts Plugin'; $file = basename(YARPP_DIR) . '/yarpp.php'; if ($yarpp_version_info['result'] === 'new') { /* Make sure the update system is aware of this version. */ $current = get_site_transient('update_plugins'); if (!isset($current->response[$file])) { delete_site_transient('update_plugins'); wp_update_plugins(); } echo '<div class="updated"><p>'; $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $slug . '&TB_iframe=true&width=600&height=800'); printf(__('There is a new version of %1$s available.' . '<a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>' . 'or <a href="%5$s">update automatically</a>.', 'yarpp'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $yarpp_version_info['current']['version'], wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file)); echo '</p></div>'; } else { if ($yarpp_version_info['result'] === 'newbeta') { echo '<div class="updated"><p>'; printf(__("There is a new beta (%s) of Yet Another Related Posts Plugin. " . "You can <a href=\"%s\">download it here</a> at your own risk.", "yarpp"), $yarpp_version_info['beta']['version'], $yarpp_version_info['beta']['url']); echo '</p></div>'; } } } /* MyISAM Check */ include 'yarpp_myisam_notice.php';
public function check_notifications() { global $wp_version; $mwp_notifications = get_option('mwp_notifications', true); $args = array(); $updates = array(); $send = 0; if (is_array($mwp_notifications) && $mwp_notifications != false) { include_once ABSPATH . 'wp-includes/update.php'; include_once ABSPATH . '/wp-admin/includes/update.php'; extract($mwp_notifications); //Check wordpress core updates if ($wp) { @wp_version_check(); if (function_exists('get_core_updates')) { $wp_updates = get_core_updates(); if (!empty($wp_updates)) { $current_transient = $wp_updates[0]; if ($current_transient->response == "development" || version_compare($wp_version, $current_transient->current, '<')) { $current_transient->current_version = $wp_version; $updates['core_updates'] = $current_transient; } else { $updates['core_updates'] = array(); } } else { $updates['core_updates'] = array(); } } } //Check plugin updates if ($plugins) { @wp_update_plugins(); $this->get_installer_instance(); $updates['upgradable_plugins'] = $this->installer_instance->get_upgradable_plugins(); } //Check theme updates if ($themes) { @wp_update_themes(); $this->get_installer_instance(); $updates['upgradable_themes'] = $this->installer_instance->get_upgradable_themes(); } if ($backups) { $this->get_backup_instance(); $backups = $this->backup_instance->get_backup_stats(); $updates['backups'] = $backups; foreach ($backups as $task_name => $backup_results) { foreach ($backup_results as $k => $backup) { if (isset($backups[$task_name][$k]['server']['file_path'])) { unset($backups[$task_name][$k]['server']['file_path']); } } } $updates['backups'] = $backups; } if (!empty($updates)) { $args['body']['updates'] = $updates; $args['body']['notification_key'] = $notification_key; $send = 1; } } $alert_data = get_option('mwp_pageview_alerts', true); if (is_array($alert_data) && $alert_data['alert']) { $pageviews = get_option('user_hit_count'); $args['body']['alerts']['pageviews'] = $pageviews; $args['body']['alerts']['site_id'] = $alert_data['site_id']; if (!isset($url)) { $url = $alert_data['url']; } $send = 1; } if ($send) { if (!class_exists('WP_Http')) { include_once ABSPATH . WPINC . '/class-http.php'; } $result = wp_remote_post($url, $args); if (is_array($result) && $result['body'] == 'mwp_delete_alert') { delete_option('mwp_pageview_alerts'); } } }
public function doPluginUpdateCheck() { global $wp_current_filter; $wp_current_filter[] = 'load-update-core.php'; if (function_exists('wp_clean_update_cache')) { wp_clean_update_cache(); } wp_update_plugins(); array_pop($wp_current_filter); do_action('load-plugins.php'); }
function test_full_sync_sends_plugin_updates() { wp_update_plugins(); $this->client->do_sync(); // check that an update just finished $updates = $this->server_replica_storage->get_updates('plugins'); $this->assertTrue($updates->last_checked > strtotime("-10 seconds")); delete_site_transient('update_plugins'); $this->server_replica_storage->reset(); $this->assertNull($this->server_replica_storage->get_updates('plugins')); // full sync should re-check for plugin updates $this->full_sync->start(); $this->client->do_sync(); $updates = $this->server_replica_storage->get_updates('plugins'); $this->assertNotNull($updates); $this->assertTrue($updates->last_checked > strtotime("-10 seconds"), 'Last checked is less then 2 seconds: ' . $updates->last_checked . ' - lest then 10 sec:' . strtotime("-10 seconds")); }
function getSiteStats($information = array(), $exit = true) { global $wp_version; if ($exit) { $this->updateExternalSettings(); } MainWP_Helper::update_option('mainwp_child_branding_disconnected', '', 'yes'); if (isset($_POST['server'])) { MainWP_Helper::update_option('mainwp_child_server', $_POST['server']); } if (isset($_POST['numberdaysOutdatePluginTheme']) && !empty($_POST['numberdaysOutdatePluginTheme'])) { $days_outdate = get_option('mainwp_child_plugintheme_days_outdate', 365); if ($days_outdate !== $_POST['numberdaysOutdatePluginTheme']) { $days_outdate = $_POST['numberdaysOutdatePluginTheme']; MainWP_Helper::update_option('mainwp_child_plugintheme_days_outdate', $days_outdate); MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation(false); MainWP_Child_Themes_Check::Instance()->cleanup_deactivation(false); } } $information['version'] = self::$version; $information['wpversion'] = $wp_version; $information['siteurl'] = get_option('siteurl'); $information['nossl'] = '1' === get_option('mainwp_child_nossl') ? 1 : 0; include_once ABSPATH . '/wp-admin/includes/update.php'; $timeout = 3 * 60 * 60; // 3minutes @set_time_limit($timeout); @ini_set('max_execution_time', $timeout); //Check for new versions if (null !== $this->filterFunction) { add_filter('pre_site_transient_update_core', $this->filterFunction, 99); } if (null !== $this->filterFunction) { add_filter('pre_transient_update_core', $this->filterFunction, 99); } @wp_version_check(); $core_updates = get_core_updates(); if (count($core_updates) > 0) { foreach ($core_updates as $core_update) { if ('latest' === $core_update->response) { break; } if ('upgrade' === $core_update->response && version_compare($wp_version, $core_update->current, '<=')) { $information['wp_updates'] = $core_update->current; } } } if (!isset($information['wp_updates'])) { $information['wp_updates'] = null; } if (null !== $this->filterFunction) { remove_filter('pre_site_transient_update_core', $this->filterFunction, 99); } if (null !== $this->filterFunction) { remove_filter('pre_transient_update_core', $this->filterFunction, 99); } add_filter('default_option_active_plugins', array(&$this, 'default_option_active_plugins')); add_filter('option_active_plugins', array(&$this, 'default_option_active_plugins')); //First check for new premium updates $update_check = apply_filters('mwp_premium_update_check', array()); if (!empty($update_check)) { foreach ($update_check as $updateFeedback) { if (is_array($updateFeedback['callback']) && isset($updateFeedback['callback'][0]) && isset($updateFeedback['callback'][1])) { @call_user_func(array($updateFeedback['callback'][0], $updateFeedback['callback'][1])); } else { if (is_string($updateFeedback['callback'])) { @call_user_func($updateFeedback['callback']); } } } } $informationPremiumUpdates = apply_filters('mwp_premium_update_notification', array()); $premiumPlugins = array(); $premiumThemes = array(); if (is_array($informationPremiumUpdates)) { $premiumUpdates = array(); $information['premium_updates'] = array(); $informationPremiumUpdatesLength = count($informationPremiumUpdates); for ($i = 0; $i < $informationPremiumUpdatesLength; $i++) { if (!isset($informationPremiumUpdates[$i]['new_version'])) { continue; } $slug = isset($informationPremiumUpdates[$i]['slug']) ? $informationPremiumUpdates[$i]['slug'] : $informationPremiumUpdates[$i]['Name']; if ('plugin' === $informationPremiumUpdates[$i]['type']) { $premiumPlugins[] = $slug; } else { if ('theme' === $informationPremiumUpdates[$i]['type']) { $premiumThemes[] = $slug; } } $new_version = $informationPremiumUpdates[$i]['new_version']; unset($informationPremiumUpdates[$i]['old_version']); unset($informationPremiumUpdates[$i]['new_version']); $information['premium_updates'][$slug] = $informationPremiumUpdates[$i]; $information['premium_updates'][$slug]['update'] = (object) array('new_version' => $new_version, 'premium' => true, 'slug' => $slug); if (!in_array($slug, $premiumUpdates)) { $premiumUpdates[] = $slug; } } MainWP_Helper::update_option('mainwp_premium_updates', $premiumUpdates); } remove_filter('default_option_active_plugins', array(&$this, 'default_option_active_plugins')); remove_filter('option_active_plugins', array(&$this, 'default_option_active_plugins')); if (null !== $this->filterFunction) { add_filter('pre_site_transient_update_plugins', $this->filterFunction, 99); } global $wp_current_filter; $wp_current_filter[] = 'load-plugins.php'; @wp_update_plugins(); include_once ABSPATH . '/wp-admin/includes/plugin.php'; $plugin_updates = get_plugin_updates(); if (is_array($plugin_updates)) { $information['plugin_updates'] = array(); foreach ($plugin_updates as $slug => $plugin_update) { if (in_array($plugin_update->Name, $premiumPlugins)) { continue; } $information['plugin_updates'][$slug] = $plugin_update; } } if (null !== $this->filterFunction) { remove_filter('pre_site_transient_update_plugins', $this->filterFunction, 99); } if (null !== $this->filterFunction) { add_filter('pre_site_transient_update_themes', $this->filterFunction, 99); } @wp_update_themes(); include_once ABSPATH . '/wp-admin/includes/theme.php'; $theme_updates = $this->upgrade_get_theme_updates(); if (is_array($theme_updates)) { $information['theme_updates'] = array(); foreach ($theme_updates as $slug => $theme_update) { $name = is_array($theme_update) ? $theme_update['Name'] : $theme_update->Name; if (in_array($name, $premiumThemes)) { continue; } $information['theme_updates'][$slug] = $theme_update; } } if (null !== $this->filterFunction) { remove_filter('pre_site_transient_update_themes', $this->filterFunction, 99); } $information['recent_comments'] = $this->get_recent_comments(array('approve', 'hold'), 5); $information['recent_posts'] = $this->get_recent_posts(array('publish', 'draft', 'pending', 'trash'), 5); $information['recent_pages'] = $this->get_recent_posts(array('publish', 'draft', 'pending', 'trash'), 5, 'page'); $securityIssuess = 0; if (!MainWP_Security::prevent_listing_ok()) { $securityIssuess++; } if (!MainWP_Security::remove_wp_version_ok()) { $securityIssuess++; } if (!MainWP_Security::remove_rsd_ok()) { $securityIssuess++; } if (!MainWP_Security::remove_wlw_ok()) { $securityIssuess++; } // if (!MainWP_Security::remove_core_update_ok()) $securityIssuess++; // if (!MainWP_Security::remove_plugin_update_ok()) $securityIssuess++; // if (!MainWP_Security::remove_theme_update_ok()) $securityIssuess++; // if (!MainWP_Security::fix_file_permissions_ok()) $securityIssuess++; if (!MainWP_Security::remove_database_reporting_ok()) { $securityIssuess++; } if (!MainWP_Security::remove_php_reporting_ok()) { $securityIssuess++; } if (!MainWP_Security::remove_scripts_version_ok() || !MainWP_Security::remove_styles_version_ok()) { $securityIssuess++; } if (!MainWP_Security::admin_user_ok()) { $securityIssuess++; } if (!MainWP_Security::remove_readme_ok()) { $securityIssuess++; } $information['securityIssues'] = $securityIssuess; //Directory listings! $information['directories'] = $this->scanDir(ABSPATH, 3); $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => true)); $categories = array(); foreach ($cats as $cat) { $categories[] = $cat->name; } $information['categories'] = $categories; $information['totalsize'] = $this->getTotalFileSize(); $information['dbsize'] = MainWP_Child_DB::get_size(); $auths = get_option('mainwp_child_auth'); $information['extauth'] = $auths && isset($auths[$this->maxHistory]) ? $auths[$this->maxHistory] : null; $plugins = $this->get_all_plugins_int(false); $themes = $this->get_all_themes_int(false); $information['plugins'] = $plugins; $information['themes'] = $themes; if (isset($_POST['optimize']) && '1' === $_POST['optimize']) { $information['users'] = $this->get_all_users_int(); } if (isset($_POST['pluginConflicts']) && '' !== $_POST['pluginConflicts']) { $pluginConflicts = json_decode(stripslashes($_POST['pluginConflicts']), true); $conflicts = array(); if (count($pluginConflicts) > 0) { if (!$plugins) { $plugins = $this->get_all_plugins_int(false); } if (is_array($plugins) && is_array($pluginConflicts)) { foreach ($plugins as $plugin) { foreach ($pluginConflicts as $pluginConflict) { if ('1' === $plugin['active'] && ($plugin['name'] === $pluginConflict || $plugin['slug'] === $pluginConflict)) { $conflicts[] = $plugin['name']; } } } } } if (count($conflicts) > 0) { $information['pluginConflicts'] = $conflicts; } } if (isset($_POST['themeConflicts']) && '' !== $_POST['themeConflicts']) { $themeConflicts = json_decode(stripslashes($_POST['themeConflicts']), true); $conflicts = array(); if (is_array($themeConflicts) && count($themeConflicts) > 0) { $theme = wp_get_theme()->get('Name'); foreach ($themeConflicts as $themeConflict) { if ($theme === $themeConflict) { $conflicts[] = $theme; } } } if (count($conflicts) > 0) { $information['themeConflicts'] = $conflicts; } } if (isset($_POST['othersData'])) { $othersData = json_decode(stripslashes($_POST['othersData']), true); if (!is_array($othersData)) { $othersData = array(); } $information = apply_filters('mainwp-site-sync-others-data', $information, $othersData); if (version_compare(phpversion(), '5.3', '>=')) { if (isset($othersData['syncBackUpWordPress']) && $othersData['syncBackUpWordPress']) { if (MainWP_Child_Back_Up_Wordpress::isActivated()) { $information['syncBackUpWordPress'] = MainWP_Child_Back_Up_Wordpress::Instance()->syncData(); } } } if (isset($othersData['syncWPRocketData']) && 'yes' === $othersData['syncWPRocketData']) { $data = array(); if (MainWP_Child_WP_Rocket::isActivated()) { $boxes = get_user_meta($GLOBALS['current_user']->ID, 'rocket_boxes', true); $data['rocket_boxes'] = $boxes; } $information['syncWPRocketData'] = $data; } } $information['faviIcon'] = $this->get_favicon(); $last_post = wp_get_recent_posts(array('numberposts' => absint('1'))); if (isset($last_post[0])) { $last_post = $last_post[0]; } if (isset($last_post) && isset($last_post['post_modified_gmt'])) { $information['last_post_gmt'] = strtotime($last_post['post_modified_gmt']); } $information['mainwpdir'] = MainWP_Helper::validateMainWPDir() ? 1 : -1; $information['uniqueId'] = get_option('mainwp_child_uniqueId', ''); $information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info(); $information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info(); if ($exit) { MainWP_Helper::write($information); } return $information; }
/** * AJAX handler for updating a plugin. * * @since 4.2.0 * * @see Plugin_Upgrader */ function wp_ajax_update_plugin() { global $wp_filesystem; $plugin = urldecode($_POST['plugin']); $status = array('update' => 'plugin', 'plugin' => $plugin, 'slug' => sanitize_key($_POST['slug']), 'oldVersion' => '', 'newVersion' => ''); $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); if ($plugin_data['Version']) { $status['oldVersion'] = sprintf(__('Version %s'), $plugin_data['Version']); } if (!current_user_can('update_plugins')) { $status['error'] = __('You do not have sufficient permissions to update plugins for this site.'); wp_send_json_error($status); } check_ajax_referer('updates'); include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; wp_update_plugins(); $skin = new Automatic_Upgrader_Skin(); $upgrader = new Plugin_Upgrader($skin); $result = $upgrader->bulk_upgrade(array($plugin)); if (is_array($result) && empty($result[$plugin]) && is_wp_error($skin->result)) { $result = $skin->result; } if (is_array($result) && !empty($result[$plugin])) { $plugin_update_data = current($result); /* * If the `update_plugins` site transient is empty (e.g. when you update * two plugins in quick succession before the transient repopulates), * this may be the return. * * Preferably something can be done to ensure `update_plugins` isn't empty. * For now, surface some sort of error here. */ if ($plugin_update_data === true) { $status['error'] = __('Plugin update failed.'); wp_send_json_error($status); } $plugin_data = get_plugins('/' . $result[$plugin]['destination_name']); $plugin_data = reset($plugin_data); if ($plugin_data['Version']) { $status['newVersion'] = sprintf(__('Version %s'), $plugin_data['Version']); } wp_send_json_success($status); } else { if (is_wp_error($result)) { $status['error'] = $result->get_error_message(); wp_send_json_error($status); } else { if (is_bool($result) && !$result) { $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['error'] = __('Unable to connect to the filesystem. Please confirm your credentials.'); // Pass through the error from WP_Filesystem if one was raised if (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { $status['error'] = $wp_filesystem->errors->get_error_message(); } wp_send_json_error($status); } else { // An unhandled error occured $status['error'] = __('Plugin update failed.'); wp_send_json_error($status); } } } }
/** * Delete plugin update record meta to re-check plugin for version update * * @uses delete_option() * @uses wp_update_plugins() */ public static function check_plugin_updates() { delete_site_transient('update_plugins'); wp_update_plugins(); }