当前位置: 首页>>代码示例>>PHP>>正文


PHP TeamSpeak3_Helper_String类代码示例

本文整理汇总了PHP中TeamSpeak3_Helper_String的典型用法代码示例。如果您正苦于以下问题:PHP TeamSpeak3_Helper_String类的具体用法?PHP TeamSpeak3_Helper_String怎么用?PHP TeamSpeak3_Helper_String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TeamSpeak3_Helper_String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchObject

 /**
  * Returns the code needed to display a node in a TeamSpeak 3 viewer.
  *
  * @param  TeamSpeak3_Node_Abstract $node
  * @param  array $siblings
  * @return string
  */
 public function fetchObject(TeamSpeak3_Node_Abstract $node, array $siblings = array())
 {
     $this->currObj = $node;
     $this->currSib = $siblings;
     $args = array($this->getPrefix(), $this->getCorpusIcon(), $this->getCorpusName());
     return TeamSpeak3_Helper_String::factory($this->pattern)->arg($args);
 }
开发者ID:tech-nik89,项目名称:lpm4,代码行数:14,代码来源:Text.php

示例2: __construct

 /**
  * Creates a new TeamSpeak3_Adapter_ServerQuery_Event object.
  *
  * @param  TeamSpeak3_Helper_String $evt
  * @param  TeamSpeak3_Node_Host     $con
  * @throws TeamSpeak3_Adapter_Exception
  * @return TeamSpeak3_Adapter_ServerQuery_Event
  */
 public function __construct(TeamSpeak3_Helper_String $evt, TeamSpeak3_Node_Host $con = null)
 {
     if (!$evt->startsWith(TeamSpeak3::EVENT)) {
         throw new TeamSpeak3_Adapter_Exception("invalid notification event format");
     }
     list($type, $data) = $evt->split(TeamSpeak3::SEPARATOR_CELL, 2);
     if (empty($data)) {
         throw new TeamSpeak3_Adapter_Exception("invalid notification event data");
     }
     $fake = new TeamSpeak3_Helper_String(TeamSpeak3::ERROR . TeamSpeak3::SEPARATOR_CELL . "id" . TeamSpeak3::SEPARATOR_PAIR . 0 . TeamSpeak3::SEPARATOR_CELL . "msg" . TeamSpeak3::SEPARATOR_PAIR . "ok");
     $repl = new TeamSpeak3_Adapter_ServerQuery_Reply(array($data, $fake), $type);
     $this->type = $type->substr(strlen(TeamSpeak3::EVENT));
     $this->data = $repl->toList();
     $this->mesg = $data;
     TeamSpeak3_Helper_Signal::getInstance()->emit("notifyEvent", $this, $con);
     TeamSpeak3_Helper_Signal::getInstance()->emit("notify" . ucfirst($this->type), $this, $con);
 }
开发者ID:st-gc,项目名称:teamspeak-php-framework,代码行数:25,代码来源:Event.php

示例3: connect

 /**
  * Connects to a remote server.
  *
  * @throws TeamSpeak3_Transport_Exception
  * @return void
  */
 public function connect()
 {
     if ($this->stream !== null) {
         return;
     }
     $host = strval($this->config["host"]);
     $port = strval($this->config["port"]);
     $address = "udp://" . $host . ":" . $port;
     $timeout = intval($this->config["timeout"]);
     $this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
     if ($this->stream === FALSE) {
         throw new TeamSpeak3_Transport_Exception(TeamSpeak3_Helper_String::factory($errstr)->toUtf8()->toString(), $errno);
     }
     @stream_set_timeout($this->stream, $timeout);
     @stream_set_blocking($this->stream, $this->config["blocking"] ? 1 : 0);
 }
开发者ID:joelsantosjunior,项目名称:wotdb,代码行数:22,代码来源:UDP.php

示例4: syn

 /**
  * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
  * server.
  *
  * @throws TeamSpeak3_Adapter_Update_Exception
  * @return void
  */
 public function syn()
 {
     if (!isset($this->options["host"]) || empty($this->options["host"])) {
         $this->options["host"] = $this->default_host;
     }
     if (!isset($this->options["port"]) || empty($this->options["port"])) {
         $this->options["port"] = $this->default_port;
     }
     $this->initTransport($this->options, "TeamSpeak3_Transport_UDP");
     $this->transport->setAdapter($this);
     TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));
     $this->getTransport()->send(TeamSpeak3_Helper_String::fromHex(32));
     if (!preg_match_all("/,?(\\d+),?/", $this->getTransport()->read(32), $matches) || !isset($matches[1])) {
         throw new TeamSpeak3_Adapter_Update_Exception("invalid reply from the server");
     }
     $this->build_numbers = $matches[1];
     TeamSpeak3_Helper_Signal::getInstance()->emit("updateConnected", $this);
 }
开发者ID:bgame-hunter,项目名称:temars-eve-api,代码行数:25,代码来源:Update.php

示例5: download

 /**
  * Returns the content of a downloaded file as a TeamSpeak3_Helper_String object.
  *
  * @param  string  $key
  * @param  integer $size
  * @throws TeamSpeak3_Adapter_Exception
  * @return TeamSpeak3_Helper_String
  */
 public function download($ftkey, $size)
 {
     $this->init($ftkey);
     $buff = new TeamSpeak3_Helper_String("");
     $size = intval($size);
     $pack = 4096;
     for ($seek = 0; $seek < $size;) {
         $rest = $size - $seek;
         $pack = $rest < $pack ? $rest : $pack;
         $data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
         $seek = $seek + $pack;
         $buff->append($data);
     }
     $this->getProfiler()->stop();
     if (strlen($buff) != $size) {
         throw new TeamSpeak3_Adapter_Exception("incomplete file download (" . count($buff) . " of " . $size . " bytes)");
     }
     return $buff;
 }
开发者ID:ECP-Black,项目名称:ECP,代码行数:27,代码来源:FileTransfer.php

示例6: prepare

 /**
  * Uses given parameters and returns a prepared ServerQuery command.
  *
  * @param  string $cmd
  * @param  array  $params
  * @return string
  */
 public function prepare($cmd, array $params = array())
 {
     $args = array();
     $cells = array();
     foreach ($params as $ident => $value) {
         $ident = is_numeric($ident) ? "" : strtolower($ident) . TeamSpeak3::SEPARATOR_PAIR;
         if (is_array($value)) {
             $value = array_values($value);
             for ($i = 0; $i < count($value); $i++) {
                 if ($value[$i] === null) {
                     continue;
                 } elseif ($value[$i] === FALSE) {
                     $value[$i] = 0x0;
                 } elseif ($value[$i] === TRUE) {
                     $value[$i] = 0x1;
                 } elseif ($value[$i] instanceof TeamSpeak3_Node_Abstract) {
                     $value[$i] = $value[$i]->getId();
                 }
                 $cells[$i][] = $ident . TeamSpeak3_Helper_String::factory($value[$i])->escape()->toUtf8();
             }
         } else {
             if ($value === null) {
                 continue;
             } elseif ($value === FALSE) {
                 $value = 0x0;
             } elseif ($value === TRUE) {
                 $value = 0x1;
             } elseif ($value instanceof TeamSpeak3_Node_Abstract) {
                 $value = $value->getId();
             }
             $args[] = $ident . TeamSpeak3_Helper_String::factory($value)->escape()->toUtf8();
         }
     }
     foreach (array_keys($cells) as $ident) {
         $cells[$ident] = implode(TeamSpeak3::SEPARATOR_CELL, $cells[$ident]);
     }
     if (count($args)) {
         $cmd .= " " . implode(TeamSpeak3::SEPARATOR_CELL, $args);
     }
     if (count($cells)) {
         $cmd .= " " . implode(TeamSpeak3::SEPARATOR_LIST, $cells);
     }
     return trim($cmd);
 }
开发者ID:joelsantosjunior,项目名称:wotdb,代码行数:51,代码来源:ServerQuery.php

示例7: whoamiSet

 /**
  * Sets a single value in the current ServerQuery connection info.
  *
  * @param  string $ident
  * @param  mixed  $value
  * @return mixed
  */
 public function whoamiSet($ident, $value = null)
 {
     $this->whoami();
     $this->whoami[$ident] = is_numeric($value) ? intval($value) : TeamSpeak3_Helper_String::factory($value);
 }
开发者ID:ECP-Black,项目名称:ECP,代码行数:12,代码来源:Host.php

示例8: getInfo

 /**
  * Returns all information available on this node. If $convert is enabled, some property
  * values will be converted to human-readable values.
  *
  * @param  boolean $extend
  * @param  boolean $convert
  * @return array
  */
 public function getInfo($extend = TRUE, $convert = FALSE)
 {
     if ($extend) {
         $this->fetchNodeInfo();
     }
     if ($convert) {
         $info = $this->nodeInfo;
         foreach ($info as $key => $val) {
             $key = TeamSpeak3_Helper_String::factory($key);
             if ($key->contains("_bytes_")) {
                 $info[$key->toString()] = TeamSpeak3_Helper_Convert::bytes($val);
             } elseif ($key->contains("_bandwidth_")) {
                 $info[$key->toString()] = TeamSpeak3_Helper_Convert::bytes($val) . "/s";
             } elseif ($key->contains("_packets_")) {
                 $info[$key->toString()] = number_format($val, null, null, ".");
             } elseif ($key->contains("_packetloss_")) {
                 $info[$key->toString()] = sprintf("%01.2f", floatval($val->toString()) * 100) . "%";
             } elseif ($key->endsWith("_uptime")) {
                 $info[$key->toString()] = TeamSpeak3_Helper_Convert::seconds($val);
             } elseif ($key->endsWith("_icon_id")) {
                 $info[$key->toString()] = $this->iconGetName($key)->filterDigits();
             }
         }
         return $info;
     }
     return $this->nodeInfo;
 }
开发者ID:bgame-hunter,项目名称:temars-eve-api,代码行数:35,代码来源:Abstract.php

示例9: snapshotDeploy

 /**
  * Deploys snapshot data on the virtual server.
  *
  * @param  string $data
  * @param  string $mode
  * @return void
  */
 public function snapshotDeploy($data, $mode = TeamSpeak3::SNAPSHOT_STRING)
 {
     switch ($mode) {
         case TeamSpeak3::SNAPSHOT_BASE64:
             $data = TeamSpeak3_Helper_String::fromBase64($data);
             break;
         case TeamSpeak3::SNAPSHOT_HEXDEC:
             $data = TeamSpeak3_Helper_String::fromHex($data);
             break;
         default:
             $data = TeamSpeak3_Helper_String::factory($data);
             break;
     }
     $this->request("serversnapshotdeploy " . $data);
 }
开发者ID:tech-nik89,项目名称:lpm4,代码行数:22,代码来源:Server.php

示例10: prepareCustomMessage

 /**
  * Prepares a custom error message by replacing pre-defined signs with given values.
  *
  * @param  TeamSpeak3_Helper_String $mesg
  * @return TeamSpeak3_Helper_String
  */
 protected function prepareCustomMessage(TeamSpeak3_Helper_String $mesg)
 {
     $args = array("code" => $this->getCode(), "mesg" => $this->getMessage(), "line" => $this->getLine(), "file" => $this->getFile());
     return $mesg->arg($args)->toString();
 }
开发者ID:st-gc,项目名称:teamspeak-php-framework,代码行数:11,代码来源:Exception.php

示例11: readLine

 /**
  * Reads a single line of data from the stream.
  *
  * @param  string $token
  * @throws TeamSpeak3_Transport_Exception
  * @return TeamSpeak3_Helper_String
  */
 public function readLine($token = "\n")
 {
     $this->connect();
     $line = TeamSpeak3_Helper_String::factory("");
     while (!$line->endsWith($token)) {
         $this->waitForReadyRead();
         $data = @fgets($this->stream, 4096);
         TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);
         if ($data === FALSE) {
             if ($line->count()) {
                 $line->append($token);
             } else {
                 throw new TeamSpeak3_Transport_Exception("connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "' lost");
             }
         } else {
             $line->append($data);
         }
     }
     return $line->trim();
 }
开发者ID:tech-nik89,项目名称:lpm4,代码行数:27,代码来源:TCP.php

示例12: getAdapterName

 /**
  * Returns the name of an adapter class by $name.
  *
  * @param  string $name
  * @param  string $namespace
  * @throws TeamSpeak3_Adapter_Exception
  * @return string
  */
 protected static function getAdapterName($name, $namespace = "TeamSpeak3_Adapter_")
 {
     $path = self::getFilePath($namespace);
     $scan = scandir($path);
     foreach ($scan as $node) {
         $file = TeamSpeak3_Helper_String::factory($node)->toLower();
         if ($file->startsWith($name) && $file->endsWith(".php")) {
             return $namespace . str_replace(".php", "", $node);
         }
     }
     throw new TeamSpeak3_Adapter_Exception("adapter '" . $name . "' does not exist");
 }
开发者ID:bgame-hunter,项目名称:temars-eve-api,代码行数:20,代码来源:TeamSpeak3.php

示例13: permissionList

 /**
  * Returns a list of permissions available on the server instance.
  *
  * @return array
  */
 public function permissionList()
 {
     if ($this->permissionList === null) {
         $this->fetchPermissionList();
     }
     foreach ($this->permissionList as $permname => $permdata) {
         if (isset($permdata["permcatid"]) && $permdata["permgrant"]) {
             continue;
         }
         $this->permissionList[$permname]["permcatid"] = $this->permissionGetCategoryById($permdata["permid"]);
         $this->permissionList[$permname]["permgrant"] = $this->permissionGetGrantById($permdata["permid"]);
         $grantsid = "i_needed_modify_power_" . substr($permname, 2);
         if (!$permdata["permname"]->startsWith("i_needed_modify_power_") && !isset($this->permissionList[$grantsid])) {
             $this->permissionList[$grantsid]["permid"] = $this->permissionList[$permname]["permgrant"];
             $this->permissionList[$grantsid]["permname"] = TeamSpeak3_Helper_String::factory($grantsid);
             $this->permissionList[$grantsid]["permdesc"] = null;
             $this->permissionList[$grantsid]["permcatid"] = 0xff;
             $this->permissionList[$grantsid]["permgrant"] = $this->permissionList[$permname]["permgrant"];
         }
     }
     return $this->permissionList;
 }
开发者ID:hardwiregaming,项目名称:ts3-php,代码行数:27,代码来源:Host.php

示例14: version

 /**
  * Returns a client-like formatted version of the TeamSpeak 3 version string.
  *
  * @param  string $version
  * @param  string $format
  * @return string
  */
 public static function version($version, $format = "Y-m-d h:i:s")
 {
     if (!$version instanceof TeamSpeak3_Helper_String) {
         $version = new TeamSpeak3_Helper_String($version);
     }
     $buildno = $version->section("[", 1)->filterDigits()->toInt();
     return $buildno <= 15001 ? $version : $version->section("[")->append("(" . date($format, $buildno) . ")");
 }
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:15,代码来源:Convert.php

示例15: serverGroupGetProfiles

 /**
  * Returns an ordered array of regular server groups available based on a pre-defined
  * set of rules.
  *
  * @return array
  */
 public function serverGroupGetProfiles()
 {
     $profiles = array();
     foreach ($this->serverGroupList() as $sgid => $sgroup) {
         if ($sgroup["type"] != TeamSpeak3::GROUP_DBTYPE_REGULAR) {
             continue;
         }
         $profiles[$sgid] = array("b_permission_modify_power_ignore" => 0, "i_group_needed_member_add_power" => 0, "i_group_member_add_power" => 0, "i_group_needed_member_remove_power" => 0, "i_group_member_remove_power" => 0, "i_needed_modify_power_count" => 0, "i_needed_modify_power_total" => 0, "i_permission_modify_power" => 0, "i_group_needed_modify_power" => 0, "i_group_modify_power" => 0, "i_client_needed_modify_power" => 0, "i_client_modify_power" => 0, "b_virtualserver_servergroup_create" => 0, "b_virtualserver_servergroup_delete" => 0, "b_client_ignore_bans" => 0, "b_client_ignore_antiflood" => 0, "b_group_is_permanent" => 0, "i_client_needed_ban_power" => 0, "i_client_needed_kick_power" => 0, "i_client_needed_move_power" => 0, "i_client_talk_power" => 0, "__sgid" => $sgid, "__name" => $sgroup->toString(), "__node" => $sgroup);
         try {
             $perms = $this->serverGroupPermList($sgid, TRUE);
             $grant = isset($perms["i_permission_modify_power"]) ? $perms["i_permission_modify_power"]["permvalue"] : null;
         } catch (TeamSpeak3_Adapter_ServerQuery_Exception $e) {
             /* ERROR_database_empty_result */
             if ($e->getCode() != 0x501) {
                 throw $e;
             }
             $perms = array();
             $grant = null;
         }
         foreach ($perms as $permsid => $perm) {
             if (in_array($permsid, array_keys($profiles[$sgid]))) {
                 $profiles[$sgid][$permsid] = $perm["permvalue"];
             } elseif (TeamSpeak3_Helper_String::factory($permsid)->startsWith("i_needed_modify_power_")) {
                 if (!$grant || $perm["permvalue"] > $grant) {
                     continue;
                 }
                 $profiles[$sgid]["i_needed_modify_power_total"] = $profiles[$sgid]["i_needed_modify_power_total"] + $perm["permvalue"];
                 $profiles[$sgid]["i_needed_modify_power_count"]++;
             }
         }
     }
     array_multisort($profiles, SORT_DESC);
     return $profiles;
 }
开发者ID:Reaper88,项目名称:TeamSpeak3,代码行数:40,代码来源:Server.php


注:本文中的TeamSpeak3_Helper_String类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。