Quantcast
Viewing all articles
Browse latest Browse all 529

Explanation

I see this code in my php translator

public function translate($from, $to, $text, $format = 'Raw' )
{
    if(empty($to) || empty($text)) {
        $this->getErrorResponse($response, self::MISSING_ERROR, $missing);
        return;
    }

// what is this line doing? my $from is empty where is $this->from coming from?
    $this->from = (!empty($this->from )) ? $this->sanitize($from) : '';
    $this->to = $this->sanitize($to);
    $this->textToTranslate = $this->sanitize($text);
    $this->format = $format;
    $request = $this->getRequest(self::TRANSLATE );
   
    echo "from as this:" . $this->from ."@@ param from as param:". $from.  "<br/>";
    echo $request."<br/>";

    $response = file_get_contents( $request, 0, $this->context );
   
    if(!empty($response) && isset($response)){
        $this->getSuccessResponse($response);
    } else {
        $this->getErrorResponse($response, self::UNEXPECTED_ERROR, $missing );
    }

}


Viewing all articles
Browse latest Browse all 529

Trending Articles