Index: wp-includes/js/tinymce/plugins/spellchecker/classes/WP_GoogleSpell.php
===================================================================
--- wp-includes/js/tinymce/plugins/spellchecker/classes/WP_GoogleSpell.php	(revision 0)
+++ wp-includes/js/tinymce/plugins/spellchecker/classes/WP_GoogleSpell.php	(revision 0)
@@ -0,0 +1,146 @@
+<?php
+/**
+ * Extension of TinyMCE GoogleSpell class for Wordpress
+ * 
+ * WP_GoogleSpell extends TinyMCE's GoogleSpell class. It overrides the way in which the 
+ * http request to google is executed and uses wp_remote_post() instead of curl/fsockopen.
+ *
+ * The class also adds a way of adding custom words to the dictionary, like for example 
+ * "WordPress". This list of exceptions can be modified by implementing the
+ * "mce_spellcheck_exceptions" filter.
+ *
+ * In order to use this class the "general.engine" value in config.php
+ * (wp-includes/js/tinymce/plugins/spellchecker) needs to be set to "WP_GoogleSpell"
+ * instead of "GoogleSpell".
+ *
+ * @link http://trac.wordpress.org/ticket/9798 Request for proxy support for spellchecking
+ *
+ * @package WordPress
+ * @subpackage TinyMCE
+ * @since 2.8.0
+ * @author Benedikt Forchhammer <b.forchhammer@mind2.de>
+ */
+
+// Wordpress functions and classes
+require_once(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))) . '/wp-load.php');
+
+// The SpellChecking Engine that we want to extend
+require_once(dirname(__FILE__) . '/GoogleSpell.php');
+
+class WP_GoogleSpell extends GoogleSpell {
+
+	function &_getMatches($lang, $str) {
+		if (function_exists('wp_remote_post')) {
+			// request url
+			$url = "https://www.google.com/tbproxy/spell?lang=" . $lang . "&hl=en";
+			
+			// Setup XML request
+			$xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $str . '</text></spellrequest>';
+			
+			// set up request arguments.
+			$args = array( 'body' => $xml, 'sslverify' => false );
+
+			// execute request and get response
+			$response = wp_remote_post($url, $args);
+			
+			if (is_wp_error($response)) {
+				echo implode("\n", $response->get_error_messages());
+				return array();
+			}
+			else {
+				// Grab and parse content
+				$matches = array();
+				preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', wp_remote_retrieve_body($response), $matches, PREG_SET_ORDER);
+			
+				return $matches;
+			}
+		}
+		else {
+			$this->throwError('wp_remote_post() function has not been loaded.');
+		}
+	}
+	
+	/**
+	 * Checks if a word is not on the exception list of "correctly spelled words".
+	 *
+	 * @param {String} $word The word to check
+	 * @param {Bool} false if the word is on the exception list, true otherwise.
+	 */
+	function isNoException($word) {
+		return !in_array($word, $this->getExceptionList());
+	}
+	
+	/**
+	 * Returns suggestions of for a specific word using the list of 
+	 * Wordpress Spelling Exceptions
+	 *
+	 * @param {String} $lang Language code like sv or en.
+	 * @param {String} $word Specific word to get suggestions for.
+	 * @return {Array} Array of suggestions for the specified word.
+	 */
+	function getExceptionSuggestions($lang, $word) {	
+		$exceptions = $this->getExceptionList();
+		
+		$suggestions = array();
+		foreach ($exceptions as $suggestion) {
+			$p = 0;
+			similar_text($word, good, $p);
+			if ($p > .8) $suggestions[] = $suggestion;
+		}		
+		return $suggestions;
+	}
+	
+	/**
+	 * Get List of Wordpress Spelling Exceptions
+	 *
+	 * Use filter 'mce_spellcheck_exceptions' to add custom exceptions to this list.
+	 *
+	 * @return {Array} List of Spelling Exceptions
+	 */
+	function getExceptionList() {
+		$defaults = array('WordPress');
+		return apply_filters('mce_spellcheck_exceptions', $defaults);
+	}
+	
+	/**
+	 * Spellchecks an array of words.
+	 *
+	 * Ignores words that are on the list of Wordpress Spelling Exceptions.
+	 *
+	 * @param {String} $lang Language code like sv or en.
+	 * @param {Array} $words Array of words to spellcheck.
+	 * @return {Array} Array of misspelled words.
+	 */
+	function &checkWords($lang, $words) {
+		$words = array_filter($words, array($this, 'isNoException'));
+		return parent::checkWords($lang, $words);
+	}
+
+	/**
+	 * Returns suggestions of for a specific word.
+	 *
+	 * Merges Wordpress Spelling Exceptions (filter 'mce_spellcheck_exceptions')
+	 * with google's list of suggestions.
+	 *
+	 * @param {String} $lang Language code like sv or en.
+	 * @param {String} $word Specific word to get suggestions for.
+	 * @return {Array} Array of suggestions for the specified word.
+	 */
+	function &getSuggestions($lang, $word) {
+		$wp_suggestions = $this->getExceptionSuggestions($lang, $word);
+		$google_suggestions = parent::getSuggestions($lang, $word);
+		return array_merge($wp_suggestions, $google_suggestions);
+	}
+	
+	/**
+	 * Use wordpress function unhtmlentities()
+	 *
+	 * @see http://core.trac.wordpress.org/ticket/8689
+	 * @see http://core.trac.wordpress.org/ticket/9805
+	 */
+	function _unhtmlentities($string) {
+		if (function_exists('unhtmlentities')) return unhtmlentities($string);
+		else return parent::_unhtmlentities($string);
+	}
+}
+?>
\ No newline at end of file
Index: wp-includes/js/tinymce/plugins/spellchecker/config.php
===================================================================
--- wp-includes/js/tinymce/plugins/spellchecker/config.php	(revision 11339)
+++ wp-includes/js/tinymce/plugins/spellchecker/config.php	(working copy)
@@ -6,7 +6,8 @@
  * @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
  */
 	// General settings
-	$config['general.engine'] = 'GoogleSpell';
+	//$config['general.engine'] = 'GoogleSpell';
+	$config['general.engine'] = 'WP_GoogleSpell';
 	//$config['general.engine'] = 'PSpell';
 	//$config['general.engine'] = 'PSpellShell';
 	//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
