commit | author | age
|
8bd4d9
|
1 |
<?php |
JK |
2 |
/** |
|
3 |
* Klasa konwertuje wiadomość ({@link BotMsg}) do formatu odpowiedniego dla IMified.com |
|
4 |
*/ |
|
5 |
class BotMsgIMI implements BotMsgInterface { |
|
6 |
private $html = ''; |
|
7 |
|
|
8 |
/** |
|
9 |
* @param BotMsg $msg Wiadomość do przekonwertowania |
|
10 |
*/ |
|
11 |
function __construct(BotMsg $msg) { |
|
12 |
$msg->a('<reset />'); |
|
13 |
$parser = $msg->getParser(); |
|
14 |
$this->html = $parser->saveXML($parser->getElementsByTagName('body')->item(0)); |
|
15 |
$this->html = (string)substr($this->html, 6, -7); |
|
16 |
} |
|
17 |
|
|
18 |
/** |
|
19 |
* @return string |
|
20 |
* Zwraca wiadomość zgodną z API IMified.com |
|
21 |
*/ |
|
22 |
function __toString() { |
|
23 |
return $this->html; |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* @return string |
|
28 |
* Zwraca wiadomość w formacie HTML z tagami odpowienimi dla IMified.com |
|
29 |
*/ |
|
30 |
function getHTML() { |
|
31 |
return $this->html; |
|
32 |
} |
|
33 |
|
|
34 |
function sendPullResponse() { |
|
35 |
header('Content-Type: text/html; charset=utf-8'); |
|
36 |
echo $this; |
|
37 |
} |
|
38 |
} |
|
39 |
?> |