本文整理匯總了PHP中api::encodePlain方法的典型用法代碼示例。如果您正苦於以下問題:PHP api::encodePlain方法的具體用法?PHP api::encodePlain怎麽用?PHP api::encodePlain使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類api
的用法示例。
在下文中一共展示了api::encodePlain方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
public function execute($message)
{
global $pluginManager;
global $t;
$t->setPlugin("netutils");
$reply = "";
$data = $message->getData();
$shell = new Shell();
$execute = true;
$call = $message->getCommand();
array_shift($data);
switch ($call) {
case "nslookup":
$shell->setFilter(array("main" => "nslookup", "subarg" => array()));
$cmd = "nslookup " . implode(" ", $data);
break;
case "dig":
$shell->setFilter(array("main" => "dig", "subarg" => array()));
$cmd = "dig " . implode(" ", $data);
break;
case "nmap":
$shell->setFilter(array("main" => "nmap", "subarg" => array()));
$cmd = "nmap " . implode(" ", $data);
break;
case "whois":
$shell->setFilter(array("main" => "whois", "subarg" => array()));
$cmd = "whois " . implode(" ", $data);
break;
default:
$reply = $t->g("default");
$execute = false;
break;
}
if ($execute) {
$shell->setCmd($cmd);
if ($shell->execute()) {
$reply = "`\$ " . api::encodePlain($cmd) . "\n" . api::encodePlain(implode("\n", $shell->getOutput())) . "`";
} else {
$reply = sprintf($t->g("command_error"), api::encodePlain($cmd));
}
}
// Api::reply($message, $reply, true);
global $api;
$api->sendMessage($message->chat->id, $reply, "Markdown", true);
}