+ $new_update = new stdClass;
+ $new_update->last_checked = time();
+ $new_update->checked = $checked;
+
+ $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
+
+ if ( is_array( $response ) ) {
+ $new_update->response = $response['themes'];
+ $new_update->translations = $response['translations'];
+ }
+
+ set_site_transient( 'update_themes', $new_update );
+}
+
+/**
+ * Performs WordPress automatic background updates.
+ *
+ * @since 3.7.0
+ */
+function wp_maybe_auto_update() {
+ include_once( ABSPATH . '/wp-admin/includes/admin.php' );
+ include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
+
+ $upgrader = new WP_Automatic_Updater;
+ $upgrader->run();
+}
+
+/**
+ * Retrieves a list of all language updates available.
+ *
+ * @since 3.7.0
+ */
+function wp_get_translation_updates() {
+ $updates = array();
+ $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );
+ foreach ( $transients as $transient => $type ) {
+
+ $transient = get_site_transient( $transient );
+ if ( empty( $transient->translations ) )
+ continue;
+
+ foreach ( $transient->translations as $translation ) {
+ $updates[] = (object) $translation;
+ }
+ }
+
+ return $updates;
+}
+
+/**
+ * Collect counts and UI strings for available updates
+ *
+ * @since 3.3.0
+ *
+ * @return array
+ */
+function wp_get_update_data() {
+ $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 );
+
+ if ( $plugins = current_user_can( 'update_plugins' ) ) {
+ $update_plugins = get_site_transient( 'update_plugins' );
+ if ( ! empty( $update_plugins->response ) )
+ $counts['plugins'] = count( $update_plugins->response );
+ }
+
+ if ( $themes = current_user_can( 'update_themes' ) ) {
+ $update_themes = get_site_transient( 'update_themes' );
+ if ( ! empty( $update_themes->response ) )
+ $counts['themes'] = count( $update_themes->response );