From ab74cb7a60e0a5289fa59d8ab936ad3e0ef55e06 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 9 Apr 2007 00:09:42 +0000 Subject: [PATCH] Google spell connect fix. Props Nazgul. see #3857 git-svn-id: https://develop.svn.wordpress.org/trunk@5214 602fd350-edb4-49c9-b593-d223f7449a82 --- .../classes/TinyGoogleSpell.class.php | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php index 93caa26360..2a4576c35a 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php @@ -78,19 +78,8 @@ class TinyGoogleSpell { $header .= $xml; //$this->_debugData($xml); - // Use raw sockets - $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30); - if ($fp) { - // Send request - fwrite($fp, $header); - - // Read response - $xml = ""; - while (!feof($fp)) - $xml .= fgets($fp, 128); - - fclose($fp); - } else { + // Use curl if it exists + if (function_exists('curl_init')) { // Use curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); @@ -99,6 +88,21 @@ class TinyGoogleSpell { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $xml = curl_exec($ch); curl_close($ch); + } else { + // Use raw sockets + $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30); + if ($fp) { + // Send request + fwrite($fp, $header); + + // Read response + $xml = ""; + while (!feof($fp)) + $xml .= fgets($fp, 128); + + fclose($fp); + } else + echo "Could not open SSL connection to google."; } //$this->_debugData($xml);