18 function __construct($botId = 0, array $colors = Array(), $voteMode =
false)
20 $this->botId = intval($botId);
21 $this->voteMode = $voteMode?
true:
false;
23 $this->setDefaultColor($colors);
194 if (is_string($params))
196 $params = \CUtil::JsObjectToPhp($params);
198 if (!is_array($params))
203 $colors = is_array($params[
'COLORS'])? $params[
'COLORS']: Array();
204 $voteMode = isset($params[
'VOTE']) && $params[
'VOTE'] ==
'Y';
206 $keyboard =
new self($params[
'BOT_ID'], $colors, $voteMode);
207 foreach ($params[
'BUTTONS'] as $button)
209 if (isset($button[
'TYPE']) && $button[
'TYPE'] ==
'NEWLINE')
211 $keyboard->addNewLine();
213 elseif (isset($button[
'FUNCTION']) && $options[
'ENABLE_FUNCTIONS'] !=
'Y')
218 if (isset($button[
'TEXT']))
220 foreach ($textReplace as $key => $value)
222 $button[
'TEXT'] = str_replace($key, $value, $button[
'TEXT']);
225 $keyboard->addButton($button);
229 return $keyboard->isEmpty()?
null: $keyboard;