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


PHP Server::getName方法代码示例

本文整理汇总了PHP中Server::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getName方法的具体用法?PHP Server::getName怎么用?PHP Server::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server的用法示例。


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

示例1: __construct

 public function __construct(Server $server)
 {
     $this->time = time();
     $this->server = $server;
     $this->path = $this->server->getDataPath() . "CrashDump_" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
     $this->fp = @fopen($this->path, "wb");
     if (!is_resource($this->fp)) {
         throw new \RuntimeException("Could not create Crash Dump");
     }
     $this->data["time"] = $this->time;
     $this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
     $this->addLine();
     $this->baseCrash();
     $this->generalData();
     $this->pluginsData();
     $this->extraData();
     //$this->encodeData();
 }
开发者ID:gitter-badger,项目名称:BukkitPE,代码行数:18,代码来源:CrashDump.php

示例2: CommandHello

 public function CommandHello($id, $command)
 {
     $rcon = ServerList::getServerRCon(Server::getName());
     $player = Server::getPlayer($id);
     if (isset($command[0])) {
         $target = Server::getPlayer(Server::searchPlayer($command[0]));
         if ($target === FALSE) {
             $target = 'nobody';
         }
         if (is_array($target)) {
             $target = $target[0];
         }
         $rcon->say('Hello ' . $player->name . ', it seems you like ' . $target->name . ' !');
     } else {
         $rcon->say('Hay ' . $player->name . ' !');
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:17,代码来源:dummy.php

示例3: createServer

 private static function createServer(Server $server)
 {
     //Grab connection object
     $mysqli = Utility::getSQLConnection();
     $sql = "INSERT INTO servers(";
     $sql .= "address, port, version, name, private_key, key_hash, max_clients, public, password_protected, ";
     $sql .= "allow_guests, user_count, user_list, motd, game_mode, last_heartbeat_date";
     $sql .= ") VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW())";
     $stmt = $mysqli->prepare($sql);
     if ($mysqli->errno) {
         trigger_error($mysqli->error, E_USER_ERROR);
     }
     //Bind parameters
     $stmt->bind_param("sissssisssisss", $server->getAddress(), $server->getPort(), $server->getVersion(), $server->getName(), $server->getPrivateKey(), $server->getPublicKey(), $server->getMaxClients(), $server->getPublic(), $server->getPasswordProtected(), $server->getAllowGuests(), $server->getUserCount(), $server->getUserList(), $server->getMotd(), $server->getGameMode());
     //Execute statement
     $stmt->execute();
     if ($mysqli->errno) {
         trigger_error($mysqli->error, E_USER_ERROR);
     }
     $stmt->close();
     unset($stmt);
     return "Server added successfully.\nserver=" . $server->getPublicKey();
 }
开发者ID:joshi1999,项目名称:manicdigger_website,代码行数:23,代码来源:Server.php

示例4: edit

 function edit(&$request)
 {
     $html = '';
     if ($request->exist('server')) {
         $server = new Server($request->get('server'));
     } else {
         if ($request->exist('id')) {
             $server =& $this->server_factory->getServerById($request->get('id'));
         }
     }
     if (!$server) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('admin_servers', 'error_notfound'));
         $GLOBALS['Response']->redirect('/admin/servers/');
     } else {
         $this->title = $GLOBALS['Language']->getText('admin_servers', 'all_edit', array($server->getName()));
         $html .= $this->_form($server, '/admin/servers/update/' . $server->getId());
         $html .= $this->_fetchServices($server);
     }
     return $html;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:20,代码来源:index.php

示例5: grantAuthedRights

 /** Grants the given player rights.
  * This function grants the player his rights when he's authed. No auth verification is performed with this function.
  * 
  * \param $player The player to grant rights to.
  * \param $authname The name on which the player is authed.
  * \param $auth The auth parameters (IP, aliases, GUIDs).
  * 
  * \return Nothing.
  */
 private function grantAuthedRights($player, $authname, $auth)
 {
     //Auth the player
     $player->auth = $authname;
     $player->level = $auth['level'];
     //Save player data modification
     $modif = TRUE;
     if (!in_array($player->name, $auth['aliases'])) {
         $this->rights[$authname]['aliases'][] = $player->name;
     } elseif ($player->ip != $auth['IP']) {
         $this->rights[$authname]['IP'] = $player->ip;
     } elseif (!isset($auth['GUID'][Server::getName()]) || $auth['GUID'][Server::getName()] != $player->guid) {
         $this->rights[$authname]['GUID'][Server::getName()] = $player->guid;
     } else {
         $modif = FALSE;
     }
     //If a modification occured, we save the authlist
     if ($modif) {
         $this->saveRights($this->config['RightsFile']);
     }
     if ($this->config['Verbose']) {
         RCon::tell($player->id, 'You\'re now authed as $0', $authname);
     }
     $this->_plugins->callEventSimple('rights', 'authenticate', $player->id, $authname);
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:34,代码来源:basicrights.php

示例6: _parseBanCommand

 /** Parses a ban command to get ban infos.
  * This function takes an array of parameters like the ones given to the !ban command and parses them to get needed infos for the ban,
  * according to the specifications of the command PluginBans::CommandBan()
  * 
  * \param $command the command parameters to parse.
  * 
  * \return An array containing the ban infos.
  */
 private function _parseBanCommand($command)
 {
     $baninfo = array('players' => array(), 'from' => array(), 'for' => array(), 'permanent' => FALSE);
     $category = 'players';
     //Parsing command
     foreach ($command as $param) {
         if ($param == 'from' || $param == 'for') {
             $category = $param;
         } elseif ($param == 'forever') {
             $baninfo['permanent'] = TRUE;
         } else {
             $baninfo[$category][] = $param;
         }
     }
     //Setting default realm if not present
     if (empty($baninfo['from']) && isset($this->config['DefaultRealm']) && $this->config['DefaultRealm'] == 'server') {
         $baninfo['from'][] = self::GLOBALBAN;
     } elseif (empty($baninfo['from'])) {
         $baninfo['from'][] = Server::getName();
     }
     //Setting default duration if not present
     $duration = $this->_parseBanDuration(join(' ', $baninfo['for']));
     if ($duration == -1 && $this->_defaultBanDuration !== NULL) {
         $duration = $this->_defaultBanDuration;
     } elseif ($duration == -1) {
         $duration = $this->_durations['day'];
     }
     if (!$baninfo['permanent']) {
         $return = array('banned' => $baninfo['players'], 'servers' => $baninfo['from'], 'duration' => $duration);
     } else {
         $return = array('banned' => $baninfo['players'], 'servers' => $baninfo['from'], 'duration' => 'forever');
     }
     return $return;
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:42,代码来源:bans.php

示例7: IrcPlayers

 public function IrcPlayers($pseudo, $channel, $cmd, $message)
 {
     $serverlist = ServerList::getList();
     $actual = Server::getName();
     if (isset($cmd[1]) && in_array($cmd[1], $serverlist)) {
         Server::setServer($this->_main->servers[$cmd[1]]);
         $this->_printPlayers($cmd[1]);
     } else {
         foreach ($serverlist as $server) {
             Server::setServer($this->_main->servers[$server]);
             $this->_printPlayers();
         }
     }
     Server::setServer($this->_main->servers[$actual]);
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:15,代码来源:clientbase.php

示例8: IrcStats

 public function IrcStats($pseudo, $channel, $cmd, $message)
 {
     $server = LeelaBotIrc::nameOfServer($cmd[2], FALSE);
     $actual = Server::getName();
     if (isset($cmd[1])) {
         if ($server !== false) {
             Server::setServer($this->_main->servers[$server]);
             $target = Server::searchPlayer(trim($cmd[1]));
             if (!$target) {
                 LeelaBotIrc::sendMessage("Unknown player");
             } elseif (is_array($target)) {
                 $players = array();
                 foreach ($target as $p) {
                     $players[] = Server::getPlayer($p)->name;
                 }
                 LeelaBotIrc::sendMessage("Multiple players found : " . join(', ', $players));
             } else {
                 $buffer = array();
                 $_stats = Server::get('stats');
                 $_awards = Server::get('awards');
                 $player = Server::getPlayer($target);
                 if ($_stats[$player->id]['deaths'] != 0) {
                     $ratio = $_stats[$player->id]['kills'] / $_stats[$player->id]['deaths'];
                 } else {
                     $ratio = $_stats[$player->id]['kills'];
                 }
                 if (in_array('hits', $this->config['ShowStats'])) {
                     //Gestion des hits en fonction de la configuration du plugin de stats
                     $hits = "Hits : " . $_stats[$player->id]['hits'] . " - ";
                 }
                 if (Server::getServer()->serverInfo['g_gametype'] == 7) {
                     //Gestion des caps uniquement en CTF
                     $caps = " - Caps : " . $_stats[$player->id]['caps'];
                 }
                 LeelaBotIrc::sendMessage("Stats de " . $player->name . " : " . $hits . "Kills : " . $_stats[$player->id]['kills'] . " - Deaths : " . $_stats[$player->id]['deaths'] . " - Ratio : " . $ratio . $caps . " - Streaks : " . $_stats[$player->id]['streaks']);
             }
             Server::setServer($this->_main->servers[$actual]);
         }
     } else {
         LeelaBotIrc::sendMessage("Player name missing");
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:42,代码来源:stats.php

示例9: SrvEventSay

 public function SrvEventSay($id, $contents)
 {
     if ($contents[0] != '!') {
         $nick = LeelaBotIrc::rmColor(Server::getPlayer($id)->name);
         $message = LeelaBotIrc::rmColor($contents);
         $server = Server::getName();
         if (is_array($this->config['AutoSpeak'])) {
             foreach ($this->config['Channels'] as $channel) {
                 if (isset($this->config['AutoSpeak'][$server][$channel]) && in_array($this->config['AutoSpeak'][$server][$channel], array(1, 2))) {
                     LeelaBotIrc::privmsg($channel, "[" . $server . "] <" . $nick . "> : " . $message);
                 }
             }
         } elseif (is_numeric($this->config['AutoSpeak'])) {
             if (in_array($this->config['AutoSpeak'], array(1, 2))) {
                 foreach ($this->config['Channels'] as $channel) {
                     LeelaBotIrc::privmsg($channel, "[" . $server . "] <" . $nick . "> : " . $message);
                 }
             }
         }
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:21,代码来源:irc.php

示例10: callAllRoutines

 /** Executes all the routines for all plugins.
  * This function executes all the routines for all plugins, whether checking if their interval timed out, or not (so all routines are executed), depending
  * on the value of the \b $force param.
  * 
  * \param $force Forces the routines to be executed or not. By default it does not executes them.
  * 
  * \return TRUE if routines executed correctly, FALSE otherwise.
  */
 public function callAllRoutines($force = FALSE)
 {
     $serverPlugins = Server::getPlugins();
     $serverName = Server::getName();
     foreach ($this->_routines as $className => &$class) {
         foreach ($class as $name => &$routine) {
             if ($force || !isset($routine[2][$serverName]) || time() >= $routine[2][$serverName] + $routine[1]) {
                 if (in_array($this->_pluginClasses[$className], $serverPlugins) || $routine[3]) {
                     $routine[0]->{$name}();
                     $routine[2][$serverName] = time();
                 }
             }
         }
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:23,代码来源:plugins.class.php

示例11: log

 /** Logs the data into specific logs.
  * This function logs the specified data into the right logfile, adding the date and a line return.
  * 
  * \param $log The log to write to.
  * \param $text The text to write in the log.
  * \param $server The server on which the data will be logged. Defaults to the current server.
  * 
  * \return TRUE if the text has been correctly logged, FALSE otherwise.
  */
 public function log($log, $text, $server = NULL)
 {
     if ($server === NULL) {
         $server = Server::getName();
     }
     if (!isset($this->_logFiles[$server])) {
         return FALSE;
     }
     if (!isset($this->_logFiles[$server][$log])) {
         return FALSE;
     }
     $ret = fputs($this->_logFiles[$server][$log], date(Locales::getDateTimeFormat()) . ' - ' . $text . "\n");
     return $ret !== FALSE;
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:23,代码来源:logs.php


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