_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q247300
MediaController.retrieveMedia
validation
public function retrieveMedia($id, $includeChildren = false, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['includeChildren' => $includeChildren], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '', $parameters, $cachePolicy); $result = new MediaResponse($result); return $result; }
php
{ "resource": "" }
q247301
MediaController.retrieveFileData
validation
public function retrieveFileData($id, $template = null, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['template' => $template], 'body' => json_encode([]), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/asset', $parameters, $cachePolicy); return $result; }
php
{ "resource": "" }
q247302
MediaController.listDeploymentSites
validation
public function listDeploymentSites($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/deployment/sites', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new DeploymentSiteResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247303
MediaController.download
validation
public function download($id, $template = null, $templateType = 'image', CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['template' => $template, 'templateType' => $templateType], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/download', $parameters, $cachePolicy); $tmpFile = tmpfile(); if (false === fwrite($tmpFile, $result)) { throw new \RuntimeException('Could not write download data to temporary file!'); } if (false === fseek($tmpFile, 0)) { throw new \RuntimeException('Could not reset file pointer of temporary file!'); } $result = $tmpFile; return $result; }
php
{ "resource": "" }
q247304
MediaController.listFolders
validation
public function listFolders($id, $depth = 0, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['depth' => $depth], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/folders', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new FolderResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247305
MediaController.listMoodboards
validation
public function listMoodboards($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/moodboards', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new MoodboardResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247306
MediaController.listSocialMediaFiles
validation
public function listSocialMediaFiles($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/socialmedia/files', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new DeploymentFile($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247307
MediaController.listSocialMedia
validation
public function listSocialMedia($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/socialmedia/sites', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new SocialMedia($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247308
MediaController.listUsages
validation
public function listUsages($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/usages', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new MediaUsageResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247309
MediaController.listVersions
validation
public function listVersions($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $id . '/versions', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new MediaVersion($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247310
MediaController.listComments
validation
public function listComments($mediaId, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/media/' . $mediaId . '/comments', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new CommentResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247311
MediaController.downloadArchive
validation
public function downloadArchive(array $ids, $template = null, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['ids' => $ids, 'template' => $template], 'body' => json_encode([]), 'headers' => [], ]; $result = $this->get('v1/media/download', $parameters, $cachePolicy); return $result; }
php
{ "resource": "" }
q247312
MediaController.uploadFileChunked
validation
public function uploadFileChunked($fileData, $name, $chunk, $chunks, $fileId, $categoryId, $title = null) { $parameters = [ 'query' => [ 'name' => $name, 'chunk' => $chunk, 'chunks' => $chunks, 'fileId' => $fileId, 'categoryId' => $categoryId, 'title' => $title, ], 'multipart' => [ [ 'name' => 'file', 'contents' => \GuzzleHttp\Psr7\stream_for($fileData), 'filename' => $name, ], ], 'headers' => null, ]; $result = $this->post('v1/media.json', $parameters); return $result; }
php
{ "resource": "" }
q247313
MediaController.updateMedia
validation
public function updateMedia($id, Media $media) { if ($media instanceof MediaResponse) { // Downcast to skip unnecessary params. $media = new Media(json_decode(json_encode($media), true)); } $parameters = [ 'query' => [], 'body' => json_encode(['media' => $media], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/media/' . $id . '', $parameters); $result = new MediaResponse($result); return $result; }
php
{ "resource": "" }
q247314
MediaController.group
validation
public function group($id, array $children) { $parameters = [ 'query' => [], 'body' => json_encode(['children' => $children], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/media/' . $id . '/group', $parameters); return $result; }
php
{ "resource": "" }
q247315
MediaController.restoreMedia
validation
public function restoreMedia($id) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/media/' . $id . '/restore', $parameters); $result = new MediaResponse($result); return $result; }
php
{ "resource": "" }
q247316
MediaController.setStatus
validation
public function setStatus($id, $status) { $parameters = [ 'query' => [], 'body' => json_encode(['status' => $status], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/media/' . $id . '/status', $parameters); return $result; }
php
{ "resource": "" }
q247317
MediaController.uploadPreview
validation
public function uploadPreview($fileData, $id) { $parameters = [ 'query' => [], 'multipart' => [ [ 'name' => 'file', 'contents' => \GuzzleHttp\Psr7\stream_for($fileData), 'filename' => 'preview-file', ], ], 'headers' => null, ]; $this->post('v1/media.json/' . $id . '/uploadpreview', $parameters); }
php
{ "resource": "" }
q247318
MediaController.uploadNewVersionChunked
validation
public function uploadNewVersionChunked($fileData, $id, $revisionComment, $name, $chunk, $chunks, $fileId) { $parameters = [ 'query' => [ 'revisionComment' => $revisionComment, 'name' => $name, 'chunk' => $chunk, 'chunks' => $chunks, 'fileId' => $fileId, ], 'multipart' => [ [ 'name' => 'file', 'contents' => \GuzzleHttp\Psr7\stream_for($fileData), 'filename' => $name, ], ], 'headers' => null, ]; $result = $this->post('v1/media.json/' . $id . '/version', $parameters); return $result; }
php
{ "resource": "" }
q247319
MediaController.createComment
validation
public function createComment($mediaId, Comment $comment) { $parameters = [ 'query' => [], 'body' => json_encode(['comment' => $comment], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/media/' . $mediaId . '/comments', $parameters); $result = new CommentResponse($result); return $result; }
php
{ "resource": "" }
q247320
MediaController.combineSlides
validation
public function combineSlides(array $structure) { $parameters = [ 'query' => [], 'body' => json_encode(['structure' => $structure], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/media/slides/combine', $parameters); return $result; }
php
{ "resource": "" }
q247321
MediaController.updateProperties
validation
public function updateProperties($id, array $properties) { $parameters = [ 'query' => [], 'body' => json_encode(['properties' => $properties], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->put('v1/media/' . $id . '/properties', $parameters); $result = new MediaResponse($result); return $result; }
php
{ "resource": "" }
q247322
MediaController.removeMedia
validation
public function removeMedia($id, $hardDelete = false) { $parameters = [ 'query' => ['hardDelete' => $hardDelete], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/media/' . $id . '', $parameters); $result = new MediaResponse($result); return $result; }
php
{ "resource": "" }
q247323
MediaController.removeComment
validation
public function removeComment($mediaId, $commentId) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/media/' . $mediaId . '/comments/' . $commentId . '', $parameters); $result = new Comment($result); return $result; }
php
{ "resource": "" }
q247324
MediaController.uploadFile
validation
public function uploadFile($pathname, $name, $categoryId, $progress = null, $chunkSize = 10485760) { $chunk = 0; $chunksTotal = ceil(filesize($pathname) / $chunkSize); $fileId = sha1(uniqid('upload', true)); $fp = fopen($pathname, 'rb'); if (false === $fp) { throw new UploadException('Could not open file "' . $pathname . '" for reading.'); } if ($chunkSize > 10485760) { $this->logger->warning('Using a chunk size larger then 10MB is not recommended. Uploading is not guaranteed to work properly.'); } while ($chunkData = fread($fp, $chunkSize)) { $result = $this->uploadFileChunked($chunkData, $name, $chunk, $chunksTotal, $fileId, $categoryId); if (is_callable($progress)) { try { call_user_func($progress, $chunk + 1, $chunksTotal); } catch (\Exception $e) { $this->logger->warning('Could not report progress due to callback error.', ['message' => $e->getMessage()]); } } $this->logger->info('Upload progress!', ['part' => $chunk + 1, 'total' => $chunksTotal]); if (isset($result['mediaId'])) { return new MediaResponse($result); } if (isset($result['success']) && false == $result['success']) { throw new UploadException($result['error']['message'], $result['error']['code']); } if (isset($result['fileId'])) { $fileId = $result['fileId']; } ++$chunk; } if ($chunk == $chunksTotal - 1) { throw new UploadException('Uploaded all chunks, but something went wrong.'); } if (false === $chunkData) { throw new UploadException('Could not read chunk ' . $chunk . ' from file "' . $pathname . '".'); } throw new UploadException('Unknown upload error!'); }
php
{ "resource": "" }
q247325
MediaController.uploadNewVersion
validation
public function uploadNewVersion($id, $pathname, $revisionComment, $filename = null, $progress = null, $chunkSize = 10485760) { $chunk = 0; $chunksTotal = ceil(filesize($pathname) / $chunkSize); $fileId = sha1(uniqid('uploadVersion', true)); $filename = $filename ?: pathinfo($filename, PATHINFO_BASENAME); $fp = fopen($pathname, 'r'); if (false === $fp) { throw new UploadException('Could not open file "' . $pathname . '" for reading.'); } if ($chunkSize > 10485760) { $this->logger->warning('Using a chunk size larger then 10MB is not recommended. Uploading is not guaranteed to work properly.'); } while ($chunkData = fread($fp, $chunkSize)) { $result = $this->uploadNewVersionChunked($chunkData, $id, $revisionComment, $filename, $chunk, $chunksTotal, $fileId); if (is_callable($progress)) { try { call_user_func($progress, $chunk + 1, $chunksTotal); } catch (\Exception $e) { $this->logger->warning('Could not report progress due to callback error.', ['message' => $e->getMessage()]); } } $this->logger->info('Upload progress!', ['part' => $chunk + 1, 'total' => $chunksTotal]); if (isset($result['mediaId'])) { return new MediaResponse($result); } if (isset($result['success']) && false == $result['success']) { throw new UploadException($result['error']['message'], $result['error']['code']); } $fileId = $result['fileId']; ++$chunk; } if ($chunk == $chunksTotal - 1) { throw new UploadException('Uploaded all chunks, but something went wrong.'); } if (false === $chunkData) { throw new UploadException('Could not read chunk ' . $chunk . ' from file "' . $pathname . '".'); } throw new UploadException('Unknown upload error!'); }
php
{ "resource": "" }
q247326
MoodboardsController.retrieveMoodboard
validation
public function retrieveMoodboard($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/moodboards/' . $id . '', $parameters, $cachePolicy); $result = new MoodboardResponse($result); return $result; }
php
{ "resource": "" }
q247327
MoodboardsController.listTemplates
validation
public function listTemplates(CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/moodboards/templates', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new MoodboardTemplateResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247328
MoodboardsController.retrieveTemplate
validation
public function retrieveTemplate($templateId, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/moodboards/templates/' . $templateId . '', $parameters, $cachePolicy); $result = new MoodboardTemplateResponse($result); return $result; }
php
{ "resource": "" }
q247329
MoodboardsController.createMoodboard
validation
public function createMoodboard(Moodboard $moodboard) { $parameters = [ 'query' => [], 'body' => json_encode(['moodboard' => $moodboard], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/moodboards', $parameters); $result = new MoodboardResponse($result); return $result; }
php
{ "resource": "" }
q247330
MoodboardsController.updateMoodboard
validation
public function updateMoodboard($id, Moodboard $moodboard) { $parameters = [ 'query' => [], 'body' => json_encode(['moodboard' => $moodboard], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/moodboards/' . $id . '', $parameters); $result = new MoodboardResponse($result); return $result; }
php
{ "resource": "" }
q247331
MoodboardsController.addMediaToMoodboard
validation
public function addMediaToMoodboard($moodboardId, array $mediaIds) { $parameters = [ 'query' => [], 'body' => json_encode(['mediaIds' => $mediaIds], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/moodboards/' . $moodboardId . '/media', $parameters); return $result; }
php
{ "resource": "" }
q247332
MoodboardsController.removeMoodboard
validation
public function removeMoodboard($id) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/moodboards/' . $id . '', $parameters); $result = new MoodboardResponse($result); return $result; }
php
{ "resource": "" }
q247333
MoodboardsController.removeMediaFromMoodboard
validation
public function removeMediaFromMoodboard($moodboardId, $mediaId) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/moodboards/' . $moodboardId . '/media/' . $mediaId . '', $parameters); return $result; }
php
{ "resource": "" }
q247334
StringHelper.section
validation
public function section($separator, $first = 0, $last = 0) { $sections = explode($separator, $this->string); $total = count($sections); $first = intval($first); $last = intval($last); if ($first > $total) { return null; } if ($first > $last) { $last = $first; } for ($i = 0; $i < $total; $i++) { if ($i < $first || $i > $last) { unset($sections[$i]); } } $string = implode($separator, $sections); return new self($string); }
php
{ "resource": "" }
q247335
StringHelper.isUtf8
validation
public function isUtf8() { $pattern = array(); $pattern[] = "[\xC2-\xDF][\x80-\xBF]"; // non-overlong 2-byte $pattern[] = "\xE0[\xA0-\xBF][\x80-\xBF]"; // excluding overlongs $pattern[] = "[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}"; // straight 3-byte $pattern[] = "\xED[\x80-\x9F][\x80-\xBF]"; // excluding surrogates $pattern[] = "\xF0[\x90-\xBF][\x80-\xBF]{2}"; // planes 1-3 $pattern[] = "[\xF1-\xF3][\x80-\xBF]{3}"; // planes 4-15 $pattern[] = "\xF4[\x80-\x8F][\x80-\xBF]{2}"; // plane 16 return preg_match("%(?:" . implode("|", $pattern) . ")+%xs", $this->string); }
php
{ "resource": "" }
q247336
Client.permAssign
validation
public function permAssign($permid, $permvalue, $permskip = false) { return $this->getParent()->clientPermAssign($this["client_database_id"], $permid, $permvalue, $permskip); }
php
{ "resource": "" }
q247337
Client.memberOf
validation
public function memberOf() { $groups = array($this->getParent()->channelGroupGetById($this["client_channel_group_id"])); foreach (explode(",", $this["client_servergroups"]) as $sgid) { $groups[] = $this->getParent()->serverGroupGetById($sgid); } return $groups; }
php
{ "resource": "" }
q247338
ControllerAbstract.get
validation
protected function get($endpoint, array $parameters = [], CachePolicy $cachePolicy = null, $fireAndForget = false) { return $this->call($endpoint, $parameters, self::METHOD_GET, $cachePolicy, $fireAndForget); }
php
{ "resource": "" }
q247339
ControllerAbstract.post
validation
protected function post($endpoint, array $parameters = [], $fireAndForget = false) { return $this->call($endpoint, $parameters, self::METHOD_POST, null, $fireAndForget); }
php
{ "resource": "" }
q247340
ControllerAbstract.put
validation
protected function put($endpoint, array $parameters = [], $fireAndForget = false) { return $this->call($endpoint, $parameters, self::METHOD_PUT, null, $fireAndForget); }
php
{ "resource": "" }
q247341
ControllerAbstract.delete
validation
protected function delete($endpoint, array $parameters = [], $fireAndForget = false) { return $this->call($endpoint, $parameters, self::METHOD_DELETE, null, $fireAndForget); }
php
{ "resource": "" }
q247342
PropertysetsController.listPropertySets
validation
public function listPropertySets(CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/propertysets', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new PropertySet($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247343
PropertysetsController.listPropertyTypes
validation
public function listPropertyTypes($systemName = null, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/propertysets/propertytypes', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new PropertyType($entry); } unset($entry); reset($result); if (null !== $systemName) { foreach ($result as $entry) { if ($entry->getSystemName() === $systemName) { return $entry; } } return null; } return $result; }
php
{ "resource": "" }
q247344
ServerQuery.request
validation
public function request($cmd, $throw = true) { $query = StringHelper::factory($cmd)->section(TeamSpeak3::SEPARATOR_CELL); if (strstr($cmd, "\r") || strstr($cmd, "\n")) { throw new Ts3Exception("illegal characters in command '" . $query . "'"); } elseif (in_array($query, $this->block)) { throw new Ts3Exception("command not found", 0x100); } Signal::getInstance()->emit("serverqueryCommandStarted", $cmd); $this->getProfiler()->start(); $this->getTransport()->sendLine($cmd); $this->timer = time(); $this->count++; $rpl = array(); do { $str = $this->getTransport()->readLine(); $rpl[] = $str; } while ($str instanceof StringHelper && $str->section( TeamSpeak3::SEPARATOR_CELL ) != TeamSpeak3::ERROR); $this->getProfiler()->stop(); $reply = new Reply($rpl, $cmd, $this->getHost(), $throw); Signal::getInstance()->emit("serverqueryCommandFinished", $cmd, $reply); return $reply; }
php
{ "resource": "" }
q247345
ServerQuery.wait
validation
public function wait() { if ($this->getTransport()->getConfig("blocking")) { throw new Ts3Exception("only available in non-blocking mode"); } do { $evt = $this->getTransport()->readLine(); var_dump($evt); } while ($evt instanceof StringHelper && !$evt->section(TeamSpeak3::SEPARATOR_CELL)->startsWith(TeamSpeak3::EVENT)); return new Event($evt, $this->getHost()); }
php
{ "resource": "" }
q247346
ServerQuery.getHost
validation
public function getHost() { if ($this->host === null) { $this->host = new Host($this); } return $this->host; }
php
{ "resource": "" }
q247347
Column.getGridClass
validation
private function getGridClass() { $class = []; foreach($this->grid as $grid){ if(!isset($grid['type']) || !isset($grid['size'])){ throw new InvalidConfigException(get_called_class() . ' must have type and size.'); } if(!isset($grid['positiontype'])) $class[] = $grid['type'].$grid['size']; else $class[] = $grid['type'].$grid['positiontype'].'-'.$grid['size']; } return implode(' ',$class); }
php
{ "resource": "" }
q247348
Channel.clientPermList
validation
public function clientPermList($cldbid, $permsid = false) { return $this->getParent()->channelClientPermList($this->getId(), $cldbid, $permsid); }
php
{ "resource": "" }
q247349
Channel.clientPermRemove
validation
public function clientPermRemove($cldbid, $permid) { return $this->getParent()->channelClientPermRemove($this->getId(), $cldbid, $permid); }
php
{ "resource": "" }
q247350
Channel.permAssign
validation
public function permAssign($permid, $permvalue) { return $this->getParent()->channelPermAssign($this->getId(), $permid, $permvalue); }
php
{ "resource": "" }
q247351
Channel.fileList
validation
public function fileList($cpw = "", $path = "/", $recursive = false) { return $this->getParent()->channelFileList($this->getId(), $cpw, $path, $recursive); }
php
{ "resource": "" }
q247352
Channel.fileDelete
validation
public function fileDelete($cpw = "", $name = "/") { return $this->getParent()->channelFileDelete($this->getId(), $cpw, $name); }
php
{ "resource": "" }
q247353
Channel.dirCreate
validation
public function dirCreate($cpw = "", $dirname = "/") { return $this->getParent()->channelDirCreate($this->getId(), $cpw, $dirname); }
php
{ "resource": "" }
q247354
Channel.sendPluginCmd
validation
public function sendPluginCmd($plugin, $data, $cpw = null, $subscribed = false) { if ($this->getId() != $this->getParent()->whoamiGet("client_channel_id")) { $this->getParent()->clientMove($this->getParent()->whoamiGet("client_id"), $this->getId(), $cpw); } $this->execute( "plugincmd", array( "name" => $plugin, "data" => $data, "targetmode" => $subscribed ? TeamSpeak3::PLUGINCMD_CHANNEL_SUBSCRIBED : TeamSpeak3::PLUGINCMD_CHANNEL ) ); }
php
{ "resource": "" }
q247355
Host.version
validation
public function version($ident = null) { if ($this->version === null) { $this->version = $this->request("version")->toList(); } return ($ident && array_key_exists($ident, $this->version)) ? $this->version[$ident] : $this->version; }
php
{ "resource": "" }
q247356
Host.serverGetPortById
validation
public function serverGetPortById($sid) { if (!array_key_exists((string)$sid, $this->serverList())) { throw new Ts3Exception("invalid serverID", 0x400); } return $this->serverList[intval((string)$sid)]["virtualserver_port"]; }
php
{ "resource": "" }
q247357
Host.serverGetByName
validation
public function serverGetByName($name) { foreach ($this->serverList() as $server) { if ($server["virtualserver_name"] == $name) { return $server; } } throw new Ts3Exception("invalid serverID", 0x400); }
php
{ "resource": "" }
q247358
Host.serverGetByUid
validation
public function serverGetByUid($uid) { foreach ($this->serverList() as $server) { if ($server["virtualserver_unique_identifier"] == $uid) { return $server; } } throw new Ts3Exception("invalid serverID", 0x400); }
php
{ "resource": "" }
q247359
Host.serverCreate
validation
public function serverCreate(array $properties = array()) { $this->serverListReset(); $detail = $this->execute("servercreate", $properties)->toList(); $server = new Server($this, array("virtualserver_id" => intval($detail["sid"]))); Signal::getInstance()->emit("notifyServercreated", $this, $detail["sid"]); Signal::getInstance()->emit("notifyTokencreated", $server, $detail["token"]); return $detail; }
php
{ "resource": "" }
q247360
Host.serverDelete
validation
public function serverDelete($sid) { $this->serverListReset(); $this->execute("serverdelete", array("sid" => $sid)); Signal::getInstance()->emit("notifyServerdeleted", $this, $sid); }
php
{ "resource": "" }
q247361
Host.serverStart
validation
public function serverStart($sid) { if ($sid == $this->serverSelectedId()) { $this->serverDeselect(); } $this->execute("serverstart", array("sid" => $sid)); $this->serverListReset(); Signal::getInstance()->emit("notifyServerstarted", $this, $sid); }
php
{ "resource": "" }
q247362
Host.permissionGetIdByName
validation
public function permissionGetIdByName($name) { if (!array_key_exists((string)$name, $this->permissionList())) { throw new Ts3Exception("invalid permission ID", 0xA02); } return $this->permissionList[(string)$name]["permid"]; }
php
{ "resource": "" }
q247363
Host.permissionGetNameById
validation
public function permissionGetNameById($permid) { foreach ($this->permissionList() as $name => $perm) { if ($perm["permid"] == $permid) { return new Ts3Exception($name); } } throw new Ts3Exception("invalid permission ID", 0xA02); }
php
{ "resource": "" }
q247364
Host.login
validation
public function login($username, $password) { $this->execute("login", array("client_login_name" => $username, "client_login_password" => $password)); $this->whoamiReset(); $crypt = new Crypt($username); $this->setStorage("_login_user", $username); $this->setStorage("_login_pass", $crypt->encrypt($password)); Signal::getInstance()->emit("notifyLogin", $this); }
php
{ "resource": "" }
q247365
Host.logout
validation
public function logout() { $this->request("logout"); $this->whoamiReset(); $this->delStorage("_login_user"); $this->delStorage("_login_pass"); Signal::getInstance()->emit("notifyLogout", $this); }
php
{ "resource": "" }
q247366
Group.setRoles
validation
public function setRoles(array $roles) { $this->roles = []; foreach ($roles as $item) { $this->addRole($item); } return $this; }
php
{ "resource": "" }
q247367
Group.addRole
validation
public function addRole($item) { if (!($item instanceof Role)) { if (is_array($item)) { try { $item = new Role($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate Role. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "Role"!', E_USER_WARNING); } } $this->roles[] = $item; return $this; }
php
{ "resource": "" }
q247368
Moodboard.setExpireDate
validation
public function setExpireDate($expireDate) { if ($expireDate instanceof DateTime) { $this->expireDate = $expireDate; } else { try { $this->expireDate = new DateTime($expireDate); } catch (\Exception $e) { $this->expireDate = null; } } return $this; }
php
{ "resource": "" }
q247369
Html.getCorpusClass
validation
protected function getCorpusClass() { $extras = ""; if ($this->currObj instanceof Channel && $this->currObj->isSpacer()) { switch ($this->currObj->spacerGetType()) { case (string)TeamSpeak3::SPACER_SOLIDLINE: $extras .= " solidline"; break; case (string)TeamSpeak3::SPACER_DASHLINE: $extras .= " dashline"; break; case (string)TeamSpeak3::SPACER_DASHDOTLINE: $extras .= " dashdotline"; break; case (string)TeamSpeak3::SPACER_DASHDOTDOTLINE: $extras .= " dashdotdotline"; break; case (string)TeamSpeak3::SPACER_DOTLINE: $extras .= " dotline"; break; } switch ($this->currObj->spacerGetAlign()) { case TeamSpeak3::SPACER_ALIGN_CENTER: $extras .= " center"; break; case TeamSpeak3::SPACER_ALIGN_RIGHT: $extras .= " right"; break; case TeamSpeak3::SPACER_ALIGN_LEFT: $extras .= " left"; break; } } return "corpus " . $this->currObj->getClass(null) . $extras; }
php
{ "resource": "" }
q247370
Html.getCorpusTitle
validation
protected function getCorpusTitle() { if ($this->currObj instanceof Server) { return "ID: " . $this->currObj->getId() . " | Clients: " . $this->currObj->clientCount( ) . "/" . $this->currObj["virtualserver_maxclients"] . " | Uptime: " . Convert::seconds( $this->currObj["virtualserver_uptime"] ); } elseif ($this->currObj instanceof Channel && !$this->currObj->isSpacer()) { return "ID: " . $this->currObj->getId() . " | Codec: " . Convert::codec( $this->currObj["channel_codec"] ) . " | Quality: " . $this->currObj["channel_codec_quality"]; } elseif ($this->currObj instanceof Client) { return "ID: " . $this->currObj->getId() . " | Version: " . Convert::versionShort( $this->currObj["client_version"] ) . " | Platform: " . $this->currObj["client_platform"]; } elseif ($this->currObj instanceof Servergroup || $this->currObj instanceof Channelgroup) { return "ID: " . $this->currObj->getId() . " | Type: " . Convert::groupType( $this->currObj["type"] ) . " (" . ($this->currObj["savedb"] ? "Permanent" : "Temporary") . ")"; } return ""; }
php
{ "resource": "" }
q247371
Html.getCorpusName
validation
protected function getCorpusName() { if ($this->currObj instanceof Channel && $this->currObj->isSpacer()) { if ($this->currObj->spacerGetType() != TeamSpeak3::SPACER_CUSTOM) { return ""; } $string = $this->currObj["channel_name"]->section("]", 1, 99); if ($this->currObj->spacerGetAlign() == TeamSpeak3::SPACER_ALIGN_REPEAT) { $string->resize(30, $string); } return htmlspecialchars($string); } if ($this->currObj instanceof Client) { $before = array(); $behind = array(); /** * @var Channelgroup|Servergroup $group */ foreach ($this->currObj->memberOf() as $group) { if ($group->getProperty("namemode") == TeamSpeak3::GROUP_NAMEMODE_BEFORE) { $before[] = "[" . htmlspecialchars($group["name"]) . "]"; } elseif ($group->getProperty("namemode") == TeamSpeak3::GROUP_NAMEMODE_BEHIND) { $behind[] = "[" . htmlspecialchars($group["name"]) . "]"; } } return implode("", $before) . " " . htmlspecialchars($this->currObj) . " " . implode("", $behind); } return htmlspecialchars($this->currObj); }
php
{ "resource": "" }
q247372
Html.getSuffixIconServer
validation
protected function getSuffixIconServer() { $html = ""; if ($this->currObj["virtualserver_icon_id"]) { if (!$this->currObj->iconIsLocal("virtualserver_icon_id") && $this->ftclient) { if (!isset($this->cacheIcon[$this->currObj["virtualserver_icon_id"]])) { $download = $this->currObj->transferInitDownload( rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName("virtualserver_icon_id") ); if ($this->ftclient == "data:image") { $download = TeamSpeak3::factory( "filetransfer://" . $download["host"] . ":" . $download["port"] )->download($download["ftkey"], $download["size"]); } $this->cacheIcon[$this->currObj["virtualserver_icon_id"]] = $download; } else { $download = $this->cacheIcon[$this->currObj["virtualserver_icon_id"]]; } if ($this->ftclient == "data:image") { $html .= $this->getImage( "data:" . Convert::imageMimeType($download) . ";base64," . base64_encode( $download ), "Server Icon", null, false ); } else { $html .= $this->getImage( $this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Server Icon", null, false ); } } elseif (in_array($this->currObj["virtualserver_icon_id"], $this->cachedIcons)) { $html .= $this->getImage( "group_icon_" . $this->currObj["virtualserver_icon_id"] . ".png", "Server Icon" ); } } return $html; }
php
{ "resource": "" }
q247373
Html.getSuffixFlag
validation
protected function getSuffixFlag() { if (!$this->currObj instanceof Client) { return ""; } if ($this->flagpath && $this->currObj["client_country"]) { return $this->getImage( $this->currObj["client_country"]->toLower() . ".png", $this->currObj["client_country"], null, false, true ); } return ""; }
php
{ "resource": "" }
q247374
Html.getImage
validation
protected function getImage($name, $text = "", $class = null, $iconpath = true, $flagpath = false) { $src = ""; if ($iconpath) { $src = $this->iconpath; } if ($flagpath) { $src = $this->flagpath; } return "<img src='" . $src . $name . "' title='" . $text . "' alt='' align='top' />"; }
php
{ "resource": "" }
q247375
DeploymentFile.setMetadata
validation
public function setMetadata($metadata) { if (is_array($metadata)) { $this->metadata = $metadata; return $this; } $this->metadata = json_decode($metadata, true); if (null === $this->metadata) { $this->metadata = $metadata; } return $this; }
php
{ "resource": "" }
q247376
SearchController.search
validation
public function search(Search $search, $returnType = self::RETURN_OBJECTS, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['returnType' => $returnType], 'body' => json_encode(['search' => $search], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->call('v1/search', $parameters, self::METHOD_POST, $cachePolicy); $result = new SearchResult($result); return $result; }
php
{ "resource": "" }
q247377
SearchController.folderSearch
validation
public function folderSearch(FolderSearch $search) { $parameters = [ 'query' => [], 'body' => json_encode(['search' => $search], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/search/folder', $parameters); $result = new SearchResult($result); return $result; }
php
{ "resource": "" }
q247378
SearchController.searchtotal
validation
public function searchtotal(Search $search) { $parameters = [ 'query' => [], 'body' => json_encode(['search' => $search], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/search/total', $parameters); return $result; }
php
{ "resource": "" }
q247379
Uri.parseUri
validation
protected function parseUri($uriString = '') { $status = @preg_match("~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~", $uriString, $matches); if ($status === false) { throw new Ts3Exception("URI scheme-specific decomposition failed"); } if (!$status) { return; } $this->path = (isset($matches[4])) ? $matches[4] : ''; $this->query = (isset($matches[6])) ? $matches[6] : ''; $this->fragment = (isset($matches[8])) ? $matches[8] : ''; $status = @preg_match( "~^(([^:@]*)(:([^@]*))?@)?([^:]+)(:(.*))?$~", (isset($matches[3])) ? $matches[3] : "", $matches ); if ($status === false) { throw new Ts3Exception("URI scheme-specific authority decomposition failed"); } if (!$status) { return; } $this->user = isset($matches[2]) ? $matches[2] : ""; $this->pass = isset($matches[4]) ? $matches[4] : ""; $this->host = isset($matches[5]) ? $matches[5] : ""; $this->port = isset($matches[7]) ? $matches[7] : ""; }
php
{ "resource": "" }
q247380
Uri.check
validation
public static function check($uri) { try { $uri = new self(strval($uri)); } catch (Ts3Exception $e) { return false; } return $uri->valid(); }
php
{ "resource": "" }
q247381
Uri.checkUser
validation
public function checkUser($username = null) { if ($username === null) { $username = $this->user; } if (strlen($username) == 0) { return true; } $pattern = "/^(" . $this->regex["alphanum"] . "|" . $this->regex["mark"] . "|" . $this->regex["escaped"] . "|[;:&=+$,])+$/"; $status = @preg_match($pattern, $username); if ($status === false) { throw new Ts3Exception("URI username validation failed"); } return ($status == 1); }
php
{ "resource": "" }
q247382
Uri.checkPass
validation
public function checkPass($password = null) { if ($password === null) { $password = $this->pass; } if (strlen($password) == 0) { return true; } $pattern = "/^(" . $this->regex["alphanum"] . "|" . $this->regex["mark"] . "|" . $this->regex["escaped"] . "|[;:&=+$,])+$/"; $status = @preg_match($pattern, $password); if ($status === false) { throw new Ts3Exception("URI password validation failed"); } return ($status == 1); }
php
{ "resource": "" }
q247383
Uri.checkPath
validation
public function checkPath($path = null) { if ($path === null) { $path = $this->path; } if (strlen($path) == 0) { return true; } $pattern = "/^" . $this->regex["path"] . "$/"; $status = @preg_match($pattern, $path); if ($status === false) { throw new Ts3Exception("URI path validation failed"); } return ($status == 1); }
php
{ "resource": "" }
q247384
Uri.checkQuery
validation
public function checkQuery($query = null) { if ($query === null) { $query = $this->query; } if (strlen($query) == 0) { return true; } $pattern = "/^" . $this->regex["uric"] . "*$/"; $status = @preg_match($pattern, $query); if ($status === false) { throw new Ts3Exception("URI query string validation failed"); } return ($status == 1); }
php
{ "resource": "" }
q247385
Uri.hasQueryVar
validation
public function hasQueryVar($key) { if (!$this->hasQuery()) { return false; } parse_str($this->query, $queryArray); return array_key_exists($key, $queryArray) ? true : false; }
php
{ "resource": "" }
q247386
Uri.checkFragment
validation
public function checkFragment($fragment = null) { if ($fragment === null) { $fragment = $this->fragment; } if (strlen($fragment) == 0) { return true; } $pattern = "/^" . $this->regex["uric"] . "*$/"; $status = @preg_match($pattern, $fragment); if ($status === false) { throw new Ts3Exception("URI fragment validation failed"); } return ($status == 1); }
php
{ "resource": "" }
q247387
Response.setStatusCode
validation
public function setStatusCode(int $value = null) { if (is_null($value)) { return $this; } $this->statusCode = $value; return $this; }
php
{ "resource": "" }
q247388
Response.sendHeaders
validation
public function sendHeaders() { if (php_sapi_name() !== "cli" && headers_sent($file, $line)) { throw new Exception("Try to send headers but headers already sent, output started at $file line $line."); } http_response_code($this->statusCode); foreach ($this->headers as $header) { if (php_sapi_name() !== "cli") { header($header); } } return $this; }
php
{ "resource": "" }
q247389
Response.setBody
validation
public function setBody($body) { if (is_string($body)) { $this->body = $body; } elseif (is_array($body)) { $this->setJsonBody($body); } elseif (is_callable($body)) { ob_start(); $res1 = call_user_func($body); $res2 = ob_get_contents(); $this->body = $res2 . $res1; ob_end_clean(); } return $this; }
php
{ "resource": "" }
q247390
Response.sendJson
validation
public function sendJson($data, $statusCode = null) { return $this->setStatusCode($statusCode) ->setJsonBody($data) ->send(); }
php
{ "resource": "" }
q247391
Response.setJsonBody
validation
public function setJsonBody($data) { $this->addHeader("Content-Type: application/json; charset=utf8"); $this->setBody(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); return $this; }
php
{ "resource": "" }
q247392
Response.redirect
validation
public function redirect(string $url) : object { $this->addHeader("Location: " . $url); $this->body = null; return $this; }
php
{ "resource": "" }
q247393
ActiveForm.run
validation
public function run() { if (!empty($this->_fields)) { throw new InvalidCallException('Each beginField() should have a matching endField() call.'); } $id = $this->options['id']; $options = Json::encode($this->getClientOptions()); $attributes = Json::encode($this->attributes); $view = $this->getView(); AdminUiActiveForm::register($view); $view->registerJs("jQuery('#$id').yiiActiveForm($attributes, $options);"); echo Html::endForm(); }
php
{ "resource": "" }
q247394
PropertyResponse.setPropertyType
validation
public function setPropertyType($propertyType) { if ($propertyType instanceof PropertyType) { $this->propertyType = $propertyType; } elseif (is_array($propertyType)) { $this->propertyType = new PropertyType($propertyType); } else { $this->propertyType = null; trigger_error('Argument must be an object of class PropertyType. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247395
PropertyResponse.setValue
validation
public function setValue($value) { $definition = $this->propertyType->getDefinition(); if (isset($definition['hierarchical']) && $definition['hierarchical']) { $this->value = []; foreach ($value as $v) { foreach ($v['value'] as $itemValue) { $this->value[] = $this->convertValue($itemValue['value']); } } } elseif (!empty($definition['array'])) { if (empty($definition['multiplechoice']) && isset($definition['options']) && is_array($definition['options'])) { $this->value = $this->convertValue(current($value)['value']); } else { $this->value = []; foreach ($value as $v) { $this->value[] = $this->convertValue($v['value']); } } } else { $this->value = $this->convertValue($value); } return $this; }
php
{ "resource": "" }
q247396
PropertyResponse.convertValue
validation
protected function convertValue($value) { switch ($this->propertyType->getDataTypeId()) { case PropertyType::DATATYPE_BOOLEAN: return (bool) $value; break; case PropertyType::DATATYPE_DATETIME: if ($value instanceof \DateTime) { return $value; } try { return new \DateTime($value); } catch (\Exception $e) { return null; } break; case PropertyType::DATATYPE_FLOAT: return (float) $value; break; case PropertyType::DATATYPE_INTEGER: return (int) $value; break; case PropertyType::DATATYPE_STRING: return (string) $value; break; default: return $value; break; } }
php
{ "resource": "" }
q247397
ResponseUtility.redirect
validation
public function redirect(string $url) : object { return parent::redirect($this->di->get("url")->create($url)); }
php
{ "resource": "" }
q247398
ResponseUtility.redirectSelf
validation
public function redirectSelf() : object { $url = $this->di->get("request")->getCurrentUrl(); return parent::redirect($this->di->get("url")->create($url)); }
php
{ "resource": "" }
q247399
Breadcrumbs.renderItem
validation
protected function renderItem($link, $template) { if (isset($link['label'])) { $label = $this->encodeLabels ? Html::encode($link['label']) : $link['label']; } else { throw new InvalidConfigException('The "label" element is required for each link.'); } if($link['options']['class']){ $label = Html::tag('i', '',$link['options']).$label; } if (isset($link['url'])) { return strtr($template, ['{link}' => Html::a($label, $link['url'])]); } else { return strtr($template, ['{link}' => $label]); } }
php
{ "resource": "" }