本文整理汇总了PHP中rTorrentSettings::getCmd方法的典型用法代码示例。如果您正苦于以下问题:PHP rTorrentSettings::getCmd方法的具体用法?PHP rTorrentSettings::getCmd怎么用?PHP rTorrentSettings::getCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rTorrentSettings
的用法示例。
在下文中一共展示了rTorrentSettings::getCmd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendTorrent
public static function sendTorrent($fname, $isStart, $directory = null)
{
$hash = false;
$torrent = is_object($fname) ? $fname : new \model\simple\Torrent($fname);
if (!$torrent->errors()) {
$raw_value = base64_encode($torrent->__toString());
$filename = is_object($fname) ? $torrent->getFileName() : $fname;
if (strlen($raw_value) < self::RTORRENT_PACKET_LIMIT || is_null($filename)) {
$cmd = new rXMLRPCCommand(\config\Conf::$userscgi, $isStart ? 'load.raw_start' : 'load.raw');
$cmd->addParameter("");
$cmd->addParameter($raw_value, "base64");
if (!is_null($filename) && !true) {
@unlink($filename);
}
} else {
$cmd = new rXMLRPCCommand(\config\Conf::$userscgi, $isStart ? 'load.start' : 'load.normal');
$cmd->addParameter("");
$cmd->addParameter($filename);
}
if (!is_null($filename) && rTorrentSettings::get(\config\Conf::$userscgi)->iVersion >= 0x805) {
$cmd->addParameter(rTorrentSettings::getCmd(\config\Conf::$userscgi, "d.custom.set") . "=x-filename," . rawurlencode(basename($filename)));
}
$req = new rXMLRPCRequest(\config\Conf::$userscgi);
$req->addCommand($cmd);
if (!is_null($directory)) {
$cmd->addParameter(rTorrentSettings::getCmd(\config\Conf::$userscgi, "d.directory.set=") . "\"" . $directory . "\"");
}
if ($req->run() && !$req->fault) {
$hash = $req->val;
}
}
return $hash;
}
示例2: __construct
public function __construct($user, $cmd, $args = null)
{
//\trigger_error("ddd");
//throw new \Exception("ddd");
$this->user = $user;
$this->command = rTorrentSettings::getCmd($this->user, $cmd);
$this->params = array();
if ($args !== null) {
if (is_array($args)) {
foreach ($args as $prm) {
$this->addParameter($prm);
}
} else {
$this->addParameter($args);
}
}
}