mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 23:14:38 +01:00
Apply fixes from StyleCI
This commit is contained in:
parent
030c03d4b5
commit
5b0d6c3ee5
@ -174,7 +174,8 @@ if (isset($number)) {
|
||||
$'.$type.' = $MadelineProto->'.str_replace('_', '->', $method).'(['.$params.']);
|
||||
```
|
||||
');
|
||||
if ($hasentities) $example .= '
|
||||
if ($hasentities) {
|
||||
$example .= '
|
||||
## Usage of parse_mode:
|
||||
|
||||
Set parse_mode to html to enable HTML parsing of the message.
|
||||
@ -206,6 +207,7 @@ You can also use normal markdown, note that to create mentions you must use the
|
||||
|
||||
MadelineProto supports all html entities supported by [html_entity_decode](http://php.net/manual/en/function.html-entity-decode.php).
|
||||
';
|
||||
}
|
||||
file_put_contents('methods/'.$method.'.md', $header.$table.$return.$example);
|
||||
}
|
||||
|
||||
|
@ -225,6 +225,7 @@ trait TL
|
||||
|
||||
return \danog\PHP\Struct::pack('<i', $tl['id']).$this->serialize_params($tl, $arguments);
|
||||
}
|
||||
|
||||
public function serialize_params($tl, $arguments)
|
||||
{
|
||||
$serialized = '';
|
||||
@ -237,7 +238,9 @@ trait TL
|
||||
$dom = new \PHPHtmlParser\Dom();
|
||||
$dom->loadStr(str_replace("\n", '<br>', $arguments['message']), []);
|
||||
$nmessage = '';
|
||||
if (!isset($arguments['entities'])) $arguments['entities'] = [];
|
||||
if (!isset($arguments['entities'])) {
|
||||
$arguments['entities'] = [];
|
||||
}
|
||||
foreach ($dom->find('') as $tag) {
|
||||
switch ($tag->tag->name()) {
|
||||
case 'br':
|
||||
@ -267,7 +270,9 @@ trait TL
|
||||
case 'pre':
|
||||
$text = html_entity_decode($tag->innerHtml);
|
||||
$language = $tag->getAttribute('language');
|
||||
if ($language === null) $language = '';
|
||||
if ($language === null) {
|
||||
$language = '';
|
||||
}
|
||||
$arguments['entities'][] = ['_' => 'messageEntityPre', 'offset' => mb_strlen($nmessage), 'length' => mb_strlen($text), 'language' => $language];
|
||||
$nmessage .= $text;
|
||||
break;
|
||||
@ -283,7 +288,6 @@ trait TL
|
||||
$nmessage .= $text;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
$nmessage .= html_entity_decode($tag->outerHtml);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user