Calculate HTTP POST data in separate method for debugging

To check if the renderer works correctly it is desired to be able to
separate the test of the renderer and the function of the extension
PHP code. Therefore the method getPostData can be used to get
the values can be sent to the renderer directly via
curl –d 'POSTDATA' URL

Change-Id: I530f5fcba46364458643914bca81cf0bc1b60a58
This commit is contained in:
physikerwelt 2013-05-30 07:53:30 +00:00
parent e056e54f06
commit 443c7ef95a
1 changed files with 10 additions and 3 deletions

View File

@ -151,15 +151,22 @@ class MathLaTeXML extends MathRenderer {
return $host;
}
/**
* Calculates the HTTP POST Data for the request. Depends on the settings
* and the input string only.
* @return string HTTP POST data
*/
public function getPostData(){
$texcmd = urlencode( $this->tex );
return $this->getLaTeXMLSettings() . '&tex=' . $texcmd;
}
/**
* Does the actual web request to convert TeX to MathML.
* @return boolean
*/
private function doRender( ) {
$host = self::pickHost();
$texcmd = urlencode( $this->tex );
$post = $this->getLaTeXMLSettings();
$post .= '&tex=' . $texcmd;
$post = $this->getPostData();
$this->lastError = '';
if ( $this->makeRequest( $host, $post, $res, $this->lastError ) ) {
$result = json_decode( $res );