mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
39 lines
1009 B
PHP
39 lines
1009 B
PHP
<?php
|
|
// +-----------------------------------------------------------------------+
|
|
// | This file is part of Piwigo. |
|
|
// | |
|
|
// | For copyright and license information, please view the COPYING.txt |
|
|
// | file that was distributed with this source code. |
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
class PwgSerialPhpEncoder extends PwgResponseEncoder
|
|
{
|
|
function encodeResponse($response)
|
|
{
|
|
if ($response instanceof PwgError)
|
|
{
|
|
return serialize(
|
|
array(
|
|
'stat' => 'fail',
|
|
'err' => $response->code(),
|
|
'message' => $response->message(),
|
|
)
|
|
);
|
|
}
|
|
parent::flattenResponse($response);
|
|
return serialize(
|
|
array(
|
|
'stat' => 'ok',
|
|
'result' => $response
|
|
)
|
|
);
|
|
}
|
|
|
|
function getContentType()
|
|
{
|
|
return 'text/plain';
|
|
}
|
|
}
|
|
|
|
?>
|