X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=GoogleTranslate.php;h=8d9c464ced5ba920a0a814abec9c43a52f6ab523;hp=f5de4489f9e10b92e3a0df4e6017a545195479c3;hb=8cd2a9237c684aa16bc21e3ac6d3793c49c65400;hpb=7048d4486f2e659062915f7b6bf3c5fc3425b8ca diff --git a/GoogleTranslate.php b/GoogleTranslate.php index f5de4489..8d9c464c 100644 --- a/GoogleTranslate.php +++ b/GoogleTranslate.php @@ -20,12 +20,12 @@ class Pman_Core_GoogleTranslate extends Pman $this->authUser = $au; } - function get() { + function get($v, $opts=array()) { // for testing.. return $this->post(); } - function post() + function post($v) { $pc = HTML_FlexyFramework::get()->Pman_Core; if (empty($pc['googlekey'])) { @@ -42,7 +42,6 @@ class Pman_Core_GoogleTranslate extends Pman 'format' => 'text', ); - $url = 'https://www.googleapis.com/language/translate/v2'; $handle = curl_init(); @@ -60,16 +59,6 @@ class Pman_Core_GoogleTranslate extends Pman header("content-type: text/json"); echo $response; exit; - if(!empty($responseDecoded->error)){ - $this->jerr($responseDecoded->error->message); - } -// print_r($responseDecoded); - if(empty($responseDecoded->data->translations[0]->translatedText)){ - $this->jerr('does not have translated text.', print_r($responseDecoded, true)); - } -// var_dump($responseDecoded->data->translations[0]->translatedText); - $responseDecoded->data->translations[0]->translatedText = rawurldecode(str_replace(' ', '', $responseDecoded->data->translations[0]->translatedText)); - $this->jok($responseDecoded->data->translations[0]); }