TeamSpeak 3 PHP Framework
Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
TeamSpeak3_Viewer_Html Class Reference

Renders nodes used in HTML-based TeamSpeak 3 viewers. More...

+ Inheritance diagram for TeamSpeak3_Viewer_Html:

Public Member Functions

 __construct ($iconpath="images/viewer/", $flagpath=null, $ftclient=null, $pattern=null)
 The TeamSpeak3_Viewer_Html constructor. More...
 
 fetchObject (TeamSpeak3_Node_Abstract $node, array $siblings=array())
 Returns the code needed to display a node in a TeamSpeak 3 viewer. More...
 
- Public Member Functions inherited from TeamSpeak3_Viewer_Interface
 fetchObject (TeamSpeak3_Node_Abstract $node, array $siblings=array())
 Returns the code needed to display a node in a TeamSpeak 3 viewer. More...
 

Protected Member Functions

 getContainerClass ()
 Returns a dynamic string for the current container element which can be used as a HTML class property. More...
 
 getContainerIdent ()
 Returns a unique identifier for the current node which can be used as a HTML id property. More...
 
 getContainerSummary ()
 Returns the ID of the current node which will be used as a summary element for the container element. More...
 
 getCorpusClass ()
 Returns a string for the current corpus element which can be used as a HTML class property. More...
 
 getCorpusIcon ()
 Returns a HTML img tag which can be used to display the status icon for a TeamSpeak_Node_Abstract object. More...
 
 getCorpusName ()
 Returns a string for the current corpus element which contains the display name for the current TeamSpeak_Node_Abstract object. More...
 
 getCorpusTitle ()
 Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Abstract object. More...
 
 getImage ($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
 Returns the code to display a custom HTML img tag. More...
 
 getPrefix ()
 Returns the HTML img tags to display the prefix of the current node. More...
 
 getPrefixClass ()
 Returns a string for the current prefix element which can be used as a HTML class property. More...
 
 getRowClass ()
 Returns a dynamic string for the current row element which can be used as a HTML class property. More...
 
 getSuffixClass ()
 Returns a string for the current suffix element which can be used as a HTML class property. More...
 
 getSuffixFlag ()
 Returns a HTML img tag which can be used to display the country flag for a TeamSpeak_Node_Client object. More...
 
 getSuffixIcon ()
 Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Abstract object. More...
 
 getSuffixIconChannel ()
 Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Channel object. More...
 
 getSuffixIconClient ()
 Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Client object. More...
 
 getSuffixIconServer ()
 Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Server object. More...
 

Detailed Description

Renders nodes used in HTML-based TeamSpeak 3 viewers.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $iconpath = "images/viewer/",
  $flagpath = null,
  $ftclient = null,
  $pattern = null 
)

The TeamSpeak3_Viewer_Html constructor.

Parameters
string$iconpath
string$flagpath
string$ftclient
string$pattern
Returns
void
108  {
109  $this->iconpath = $iconpath;
110  $this->flagpath = $flagpath;
111  $this->ftclient = $ftclient;
112 
113  if($pattern)
114  {
115  $this->pattern = $pattern;
116  }
117  }

Member Function Documentation

◆ fetchObject()

fetchObject ( TeamSpeak3_Node_Abstract  $node,
array  $siblings = array() 
)

Returns the code needed to display a node in a TeamSpeak 3 viewer.

Parameters
TeamSpeak3_Node_Abstract$node
array$siblings
Returns
string
127  {
128  $this->currObj = $node;
129  $this->currSib = $siblings;
130 
131  $args = array(
132  $this->getContainerIdent(),
133  $this->getContainerClass(),
134  $this->getContainerSummary(),
135  $this->getRowClass(),
136  $this->getPrefixClass(),
137  $this->getPrefix(),
138  $this->getCorpusClass(),
139  $this->getCorpusTitle(),
140  $this->getCorpusIcon(),
141  $this->getCorpusName(),
142  $this->getSuffixClass(),
143  $this->getSuffixIcon(),
144  $this->getSuffixFlag(),
145  );
146 
147  return TeamSpeak3_Helper_String::factory($this->pattern)->arg($args);
148  }
getSuffixFlag()
Returns a HTML img tag which can be used to display the country flag for a TeamSpeak_Node_Client obje...
Definition: Html.php:652
getPrefix()
Returns the HTML img tags to display the prefix of the current node.
Definition: Html.php:210
getCorpusIcon()
Returns a HTML img tag which can be used to display the status icon for a TeamSpeak_Node_Abstract obj...
Definition: Html.php:316
getPrefixClass()
Returns a string for the current prefix element which can be used as a HTML class property...
Definition: Html.php:200
getSuffixIcon()
Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Abstrac...
Definition: Html.php:385
getCorpusClass()
Returns a string for the current corpus element which can be used as a HTML class property...
Definition: Html.php:236
getContainerClass()
Returns a dynamic string for the current container element which can be used as a HTML class property...
Definition: Html.php:167
getContainerIdent()
Returns a unique identifier for the current node which can be used as a HTML id property.
Definition: Html.php:156
getContainerSummary()
Returns the ID of the current node which will be used as a summary element for the container element...
Definition: Html.php:178
getRowClass()
Returns a dynamic string for the current row element which can be used as a HTML class property...
Definition: Html.php:189
getSuffixClass()
Returns a string for the current suffix element which can be used as a HTML class property...
Definition: Html.php:374
getCorpusName()
Returns a string for the current corpus element which contains the display name for the current TeamS...
Definition: Html.php:329
static factory($string)
Returns a TeamSpeak3_Helper_String object for thegiven string.
Definition: String.php:60
getCorpusTitle()
Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Abstrac...
Definition: Html.php:290

◆ getContainerClass()

getContainerClass ( )
protected

Returns a dynamic string for the current container element which can be used as a HTML class property.

Returns
string
168  {
169  return "ts3_viewer " . $this->currObj->getClass(null);
170  }

◆ getContainerIdent()

getContainerIdent ( )
protected

Returns a unique identifier for the current node which can be used as a HTML id property.

Returns
string
157  {
158  return $this->currObj->getUniqueId();
159  }

◆ getContainerSummary()

getContainerSummary ( )
protected

Returns the ID of the current node which will be used as a summary element for the container element.

Returns
integer
179  {
180  return $this->currObj->getId();
181  }

◆ getCorpusClass()

getCorpusClass ( )
protected

Returns a string for the current corpus element which can be used as a HTML class property.

If the current node is a channel spacer the class string will contain additional class names to allow further customization of the content via CSS.

Returns
string
237  {
238  $extras = "";
239 
240  if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer())
241  {
242  switch($this->currObj->spacerGetType())
243  {
244  case (string) TeamSpeak3::SPACER_SOLIDLINE:
245  $extras .= " solidline";
246  break;
247 
248  case (string) TeamSpeak3::SPACER_DASHLINE:
249  $extras .= " dashline";
250  break;
251 
252  case (string) TeamSpeak3::SPACER_DASHDOTLINE:
253  $extras .= " dashdotline";
254  break;
255 
256  case (string) TeamSpeak3::SPACER_DASHDOTDOTLINE:
257  $extras .= " dashdotdotline";
258  break;
259 
260  case (string) TeamSpeak3::SPACER_DOTLINE:
261  $extras .= " dotline";
262  break;
263  }
264 
265  switch($this->currObj->spacerGetAlign())
266  {
268  $extras .= " center";
269  break;
270 
272  $extras .= " right";
273  break;
274 
276  $extras .= " left";
277  break;
278  }
279  }
280 
281  return "corpus " . $this->currObj->getClass(null) . $extras;
282  }
Class describing a TeamSpeak 3 channel and all it's parameters.
Definition: Channel.php:29
const SPACER_ALIGN_CENTER
2: alignment center
Definition: TeamSpeak3.php:242
const SPACER_ALIGN_RIGHT
1: alignment right
Definition: TeamSpeak3.php:241
const SPACER_DASHDOTDOTLINE
4: dash dot dot line
Definition: TeamSpeak3.php:234
const SPACER_DASHDOTLINE
3: dash dot line
Definition: TeamSpeak3.php:233
const SPACER_ALIGN_LEFT
0: alignment left
Definition: TeamSpeak3.php:240
const SPACER_SOLIDLINE
0: solid line
Definition: TeamSpeak3.php:230
isSpacer()
Returns TRUE if the channel is a spacer.
Definition: Channel.php:386
const SPACER_DASHLINE
1: dash line
Definition: TeamSpeak3.php:231
const SPACER_DOTLINE
2: dot line
Definition: TeamSpeak3.php:232

◆ getCorpusIcon()

getCorpusIcon ( )
protected

Returns a HTML img tag which can be used to display the status icon for a TeamSpeak_Node_Abstract object.

Returns
string
317  {
318  if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer()) return;
319 
320  return $this->getImage($this->currObj->getIcon() . ".png");
321  }
Class describing a TeamSpeak 3 channel and all it's parameters.
Definition: Channel.php:29
getImage($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
Returns the code to display a custom HTML img tag.
Definition: Html.php:672
isSpacer()
Returns TRUE if the channel is a spacer.
Definition: Channel.php:386

◆ getCorpusName()

getCorpusName ( )
protected

Returns a string for the current corpus element which contains the display name for the current TeamSpeak_Node_Abstract object.

Returns
string
330  {
331  if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer())
332  {
333  if($this->currObj->spacerGetType() != TeamSpeak3::SPACER_CUSTOM) return;
334 
335  $string = $this->currObj["channel_name"]->section("]", 1, 99);
336 
337  if($this->currObj->spacerGetAlign() == TeamSpeak3::SPACER_ALIGN_REPEAT)
338  {
339  $string->resize(30, $string);
340  }
341 
342  return htmlspecialchars($string);
343  }
344 
345  if($this->currObj instanceof TeamSpeak3_Node_Client)
346  {
347  $before = array();
348  $behind = array();
349 
350  foreach($this->currObj->memberOf() as $group)
351  {
352  if($group->getProperty("namemode") == TeamSpeak3::GROUP_NAMEMODE_BEFORE)
353  {
354  $before[] = "[" . htmlspecialchars($group["name"]) . "]";
355  }
356  elseif($group->getProperty("namemode") == TeamSpeak3::GROUP_NAMEMODE_BEHIND)
357  {
358  $behind[] = "[" . htmlspecialchars($group["name"]) . "]";
359  }
360  }
361 
362  return implode("", $before) . " " . htmlspecialchars($this->currObj) . " " . implode("", $behind);
363  }
364 
365  return htmlspecialchars($this->currObj);
366  }
Class describing a TeamSpeak 3 client and all it's parameters.
Definition: Client.php:29
const SPACER_ALIGN_REPEAT
3: repeat until the whole line is filled
Definition: TeamSpeak3.php:243
Class describing a TeamSpeak 3 channel and all it's parameters.
Definition: Channel.php:29
const GROUP_NAMEMODE_BEHIND
2: display name after client nickname
Definition: TeamSpeak3.php:166
isSpacer()
Returns TRUE if the channel is a spacer.
Definition: Channel.php:386
const SPACER_CUSTOM
5: custom format
Definition: TeamSpeak3.php:235
const GROUP_NAMEMODE_BEFORE
1: display name before client nickname
Definition: TeamSpeak3.php:165

◆ getCorpusTitle()

getCorpusTitle ( )
protected

Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Abstract object.

Returns
string
291  {
292  if($this->currObj instanceof TeamSpeak3_Node_Server)
293  {
294  return "ID: " . $this->currObj->getId() . " | Clients: " . $this->currObj->clientCount() . "/" . $this->currObj["virtualserver_maxclients"] . " | Uptime: " . TeamSpeak3_Helper_Convert::seconds($this->currObj["virtualserver_uptime"]);
295  }
296  elseif($this->currObj instanceof TeamSpeak3_Node_Channel && !$this->currObj->isSpacer())
297  {
298  return "ID: " . $this->currObj->getId() . " | Codec: " . TeamSpeak3_Helper_Convert::codec($this->currObj["channel_codec"]) . " | Quality: " . $this->currObj["channel_codec_quality"];
299  }
300  elseif($this->currObj instanceof TeamSpeak3_Node_Client)
301  {
302  return "ID: " . $this->currObj->getId() . " | Version: " . TeamSpeak3_Helper_Convert::versionShort($this->currObj["client_version"]) . " | Platform: " . $this->currObj["client_platform"];
303  }
304  elseif($this->currObj instanceof TeamSpeak3_Node_Servergroup || $this->currObj instanceof TeamSpeak3_Node_Channelgroup)
305  {
306  return "ID: " . $this->currObj->getId() . " | Type: " . TeamSpeak3_Helper_Convert::groupType($this->currObj["type"]) . " (" . ($this->currObj["savedb"] ? "Permanent" : "Temporary") . ")";
307  }
308  }
Class describing a TeamSpeak 3 client and all it's parameters.
Definition: Client.php:29
Class describing a TeamSpeak 3 channel and all it's parameters.
Definition: Channel.php:29
static groupType($type)
Converts a given group type ID to a human readable name.
Definition: Convert.php:101
Class describing a TeamSpeak 3 channel group and all it's parameters.
Definition: Channelgroup.php:29
Class describing a TeamSpeak 3 server group and all it's parameters.
Definition: Servergroup.php:29
isSpacer()
Returns TRUE if the channel is a spacer.
Definition: Channel.php:386
Class describing a TeamSpeak 3 virtual server and all it's parameters.
Definition: Server.php:29
static versionShort($version)
Returns a client-like short-formatted version of the TeamSpeak 3 version string.
Definition: Convert.php:330
static codec($codec)
Converts a given codec ID to a human readable name.
Definition: Convert.php:77
static seconds($seconds, $is_ms=FALSE, $format="%dD %02d:%02d:%02d")
Converts seconds/milliseconds to a human readable value.
Definition: Convert.php:64

◆ getImage()

getImage (   $name,
  $text = "",
  $class = null,
  $iconpath = TRUE,
  $flagpath = FALSE 
)
protected

Returns the code to display a custom HTML img tag.

Parameters
string$name
string$text
string$class
boolean$iconpath
boolean$flagpath
Returns
string
673  {
674  $src = "";
675 
676  if($iconpath)
677  {
678  $src = $this->iconpath;
679  }
680 
681  if($flagpath)
682  {
683  $src = $this->flagpath;
684  }
685 
686  return "<img src='" . $src . $name . "' title='" . $text . "' alt='' align='top' />";
687  }

◆ getPrefix()

getPrefix ( )
protected

Returns the HTML img tags to display the prefix of the current node.

Returns
string
211  {
212  $prefix = "";
213 
214  if(count($this->currSib))
215  {
216  $last = array_pop($this->currSib);
217 
218  foreach($this->currSib as $sibling)
219  {
220  $prefix .= ($sibling) ? $this->getImage("tree_line.gif") : $this->getImage("tree_blank.png");
221  }
222 
223  $prefix .= ($last) ? $this->getImage("tree_end.gif") : $this->getImage("tree_mid.gif");
224  }
225 
226  return $prefix;
227  }
getImage($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
Returns the code to display a custom HTML img tag.
Definition: Html.php:672

◆ getPrefixClass()

getPrefixClass ( )
protected

Returns a string for the current prefix element which can be used as a HTML class property.

Returns
string
201  {
202  return "prefix " . $this->currObj->getClass(null);
203  }

◆ getRowClass()

getRowClass ( )
protected

Returns a dynamic string for the current row element which can be used as a HTML class property.

Returns
string
190  {
191  return ++$this->currNum%2 ? "row1" : "row2";
192  }

◆ getSuffixClass()

getSuffixClass ( )
protected

Returns a string for the current suffix element which can be used as a HTML class property.

Returns
string
375  {
376  return "suffix " . $this->currObj->getClass(null);
377  }

◆ getSuffixFlag()

getSuffixFlag ( )
protected

Returns a HTML img tag which can be used to display the country flag for a TeamSpeak_Node_Client object.

Returns
string
653  {
654  if(!$this->currObj instanceof TeamSpeak3_Node_Client) return;
655 
656  if($this->flagpath && $this->currObj["client_country"])
657  {
658  return $this->getImage($this->currObj["client_country"]->toLower() . ".png", $this->currObj["client_country"], null, FALSE, TRUE);
659  }
660  }
Class describing a TeamSpeak 3 client and all it&#39;s parameters.
Definition: Client.php:29
getImage($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
Returns the code to display a custom HTML img tag.
Definition: Html.php:672

◆ getSuffixIcon()

getSuffixIcon ( )
protected

Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Abstract object.

Returns
string
386  {
387  if($this->currObj instanceof TeamSpeak3_Node_Server)
388  {
389  return $this->getSuffixIconServer();
390  }
391  elseif($this->currObj instanceof TeamSpeak3_Node_Channel)
392  {
393  return $this->getSuffixIconChannel();
394  }
395  elseif($this->currObj instanceof TeamSpeak3_Node_Client)
396  {
397  return $this->getSuffixIconClient();
398  }
399  }
Class describing a TeamSpeak 3 client and all it&#39;s parameters.
Definition: Client.php:29
Class describing a TeamSpeak 3 channel and all it&#39;s parameters.
Definition: Channel.php:29
getSuffixIconClient()
Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Client ...
Definition: Html.php:525
getSuffixIconServer()
Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Server ...
Definition: Html.php:407
Class describing a TeamSpeak 3 virtual server and all it&#39;s parameters.
Definition: Server.php:29
getSuffixIconChannel()
Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Channel...
Definition: Html.php:455

◆ getSuffixIconChannel()

getSuffixIconChannel ( )
protected

Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Channel object.

Returns
string
456  {
457  if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer()) return;
458 
459  $html = "";
460 
461  if($this->currObj["channel_flag_default"])
462  {
463  $html .= $this->getImage("channel_flag_default.png", "Default Channel");
464  }
465 
466  if($this->currObj["channel_flag_password"])
467  {
468  $html .= $this->getImage("channel_flag_password.png", "Password-protected");
469  }
470 
471  if($this->currObj["channel_codec"] == TeamSpeak3::CODEC_CELT_MONO || $this->currObj["channel_codec"] == TeamSpeak3::CODEC_OPUS_MUSIC)
472  {
473  $html .= $this->getImage("channel_flag_music.png", "Music Codec");
474  }
475 
476  if($this->currObj["channel_needed_talk_power"])
477  {
478  $html .= $this->getImage("channel_flag_moderated.png", "Moderated");
479  }
480 
481  if($this->currObj["channel_icon_id"])
482  {
483  if(!$this->currObj->iconIsLocal("channel_icon_id") && $this->ftclient)
484  {
485  if(!isset($this->cacheIcon[$this->currObj["channel_icon_id"]]))
486  {
487  $download = $this->currObj->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName("channel_icon_id"));
488 
489  if($this->ftclient == "data:image")
490  {
491  $download = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"])->download($download["ftkey"], $download["size"]);
492  }
493 
494  $this->cacheIcon[$this->currObj["channel_icon_id"]] = $download;
495  }
496  else
497  {
498  $download = $this->cacheIcon[$this->currObj["channel_icon_id"]];
499  }
500 
501  if($this->ftclient == "data:image")
502  {
503  $html .= $this->getImage("data:" . TeamSpeak3_Helper_Convert::imageMimeType($download) . ";base64," . base64_encode($download), "Channel Icon", null, FALSE);
504  }
505  else
506  {
507  $html .= $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Channel Icon", null, FALSE);
508  }
509  }
510  elseif(in_array($this->currObj["channel_icon_id"], $this->cachedIcons))
511  {
512  $html .= $this->getImage("group_icon_" . $this->currObj["channel_icon_id"] . ".png", "Channel Icon");
513  }
514  }
515 
516  return $html;
517  }
Class describing a TeamSpeak 3 channel and all it&#39;s parameters.
Definition: Channel.php:29
const CODEC_CELT_MONO
3: celt mono (mono, 16bit, 48kHz)
Definition: TeamSpeak3.php:101
getImage($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
Returns the code to display a custom HTML img tag.
Definition: Html.php:672
static imageMimeType($binary)
Tries to detect the type of an image by a given string and returns it.
Definition: Convert.php:346
isSpacer()
Returns TRUE if the channel is a spacer.
Definition: Channel.php:386
static factory($uri)
Factory for TeamSpeak3_Adapter_Abstract classes.
Definition: TeamSpeak3.php:316
const CODEC_OPUS_MUSIC
3: opus music (interactive)
Definition: TeamSpeak3.php:103

◆ getSuffixIconClient()

getSuffixIconClient ( )
protected

Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Client object.

Returns
string
526  {
527  $html = "";
528 
529  if($this->currObj["client_is_priority_speaker"])
530  {
531  $html .= $this->getImage("client_priority.png", "Priority Speaker");
532  }
533 
534  if($this->currObj["client_is_channel_commander"])
535  {
536  $html .= $this->getImage("client_cc.png", "Channel Commander");
537  }
538 
539  if($this->currObj["client_is_talker"])
540  {
541  $html .= $this->getImage("client_talker.png", "Talk Power granted");
542  }
543  elseif($cntp = $this->currObj->getParent()->channelGetById($this->currObj["cid"])->channel_needed_talk_power)
544  {
545  if($cntp > $this->currObj["client_talk_power"])
546  {
547  $html .= $this->getImage("client_mic_muted.png", "Insufficient Talk Power");
548  }
549  }
550 
551  // Get current groups the client is a member of.
552  // Shift off first group (channel group), leaving only server groups.
553  $groups = $this->currObj->memberOf();
554  $clientGroups = [$groups[0]];
555  unset($groups[0]);
556 
557  // Create temp assoc array to use in custom uasort function.
558  $sgroups = [];
559  foreach($groups as $group) {
560  $sgroups[$group['sgid']] = $group;
561  }
562  // Use same server group sort function from TeamSpeak3_Node_Server class.
563  uasort($sgroups, array(get_class($this->currObj->getParent()), "sortGroupList"));
564 
565  // Append first group (channel group), convert to non-assoc array.
566  $clientGroups = array_merge($clientGroups, array_values($sgroups));
567  unset($sgroups); // Clean-up temp sorting array.
568 
569  foreach($clientGroups as $group)
570  {
571  if(!$group["iconid"]) continue;
572 
573  $type = ($group instanceof TeamSpeak3_Node_Servergroup) ? "Server Group" : "Channel Group";
574 
575  if(!$group->iconIsLocal("iconid") && $this->ftclient)
576  {
577  if(!isset($this->cacheIcon[$group["iconid"]]))
578  {
579  $download = $group->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $group->iconGetName("iconid"));
580 
581  if($this->ftclient == "data:image")
582  {
583  $download = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"])->download($download["ftkey"], $download["size"]);
584  }
585 
586  $this->cacheIcon[$group["iconid"]] = $download;
587  }
588  else
589  {
590  $download = $this->cacheIcon[$group["iconid"]];
591  }
592 
593  if($this->ftclient == "data:image")
594  {
595  $html .= $this->getImage("data:" . TeamSpeak3_Helper_Convert::imageMimeType($download) . ";base64," . base64_encode($download), $group . " [" . $type . "]", null, FALSE);
596  }
597  else
598  {
599  $html .= $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), $group . " [" . $type . "]", null, FALSE);
600  }
601  }
602  elseif(in_array($group["iconid"], $this->cachedIcons))
603  {
604  $html .= $this->getImage("group_icon_" . $group["iconid"] . ".png", $group . " [" . $type . "]");
605  }
606  }
607 
608  if($this->currObj["client_icon_id"])
609  {
610  if(!$this->currObj->iconIsLocal("client_icon_id") && $this->ftclient)
611  {
612  if(!isset($this->cacheIcon[$this->currObj["client_icon_id"]]))
613  {
614  $download = $this->currObj->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName("client_icon_id"));
615 
616  if($this->ftclient == "data:image")
617  {
618  $download = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"])->download($download["ftkey"], $download["size"]);
619  }
620 
621  $this->cacheIcon[$this->currObj["client_icon_id"]] = $download;
622  }
623  else
624  {
625  $download = $this->cacheIcon[$this->currObj["client_icon_id"]];
626  }
627 
628  if($this->ftclient == "data:image")
629  {
630  $html .= $this->getImage("data:" . TeamSpeak3_Helper_Convert::imageMimeType($download) . ";base64," . base64_encode($download), "Client Icon", null, FALSE);
631  }
632  else
633  {
634  $html .= $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Client Icon", null, FALSE);
635  }
636  }
637  elseif(in_array($this->currObj["client_icon_id"], $this->cachedIcons))
638  {
639  $html .= $this->getImage("group_icon_" . $this->currObj["client_icon_id"] . ".png", "Client Icon");
640  }
641  }
642 
643  return $html;
644  }
getImage($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
Returns the code to display a custom HTML img tag.
Definition: Html.php:672
static imageMimeType($binary)
Tries to detect the type of an image by a given string and returns it.
Definition: Convert.php:346
Class describing a TeamSpeak 3 server group and all it&#39;s parameters.
Definition: Servergroup.php:29
static factory($uri)
Factory for TeamSpeak3_Adapter_Abstract classes.
Definition: TeamSpeak3.php:316

◆ getSuffixIconServer()

getSuffixIconServer ( )
protected

Returns the HTML img tags which can be used to display the various icons for a TeamSpeak_Node_Server object.

Returns
string
408  {
409  $html = "";
410 
411  if($this->currObj["virtualserver_icon_id"])
412  {
413  if(!$this->currObj->iconIsLocal("virtualserver_icon_id") && $this->ftclient)
414  {
415  if(!isset($this->cacheIcon[$this->currObj["virtualserver_icon_id"]]))
416  {
417  $download = $this->currObj->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName("virtualserver_icon_id"));
418 
419  if($this->ftclient == "data:image")
420  {
421  $download = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"])->download($download["ftkey"], $download["size"]);
422  }
423 
424  $this->cacheIcon[$this->currObj["virtualserver_icon_id"]] = $download;
425  }
426  else
427  {
428  $download = $this->cacheIcon[$this->currObj["virtualserver_icon_id"]];
429  }
430 
431  if($this->ftclient == "data:image")
432  {
433  $html .= $this->getImage("data:" . TeamSpeak3_Helper_Convert::imageMimeType($download) . ";base64," . base64_encode($download), "Server Icon", null, FALSE);
434  }
435  else
436  {
437  $html .= $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Server Icon", null, FALSE);
438  }
439  }
440  elseif(in_array($this->currObj["virtualserver_icon_id"], $this->cachedIcons))
441  {
442  $html .= $this->getImage("group_icon_" . $this->currObj["virtualserver_icon_id"] . ".png", "Server Icon");
443  }
444  }
445 
446  return $html;
447  }
getImage($name, $text="", $class=null, $iconpath=TRUE, $flagpath=FALSE)
Returns the code to display a custom HTML img tag.
Definition: Html.php:672
static imageMimeType($binary)
Tries to detect the type of an image by a given string and returns it.
Definition: Convert.php:346
static factory($uri)
Factory for TeamSpeak3_Adapter_Abstract classes.
Definition: TeamSpeak3.php:316

The documentation for this class was generated from the following file: