web/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    48 		}
    48 		}
    49 
    49 
    50 		return $osug;
    50 		return $osug;
    51 	}
    51 	}
    52 
    52 
    53 	function &_getMatches($lang, $str) {
    53 	protected function &_getMatches($lang, $str) {
       
    54 		$lang = preg_replace('/[^a-z\-]/i', '', $lang);
       
    55 		$str = preg_replace('/[\x00-\x1F\x7F]/', '', $str);
    54 		$server = "www.google.com";
    56 		$server = "www.google.com";
    55 		$port = 443;
    57 		$port = 443;
    56 		$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
    58 		$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
    57 		$host = "www.google.com";
    59 		$host = "www.google.com";
    58 		$url = "https://" . $server;
    60 		$url = "https://" . $server;
   103 		preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
   105 		preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
   104 
   106 
   105 		return $matches;
   107 		return $matches;
   106 	}
   108 	}
   107 
   109 
   108 	function _unhtmlentities($string) {
   110 	protected function _unhtmlentities($string) {
   109 		$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
   111 		$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
   110 		$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
   112 		$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
   111 
   113 
   112 		$trans_tbl = get_html_translation_table(HTML_ENTITIES);
   114 		$trans_tbl = get_html_translation_table(HTML_ENTITIES);
   113 		$trans_tbl = array_flip($trans_tbl);
   115 		$trans_tbl = array_flip($trans_tbl);