]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/IXR/class-IXR-error.php
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-includes / IXR / class-IXR-error.php
1 <?php
2
3 /**
4  * IXR_Error
5  *
6  * @package IXR
7  * @since 1.5.0
8  */
9 class IXR_Error
10 {
11     var $code;
12     var $message;
13
14         /**
15          * PHP5 constructor.
16          */
17     function __construct( $code, $message )
18     {
19         $this->code = $code;
20         $this->message = htmlspecialchars($message);
21     }
22
23         /**
24          * PHP4 constructor.
25          */
26         public function IXR_Error( $code, $message ) {
27                 self::__construct( $code, $message );
28         }
29
30     function getXml()
31     {
32         $xml = <<<EOD
33 <methodResponse>
34   <fault>
35     <value>
36       <struct>
37         <member>
38           <name>faultCode</name>
39           <value><int>{$this->code}</int></value>
40         </member>
41         <member>
42           <name>faultString</name>
43           <value><string>{$this->message}</string></value>
44         </member>
45       </struct>
46     </value>
47   </fault>
48 </methodResponse>
49
50 EOD;
51         return $xml;
52     }
53 }