id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
42,200 | baidubce/bce-sdk-php | src/BaiduBce/Services/Bos/BosClient.php | BosClient.uploadPartFromFile | public function uploadPartFromFile(
$bucketName,
$key,
$uploadId,
$partNumber,
$filename,
$offset = 0,
$length = -1,
$options = array()
) {
if (!is_int($offset) && !is_long($offset)) {
throw new \InvalidArgumentException(
'$offset should be int or long.'
);
}
if (!is_int($length) && !is_long($length)) {
throw new \InvalidArgumentException(
'$length should be int or long.'
);
}
$fp = fopen($filename, 'rb');
try {
if ($length < 0) {
fseek($fp, 0, SEEK_END);
$length = ftell($fp) - $offset;
}
$contentMd5 = base64_encode(HashUtils::md5FromStream($fp, $offset, $length));
fseek($fp, $offset, SEEK_SET);
$response = $this->uploadPart(
$bucketName,
$key,
$uploadId,
$partNumber,
$length,
$contentMd5,
$fp,
$options
);
//guzzle will close fp
if (is_resource($fp)) {
fclose($fp);
}
return $response;
} catch (\Exception $e) {
if(is_resource($fp)) {
fclose($fp);
}
throw $e;
}
} | php | public function uploadPartFromFile(
$bucketName,
$key,
$uploadId,
$partNumber,
$filename,
$offset = 0,
$length = -1,
$options = array()
) {
if (!is_int($offset) && !is_long($offset)) {
throw new \InvalidArgumentException(
'$offset should be int or long.'
);
}
if (!is_int($length) && !is_long($length)) {
throw new \InvalidArgumentException(
'$length should be int or long.'
);
}
$fp = fopen($filename, 'rb');
try {
if ($length < 0) {
fseek($fp, 0, SEEK_END);
$length = ftell($fp) - $offset;
}
$contentMd5 = base64_encode(HashUtils::md5FromStream($fp, $offset, $length));
fseek($fp, $offset, SEEK_SET);
$response = $this->uploadPart(
$bucketName,
$key,
$uploadId,
$partNumber,
$length,
$contentMd5,
$fp,
$options
);
//guzzle will close fp
if (is_resource($fp)) {
fclose($fp);
}
return $response;
} catch (\Exception $e) {
if(is_resource($fp)) {
fclose($fp);
}
throw $e;
}
} | [
"public",
"function",
"uploadPartFromFile",
"(",
"$",
"bucketName",
",",
"$",
"key",
",",
"$",
"uploadId",
",",
"$",
"partNumber",
",",
"$",
"filename",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"length",
"=",
"-",
"1",
",",
"$",
"options",
"=",
"array... | Upload a part from starting with offset.
@param string $bucketName The bucket name.
@param string $key The object path.
@param string $uploadId The uploadId returned by initiateMultipartUpload.
@param number $partNumber The part index, 1-based.
@param number $length The uploaded part size.
@param string $filename The file name.
@param number $offset The file offset.
@param number $contentMd5 The part md5 check sum.
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating BosClient instance.
@return mixed | [
"Upload",
"a",
"part",
"from",
"starting",
"with",
"offset",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Bos/BosClient.php#L978-L1028 |
42,201 | baidubce/bce-sdk-php | src/BaiduBce/Services/Bos/BosClient.php | BosClient.listParts | public function listParts($bucketName, $key, $uploadId, $options = array())
{
if (empty($bucketName)) {
throw new \InvalidArgumentException(
'$bucketName should not be empty or null.'
);
}
if (empty($key)) {
throw new \InvalidArgumentException(
'$key should not be empty or null.'
);
}
if (empty($uploadId)) {
throw new \InvalidArgumentException(
'$uploadId should not be empty or null.'
);
}
list($config, $maxParts, $partNumberMarker) = $this->parseOptions(
$options,
BosOptions::CONFIG,
BosOptions::LIMIT,
BosOptions::MARKER
);
$params = array();
$params['uploadId'] = $uploadId;
if ($maxParts !== null) {
if (is_numeric($maxParts)) {
$maxParts = number_format($maxParts);
$maxParts = str_replace(',','',$maxParts);
}
$params['maxParts'] = $maxParts;
}
if ($partNumberMarker !== null) {
$params['partNumberMarker'] = $partNumberMarker;
}
return $this->sendRequest(
HttpMethod::GET,
array(
BosOptions::CONFIG => $config,
'bucket_name' => $bucketName,
'key' => $key,
'params' => $params,
)
);
} | php | public function listParts($bucketName, $key, $uploadId, $options = array())
{
if (empty($bucketName)) {
throw new \InvalidArgumentException(
'$bucketName should not be empty or null.'
);
}
if (empty($key)) {
throw new \InvalidArgumentException(
'$key should not be empty or null.'
);
}
if (empty($uploadId)) {
throw new \InvalidArgumentException(
'$uploadId should not be empty or null.'
);
}
list($config, $maxParts, $partNumberMarker) = $this->parseOptions(
$options,
BosOptions::CONFIG,
BosOptions::LIMIT,
BosOptions::MARKER
);
$params = array();
$params['uploadId'] = $uploadId;
if ($maxParts !== null) {
if (is_numeric($maxParts)) {
$maxParts = number_format($maxParts);
$maxParts = str_replace(',','',$maxParts);
}
$params['maxParts'] = $maxParts;
}
if ($partNumberMarker !== null) {
$params['partNumberMarker'] = $partNumberMarker;
}
return $this->sendRequest(
HttpMethod::GET,
array(
BosOptions::CONFIG => $config,
'bucket_name' => $bucketName,
'key' => $key,
'params' => $params,
)
);
} | [
"public",
"function",
"listParts",
"(",
"$",
"bucketName",
",",
"$",
"key",
",",
"$",
"uploadId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"bucketName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgument... | List parts that have been upload success.
@param string $bucketName The bucket name.
@param string $key The object path.
@param string $uploadId The uploadId returned by initiateMultipartUpload.
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating BosClient instance.
@return mixed | [
"List",
"parts",
"that",
"have",
"been",
"upload",
"success",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Bos/BosClient.php#L1041-L1087 |
42,202 | baidubce/bce-sdk-php | src/BaiduBce/Services/Bos/BosClient.php | BosClient.completeMultipartUpload | public function completeMultipartUpload(
$bucketName,
$key,
$uploadId,
array $partList,
$options = array()
) {
if (empty($bucketName)) {
throw new \InvalidArgumentException(
'$bucketName should not be empty or null.'
);
}
if (empty($key)) {
throw new \InvalidArgumentException(
'$key should not be empty or null.'
);
}
if (empty($uploadId)) {
throw new \InvalidArgumentException(
'$uploadId should not be empty or null.'
);
}
$headers = array();
$this->populateRequestHeadersWithOptions($headers, $options);
list($config) = $this->parseOptions($options, BosOptions::CONFIG);
return $this->sendRequest(
HttpMethod::POST,
array(
BosOptions::CONFIG => $config,
'bucket_name' => $bucketName,
'key' => $key,
'body' => json_encode(array('parts' => $partList)),
'headers' => $headers,
'params' => array('uploadId' => $uploadId),
)
);
} | php | public function completeMultipartUpload(
$bucketName,
$key,
$uploadId,
array $partList,
$options = array()
) {
if (empty($bucketName)) {
throw new \InvalidArgumentException(
'$bucketName should not be empty or null.'
);
}
if (empty($key)) {
throw new \InvalidArgumentException(
'$key should not be empty or null.'
);
}
if (empty($uploadId)) {
throw new \InvalidArgumentException(
'$uploadId should not be empty or null.'
);
}
$headers = array();
$this->populateRequestHeadersWithOptions($headers, $options);
list($config) = $this->parseOptions($options, BosOptions::CONFIG);
return $this->sendRequest(
HttpMethod::POST,
array(
BosOptions::CONFIG => $config,
'bucket_name' => $bucketName,
'key' => $key,
'body' => json_encode(array('parts' => $partList)),
'headers' => $headers,
'params' => array('uploadId' => $uploadId),
)
);
} | [
"public",
"function",
"completeMultipartUpload",
"(",
"$",
"bucketName",
",",
"$",
"key",
",",
"$",
"uploadId",
",",
"array",
"$",
"partList",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"bucketName",
")",
")",
... | After finish all the task, complete multi_upload_file.
bucket, key, upload_id, part_list, options=None
@param string $bucketName The bucket name.
@param string $key The object path.
@param string $uploadId The upload id.
@param array $partList (partnumber and etag) list
@param array $options
@return mixed | [
"After",
"finish",
"all",
"the",
"task",
"complete",
"multi_upload_file",
".",
"bucket",
"key",
"upload_id",
"part_list",
"options",
"=",
"None"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Bos/BosClient.php#L1101-L1139 |
42,203 | baidubce/bce-sdk-php | src/BaiduBce/Services/Bos/BosClient.php | BosClient.listMultipartUploads | public function listMultipartUploads($bucketName, $options = array())
{
list(
$config,
$keyMarker,
$maxUploads,
$delimiter,
$prefix
) = $this->parseOptions(
$options,
BosOptions::CONFIG,
BosOptions::MARKER,
BosOptions::LIMIT,
BosOptions::DELIMITER,
BosOptions::PREFIX
);
$params = array();
$params['uploads'] = '';
if ($keyMarker !== null) {
$params['keyMarker'] = $keyMarker;
}
if ($maxUploads !== null) {
if (is_numeric($maxUploads)) {
$maxUploads = number_format($maxUploads);
$maxUploads = str_replace(',','',$maxUploads);
}
$params['maxUploads'] = $maxUploads;
}
if ($delimiter !== null) {
$params['delimiter'] = $delimiter;
}
if ($prefix !== null) {
$params['prefix'] = $prefix;
}
return $this->sendRequest(
HttpMethod::GET,
array(
BosOptions::CONFIG => $config,
'bucket_name' => $bucketName,
'params' => $params,
)
);
} | php | public function listMultipartUploads($bucketName, $options = array())
{
list(
$config,
$keyMarker,
$maxUploads,
$delimiter,
$prefix
) = $this->parseOptions(
$options,
BosOptions::CONFIG,
BosOptions::MARKER,
BosOptions::LIMIT,
BosOptions::DELIMITER,
BosOptions::PREFIX
);
$params = array();
$params['uploads'] = '';
if ($keyMarker !== null) {
$params['keyMarker'] = $keyMarker;
}
if ($maxUploads !== null) {
if (is_numeric($maxUploads)) {
$maxUploads = number_format($maxUploads);
$maxUploads = str_replace(',','',$maxUploads);
}
$params['maxUploads'] = $maxUploads;
}
if ($delimiter !== null) {
$params['delimiter'] = $delimiter;
}
if ($prefix !== null) {
$params['prefix'] = $prefix;
}
return $this->sendRequest(
HttpMethod::GET,
array(
BosOptions::CONFIG => $config,
'bucket_name' => $bucketName,
'params' => $params,
)
);
} | [
"public",
"function",
"listMultipartUploads",
"(",
"$",
"bucketName",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"keyMarker",
",",
"$",
"maxUploads",
",",
"$",
"delimiter",
",",
"$",
"prefix",
")",
"=",... | List Multipart upload task which haven't been ended.
call initiateMultipartUpload but not call completeMultipartUpload or abortMultipartUpload
@param string $bucketName The bucket name.
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating BosClient instance.
@return mixed | [
"List",
"Multipart",
"upload",
"task",
"which",
"haven",
"t",
"been",
"ended",
".",
"call",
"initiateMultipartUpload",
"but",
"not",
"call",
"completeMultipartUpload",
"or",
"abortMultipartUpload"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Bos/BosClient.php#L1151-L1194 |
42,204 | baidubce/bce-sdk-php | src/BaiduBce/Auth/BceV1Signer.php | BceV1Signer.sign | public function sign(
array $credentials,
$httpMethod,
$path,
$headers,
$params,
$options = array()
) {
if (!isset($options[SignOptions::EXPIRATION_IN_SECONDS])) {
$expirationInSeconds = SignOptions::DEFAULT_EXPIRATION_IN_SECONDS;
} else {
$expirationInSeconds = $options[SignOptions::EXPIRATION_IN_SECONDS];
}
// to compatible with ak/sk or accessKeyId/secretAccessKey
if(isset($credentials['ak'])){
$accessKeyId = $credentials['ak'];
}
if(isset($credentials['sk'])){
$secretAccessKey = $credentials['sk'];
}
if(isset($credentials['accessKeyId'])){
$accessKeyId = $credentials['accessKeyId'];
}
if(isset($credentials['secretAccessKey'])){
$secretAccessKey = $credentials['secretAccessKey'];
}
if (isset($options[SignOptions::TIMESTAMP])) {
$timestamp = $options[SignOptions::TIMESTAMP];
} else {
$timestamp = new \DateTime();
}
$timestamp->setTimezone(DateUtils::$UTC_TIMEZONE);
$authString = BceV1Signer::BCE_AUTH_VERSION . '/' . $accessKeyId . '/'
. DateUtils::formatAlternateIso8601Date(
$timestamp
) . '/' . $expirationInSeconds;
$signingKey = hash_hmac('sha256', $authString, $secretAccessKey);
// Formatting the URL with signing protocol.
$canonicalURI = BceV1Signer::getCanonicalURIPath($path);
// Formatting the query string with signing protocol.
$canonicalQueryString = HttpUtils::getCanonicalQueryString(
$params,
true
);
// Sorted the headers should be signed from the request.
$headersToSign = null;
if (isset($options[SignOptions::HEADERS_TO_SIGN])) {
$headersToSign = $options[SignOptions::HEADERS_TO_SIGN];
}
// Formatting the headers from the request based on signing protocol.
$canonicalHeader = BceV1Signer::getCanonicalHeaders(
BceV1Signer::getHeadersToSign($headers, $headersToSign)
);
$signedHeaders = '';
if ($headersToSign !== null) {
$signedHeaders = strtolower(
trim(implode(";", array_keys($headersToSign)))
);
}
$canonicalRequest = "$httpMethod\n$canonicalURI\n"
. "$canonicalQueryString\n$canonicalHeader";
// Signing the canonical request using key with sha-256 algorithm.
$signature = hash_hmac('sha256', $canonicalRequest, $signingKey);
$authorizationHeader = "$authString/$signedHeaders/$signature";
return $authorizationHeader;
} | php | public function sign(
array $credentials,
$httpMethod,
$path,
$headers,
$params,
$options = array()
) {
if (!isset($options[SignOptions::EXPIRATION_IN_SECONDS])) {
$expirationInSeconds = SignOptions::DEFAULT_EXPIRATION_IN_SECONDS;
} else {
$expirationInSeconds = $options[SignOptions::EXPIRATION_IN_SECONDS];
}
// to compatible with ak/sk or accessKeyId/secretAccessKey
if(isset($credentials['ak'])){
$accessKeyId = $credentials['ak'];
}
if(isset($credentials['sk'])){
$secretAccessKey = $credentials['sk'];
}
if(isset($credentials['accessKeyId'])){
$accessKeyId = $credentials['accessKeyId'];
}
if(isset($credentials['secretAccessKey'])){
$secretAccessKey = $credentials['secretAccessKey'];
}
if (isset($options[SignOptions::TIMESTAMP])) {
$timestamp = $options[SignOptions::TIMESTAMP];
} else {
$timestamp = new \DateTime();
}
$timestamp->setTimezone(DateUtils::$UTC_TIMEZONE);
$authString = BceV1Signer::BCE_AUTH_VERSION . '/' . $accessKeyId . '/'
. DateUtils::formatAlternateIso8601Date(
$timestamp
) . '/' . $expirationInSeconds;
$signingKey = hash_hmac('sha256', $authString, $secretAccessKey);
// Formatting the URL with signing protocol.
$canonicalURI = BceV1Signer::getCanonicalURIPath($path);
// Formatting the query string with signing protocol.
$canonicalQueryString = HttpUtils::getCanonicalQueryString(
$params,
true
);
// Sorted the headers should be signed from the request.
$headersToSign = null;
if (isset($options[SignOptions::HEADERS_TO_SIGN])) {
$headersToSign = $options[SignOptions::HEADERS_TO_SIGN];
}
// Formatting the headers from the request based on signing protocol.
$canonicalHeader = BceV1Signer::getCanonicalHeaders(
BceV1Signer::getHeadersToSign($headers, $headersToSign)
);
$signedHeaders = '';
if ($headersToSign !== null) {
$signedHeaders = strtolower(
trim(implode(";", array_keys($headersToSign)))
);
}
$canonicalRequest = "$httpMethod\n$canonicalURI\n"
. "$canonicalQueryString\n$canonicalHeader";
// Signing the canonical request using key with sha-256 algorithm.
$signature = hash_hmac('sha256', $canonicalRequest, $signingKey);
$authorizationHeader = "$authString/$signedHeaders/$signature";
return $authorizationHeader;
} | [
"public",
"function",
"sign",
"(",
"array",
"$",
"credentials",
",",
"$",
"httpMethod",
",",
"$",
"path",
",",
"$",
"headers",
",",
"$",
"params",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
... | Sign the given request with the given set of credentials. Modifies the passed-in request to apply the signature.
@param $credentials array the credentials to sign the request with.
@param $httpMethod string
@param $path string
@param $headers array
@param $params array
@param $options array the options for signing.
@return string The signed authorization string. | [
"Sign",
"the",
"given",
"request",
"with",
"the",
"given",
"set",
"of",
"credentials",
".",
"Modifies",
"the",
"passed",
"-",
"in",
"request",
"to",
"apply",
"the",
"signature",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Auth/BceV1Signer.php#L56-L129 |
42,205 | baidubce/bce-sdk-php | src/BaiduBce/Services/Sts/StsClient.php | StsClient.getSessionToken | public function getSessionToken($options = array())
{
list($config, $acl, $durationSeconds) =
$this->parseOptions(
$options,
'config',
'acl',
'durationSeconds'
);
$params = array();
if ($durationSeconds !== null) {
$params['durationSeconds'] = $durationSeconds;
}
$headers = array();
if ($acl !== null) {
$headers[HttpHeaders::CONTENT_LENGTH] = strlen($acl);
} else {
$headers[HttpHeaders::CONTENT_LENGTH] = 0;
}
$headers[HttpHeaders::CONTENT_TYPE] = HttpContentTypes::JSON;
// prevent low version curl add a default pragma:no-cache
$headers[HttpHeaders::PRAGMA] = '';
$config['endpoint'] = $this->stsEndpoint;
$config = array_merge(
$this->config,
$config
);
$path = HttpUtils::appendUri(StsClient::STS_URL_PREFIX, StsClient::GET_SESSION_TOKEN_VERSION, StsClient::GET_SESSION_TOKEN_PATH);
$response = $this->httpClient->sendRequest(
$config,
HttpMethod::POST,
$path,
$acl,
$headers,
$params,
$this->signer
);
return $this->parseJsonResult($response['body']);
} | php | public function getSessionToken($options = array())
{
list($config, $acl, $durationSeconds) =
$this->parseOptions(
$options,
'config',
'acl',
'durationSeconds'
);
$params = array();
if ($durationSeconds !== null) {
$params['durationSeconds'] = $durationSeconds;
}
$headers = array();
if ($acl !== null) {
$headers[HttpHeaders::CONTENT_LENGTH] = strlen($acl);
} else {
$headers[HttpHeaders::CONTENT_LENGTH] = 0;
}
$headers[HttpHeaders::CONTENT_TYPE] = HttpContentTypes::JSON;
// prevent low version curl add a default pragma:no-cache
$headers[HttpHeaders::PRAGMA] = '';
$config['endpoint'] = $this->stsEndpoint;
$config = array_merge(
$this->config,
$config
);
$path = HttpUtils::appendUri(StsClient::STS_URL_PREFIX, StsClient::GET_SESSION_TOKEN_VERSION, StsClient::GET_SESSION_TOKEN_PATH);
$response = $this->httpClient->sendRequest(
$config,
HttpMethod::POST,
$path,
$acl,
$headers,
$params,
$this->signer
);
return $this->parseJsonResult($response['body']);
} | [
"public",
"function",
"getSessionToken",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"acl",
",",
"$",
"durationSeconds",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",... | Get STS session token
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating StsClient instance.
@return object the server response. | [
"Get",
"STS",
"session",
"token"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Sts/StsClient.php#L60-L101 |
42,206 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.createSimpleJob | public function createSimpleJob(
$pipelineName,
$sourceKey,
$targetKey,
$presetName,
$options = array()
) {
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (empty($sourceKey)) {
throw new BceClientException("The parameter sourceKey "
."should NOT be null or empty string");
}
if (empty($targetKey)) {
throw new BceClientException("The parameter targetKey "
."should NOT be null or empty string");
}
if (empty($presetName)) {
throw new BceClientException("The parameter presetName "
."should NOT be null or empty string");
}
return $this->createJob(
$pipelineName,
array(
'sourceKey' => $sourceKey,
),
array(
'targetKey' => $targetKey,
'presetName' => $presetName,
),
$options
);
} | php | public function createSimpleJob(
$pipelineName,
$sourceKey,
$targetKey,
$presetName,
$options = array()
) {
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (empty($sourceKey)) {
throw new BceClientException("The parameter sourceKey "
."should NOT be null or empty string");
}
if (empty($targetKey)) {
throw new BceClientException("The parameter targetKey "
."should NOT be null or empty string");
}
if (empty($presetName)) {
throw new BceClientException("The parameter presetName "
."should NOT be null or empty string");
}
return $this->createJob(
$pipelineName,
array(
'sourceKey' => $sourceKey,
),
array(
'targetKey' => $targetKey,
'presetName' => $presetName,
),
$options
);
} | [
"public",
"function",
"createSimpleJob",
"(",
"$",
"pipelineName",
",",
"$",
"sourceKey",
",",
"$",
"targetKey",
",",
"$",
"presetName",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"pipelineName",
")",
")",
"{",... | Create a job, a simpler api
@param string $pipelineName The pipeline name
@param string $sourceKey The source media object's key
@param string $targetKey The target media object's key
which will be generated
@param string $presetName The preset name this job use
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"job",
"a",
"simpler",
"api"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L107-L146 |
42,207 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.getJob | public function getJob($jobId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($jobId)) {
throw new BceClientException("The parameter jobId "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/job/$jobId"
);
} | php | public function getJob($jobId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($jobId)) {
throw new BceClientException("The parameter jobId "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/job/$jobId"
);
} | [
"public",
"function",
"getJob",
"(",
"$",
"jobId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"empty",
... | Get the specific job information
@param string $jobId The job's id
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"the",
"specific",
"job",
"information"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L217-L233 |
42,208 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.getMediaInfoOfFile | public function getMediaInfoOfFile($bucket, $key, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($bucket)) {
throw new BceClientException("The parameter bucket "
."should NOT be null or empty string");
}
if (empty($key)) {
throw new BceClientException("The parameter key "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => array(
'bucket' => $bucket,
'key' => rawurlencode($key),
),
),
'/mediainfo'
);
} | php | public function getMediaInfoOfFile($bucket, $key, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($bucket)) {
throw new BceClientException("The parameter bucket "
."should NOT be null or empty string");
}
if (empty($key)) {
throw new BceClientException("The parameter key "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => array(
'bucket' => $bucket,
'key' => rawurlencode($key),
),
),
'/mediainfo'
);
} | [
"public",
"function",
"getMediaInfoOfFile",
"(",
"$",
"bucket",
",",
"$",
"key",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")"... | Get the information of a media object in BOS
@param string $bucket The bucket's name in BOS
@param string $key The object's key in bucket
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"the",
"information",
"of",
"a",
"media",
"object",
"in",
"BOS"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L248-L273 |
42,209 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.createPipeline | public function createPipeline(
$pipelineName,
$sourceBucket,
$targetBucket,
$options = array()
) {
list($config, $description, $pipelineConfig) = $this->parseOptions(
$options,
'config',
'description',
'pipelineConfig'
);
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (empty($sourceBucket)) {
throw new BceClientException("The parameter sourceBucket "
."should NOT be null or empty string");
}
if (empty($targetBucket)) {
throw new BceClientException("The parameter targetBucket "
."should NOT be null or empty string");
}
$body = array(
'pipelineName' => $pipelineName,
'sourceBucket' => $sourceBucket,
'targetBucket' => $targetBucket,
);
if ($description !== null) {
$body['description'] = $description;
} else {
$body['description'] = '';
}
if ($pipelineConfig !== null) {
$body['config'] = $pipelineConfig;
} else {
$body['config'] = array('capacity' => 20);
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/pipeline'
);
} | php | public function createPipeline(
$pipelineName,
$sourceBucket,
$targetBucket,
$options = array()
) {
list($config, $description, $pipelineConfig) = $this->parseOptions(
$options,
'config',
'description',
'pipelineConfig'
);
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (empty($sourceBucket)) {
throw new BceClientException("The parameter sourceBucket "
."should NOT be null or empty string");
}
if (empty($targetBucket)) {
throw new BceClientException("The parameter targetBucket "
."should NOT be null or empty string");
}
$body = array(
'pipelineName' => $pipelineName,
'sourceBucket' => $sourceBucket,
'targetBucket' => $targetBucket,
);
if ($description !== null) {
$body['description'] = $description;
} else {
$body['description'] = '';
}
if ($pipelineConfig !== null) {
$body['config'] = $pipelineConfig;
} else {
$body['config'] = array('capacity' => 20);
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/pipeline'
);
} | [
"public",
"function",
"createPipeline",
"(",
"$",
"pipelineName",
",",
"$",
"sourceBucket",
",",
"$",
"targetBucket",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"description",
",",
"$",
"pipelineConfig",
... | Create a pipeline
@param string $pipelineName The pipeline name
@param string $sourceBucket The input source bucket's name in BOS
@param string $targetBucket The output target bucket's name in BOS
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
pipelineConfig: {
capacity: The capacity of pipeline
}
description: The description of pipeline
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"pipeline"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L316-L368 |
42,210 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.getPipeline | public function getPipeline($pipelineName, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/pipeline/$pipelineName"
);
} | php | public function getPipeline($pipelineName, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/pipeline/$pipelineName"
);
} | [
"public",
"function",
"getPipeline",
"(",
"$",
"pipelineName",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
... | Get the specific pipeline information
@param string $pipelineName The pipeline name
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"the",
"specific",
"pipeline",
"information"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L382-L398 |
42,211 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.deletePipeline | public function deletePipeline($pipelineName, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/pipeline/$pipelineName"
);
} | php | public function deletePipeline($pipelineName, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/pipeline/$pipelineName"
);
} | [
"public",
"function",
"deletePipeline",
"(",
"$",
"pipelineName",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(... | Delete the specific pipeline
@param string $pipelineName The pipeline name
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Delete",
"the",
"specific",
"pipeline"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L412-L428 |
42,212 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.createPreset | public function createPreset($presetName, $container, $options = array())
{
list($config) = $this->parseOptionsIgnoreExtra(
$options,
'config'
);
if (empty($presetName)) {
throw new BceClientException("The parameter presetName "
."should NOT be null or empty string");
}
if (empty($container)) {
throw new BceClientException("The parameter container "
."should NOT be null or empty string");
}
if (!empty($config)) {
unset($options['config']);
}
$body = $options;
$body['presetName'] = $presetName;
$body['container'] = $container;
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/preset'
);
} | php | public function createPreset($presetName, $container, $options = array())
{
list($config) = $this->parseOptionsIgnoreExtra(
$options,
'config'
);
if (empty($presetName)) {
throw new BceClientException("The parameter presetName "
."should NOT be null or empty string");
}
if (empty($container)) {
throw new BceClientException("The parameter container "
."should NOT be null or empty string");
}
if (!empty($config)) {
unset($options['config']);
}
$body = $options;
$body['presetName'] = $presetName;
$body['container'] = $container;
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/preset'
);
} | [
"public",
"function",
"createPreset",
"(",
"$",
"presetName",
",",
"$",
"container",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptionsIgnoreExtra",
"(",
"$",
"options",
",",
"'... | Create a preset
@param string $presetName The preset's name
@param string $container enum(MP4, FLV, HLS, MP3, M4A)
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
description: The preset's description
transmux(boolean): whether only preceed format transformation
clip: { cut the video or audio
startTimeInSecond: The start time from video
durationInSecond: The duration time from video in seconds
}
audio: { audio preceeding set, default to be video preceeding only
bitRateInBps: The target audio bit rate
sampleRateInHz:
channels: The number of audio's channels
}
video: { video proceeding set, default to be audio preceeding only
codec: H.264
codecOptions: {
profile: enum(baseline, main, high)
}
bitRateInBps: The target video bit rate
maxFrameRate: The max frame rate, enum(10,15, 23.97, 24, 25, 29.97, 30, 50, 60)
maxWidthInPixel: The target video's max width in pixel, range(128, 4096)
maxHeightInPixel: The target video's max height in pixel, range(96, 3072)
sizingPolicy: enum(Keep, ShrinkToFit, Stretch)
}
encryption: {
strategy: enum(Fixed)
aesKey: The aes 128-bit secret key
}
watermarkId: watermarkId
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"preset"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L471-L503 |
42,213 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.createThumbnailJob | public function createThumbnailJob($pipelineName, array $source, $options = array()) {
list($config, $target, $capture) = $this->parseOptions(
$options,
'config',
'target',
'capture'
);
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (empty($source)) {
throw new BceClientException("The parameter source "
."should NOT be null or empty string");
}
$body = array(
'pipelineName' => $pipelineName,
'source' => $source,
);
if ($target !== null) {
$body['target'] = $target;
}
if ($capture !== null) {
$body['capture'] = $capture;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/job/thumbnail'
);
} | php | public function createThumbnailJob($pipelineName, array $source, $options = array()) {
list($config, $target, $capture) = $this->parseOptions(
$options,
'config',
'target',
'capture'
);
if (empty($pipelineName)) {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (empty($source)) {
throw new BceClientException("The parameter source "
."should NOT be null or empty string");
}
$body = array(
'pipelineName' => $pipelineName,
'source' => $source,
);
if ($target !== null) {
$body['target'] = $target;
}
if ($capture !== null) {
$body['capture'] = $capture;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/job/thumbnail'
);
} | [
"public",
"function",
"createThumbnailJob",
"(",
"$",
"pipelineName",
",",
"array",
"$",
"source",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"target",
",",
"$",
"capture",
")",
"=",
"$",
"this",
"->"... | Create a job of generating thumbnail
@param string $pipelineName the pipeline name
@param array $source
{
key: The source media object's key
}
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
target: { The target thumbnail info set
keyPrefix: Prefix of the target thumbnail
format: Target thumbnail file format, enum(jpg, png), only jpg is supported now
sizingPolicy: enum(keep, shrinkToFit, stretch)
widthInPixel: The target thumbnail width in pixel
heightInPixel: The target thumbnail height in pixel
}
capture: { The rules to generate the thumbnail
mode: enum(auto, manual)
startTimeInSecond: The start time
endTimeInSecond: The end time
intervalInSecond: The time interval
}
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"job",
"of",
"generating",
"thumbnail"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L618-L656 |
42,214 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.listThumbnailJobsByPipelineName | public function listThumbnailJobsByPipelineName(
$pipelineName,
$jobStatus = null,
$begin = null,
$end = null,
$options = array()
) {
list($config) = $this->parseOptions($options, 'config');
$params = array();
if (!empty($pipelineName)) {
$params['pipelineName'] = $pipelineName;
} else {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (!empty($jobStatus)) {
$params['jobStatus'] = $jobStatus;
}
if (!empty($begin)) {
$params['begin'] = $begin;
}
if (!empty($end)) {
$params['end'] = $end;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/job/thumbnail"
);
} | php | public function listThumbnailJobsByPipelineName(
$pipelineName,
$jobStatus = null,
$begin = null,
$end = null,
$options = array()
) {
list($config) = $this->parseOptions($options, 'config');
$params = array();
if (!empty($pipelineName)) {
$params['pipelineName'] = $pipelineName;
} else {
throw new BceClientException("The parameter pipelineName "
."should NOT be null or empty string");
}
if (!empty($jobStatus)) {
$params['jobStatus'] = $jobStatus;
}
if (!empty($begin)) {
$params['begin'] = $begin;
}
if (!empty($end)) {
$params['end'] = $end;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/job/thumbnail"
);
} | [
"public",
"function",
"listThumbnailJobsByPipelineName",
"(",
"$",
"pipelineName",
",",
"$",
"jobStatus",
"=",
"null",
",",
"$",
"begin",
"=",
"null",
",",
"$",
"end",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$"... | Get thumbnail jobs
@param string $pipelineName The pipeline name
@param string $jobStatus The jobStatus of the thumbnail job, not filter if null
@param string $begin The createTime should be later than or equals with begin, not check if null
@param string $end The createTime should be earlier than or equals with end, not check if null
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"thumbnail",
"jobs"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L703-L736 |
42,215 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.createWatermark | public function createWatermark(
$bucket,
$key,
$options = array()
) {
list(
$config,
$verticalAlignment,
$horizontalAlignment,
$verticalOffsetInPixel,
$horizontalOffsetInPixel
) = $this->parseOptions(
$options,
'config',
'verticalAlignment',
'horizontalAlignment',
'verticalOffsetInPixel',
'horizontalOffsetInPixel'
);
if (empty($bucket)) {
throw new BceClientException("The parameter bucket "
."should NOT be null or empty string");
}
if (empty($key)) {
throw new BceClientException("The parameter key "
."should NOT be null or empty string");
}
$body = array(
'bucket' => $bucket,
'key' => $key,
);
if ($verticalAlignment !== null) {
$body['verticalAlignment'] = $verticalAlignment;
}
if ($horizontalAlignment !== null) {
$body['horizontalAlignment'] = $horizontalAlignment;
}
if ($verticalOffsetInPixel !== null) {
$body['verticalOffsetInPixel'] = $verticalOffsetInPixel;
}
if ($horizontalOffsetInPixel !== null) {
$body['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/watermark'
);
} | php | public function createWatermark(
$bucket,
$key,
$options = array()
) {
list(
$config,
$verticalAlignment,
$horizontalAlignment,
$verticalOffsetInPixel,
$horizontalOffsetInPixel
) = $this->parseOptions(
$options,
'config',
'verticalAlignment',
'horizontalAlignment',
'verticalOffsetInPixel',
'horizontalOffsetInPixel'
);
if (empty($bucket)) {
throw new BceClientException("The parameter bucket "
."should NOT be null or empty string");
}
if (empty($key)) {
throw new BceClientException("The parameter key "
."should NOT be null or empty string");
}
$body = array(
'bucket' => $bucket,
'key' => $key,
);
if ($verticalAlignment !== null) {
$body['verticalAlignment'] = $verticalAlignment;
}
if ($horizontalAlignment !== null) {
$body['horizontalAlignment'] = $horizontalAlignment;
}
if ($verticalOffsetInPixel !== null) {
$body['verticalOffsetInPixel'] = $verticalOffsetInPixel;
}
if ($horizontalOffsetInPixel !== null) {
$body['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/watermark'
);
} | [
"public",
"function",
"createWatermark",
"(",
"$",
"bucket",
",",
"$",
"key",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"verticalAlignment",
",",
"$",
"horizontalAlignment",
",",
"$",
"verticalOffsetInPixe... | Create a watermark
@param string $bucket The source media BOS bucket
@param string $key the source media object key
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
verticalAlignment: watermark vertical alignment, enum(top, center, bottom)
horizontalAlignment: watermark vertical alignment, enum(left, center, right)
verticalOffsetInPixel: numeric vertical offset, 0~3072
horizontalOffsetInPixel: numeric vertical offset, 0~4096
}
@return mixed
@throws BceClientException
@since 0.8.4 | [
"Create",
"a",
"watermark"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L756-L811 |
42,216 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.getWatermark | public function getWatermark($watermarkId, $options = array()) {
list($config) = $this->parseOptions($options, 'config');
if (empty($watermarkId)) {
throw new BceClientException("The parameter watermarkId "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/watermark/$watermarkId"
);
} | php | public function getWatermark($watermarkId, $options = array()) {
list($config) = $this->parseOptions($options, 'config');
if (empty($watermarkId)) {
throw new BceClientException("The parameter watermarkId "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/watermark/$watermarkId"
);
} | [
"public",
"function",
"getWatermark",
"(",
"$",
"watermarkId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
... | Get a watermark
@param string $watermarkId The watermark id
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"a",
"watermark"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L825-L840 |
42,217 | baidubce/bce-sdk-php | src/BaiduBce/Services/Media/MediaClient.php | MediaClient.deleteWatermark | public function deleteWatermark($watermarkId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($watermarkId)) {
throw new BceClientException("The parameter watermarkId "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/watermark/$watermarkId"
);
} | php | public function deleteWatermark($watermarkId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($watermarkId)) {
throw new BceClientException("The parameter watermarkId "
."should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/watermark/$watermarkId"
);
} | [
"public",
"function",
"deleteWatermark",
"(",
"$",
"watermarkId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(... | Delete the specific watermark
@param string $watermarkId The watermark Id
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Delete",
"the",
"specific",
"watermark"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Media/MediaClient.php#L878-L892 |
42,218 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.applyMedia | public function applyMedia($options = array())
{
list($config) = $this->parseOptions($options, 'config');
$params = array(
'apply' => null,
);
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'params' => $params,
),
'/media'
);
} | php | public function applyMedia($options = array())
{
list($config) = $this->parseOptions($options, 'config');
$params = array(
'apply' => null,
);
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'params' => $params,
),
'/media'
);
} | [
"public",
"function",
"applyMedia",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'... | apply a vod media
Apply a new vod media, get mediaId, sourceBucket, sourceKey.
You account have the access to write the sourceBucket and sourceKey.
You need upload video to sourceBucket and sourceKey via BosClient,
Then call processMedia method to get a VOD media.
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed created vod media info
@throws BceClientException | [
"apply",
"a",
"vod",
"media",
"Apply",
"a",
"new",
"vod",
"media",
"get",
"mediaId",
"sourceBucket",
"sourceKey",
".",
"You",
"account",
"have",
"the",
"access",
"to",
"write",
"the",
"sourceBucket",
"and",
"sourceKey",
".",
"You",
"need",
"upload",
"video",... | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L71-L86 |
42,219 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.processMedia | public function processMedia($mediaId, $title, $description, $options = array())
{
list($config, $extension, $presetGroup) =
$this->parseOptions($options, 'config', 'sourceExtension', 'transcodingPresetGroupName');
$params = array(
'process' => null,
);
$body = array(
'title' => $title,
'description' => $description,
'sourceExtension' => $extension,
'transcodingPresetGroupName' => $presetGroup,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
'body' => json_encode($body),
),
"/media/$mediaId"
);
} | php | public function processMedia($mediaId, $title, $description, $options = array())
{
list($config, $extension, $presetGroup) =
$this->parseOptions($options, 'config', 'sourceExtension', 'transcodingPresetGroupName');
$params = array(
'process' => null,
);
$body = array(
'title' => $title,
'description' => $description,
'sourceExtension' => $extension,
'transcodingPresetGroupName' => $presetGroup,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
'body' => json_encode($body),
),
"/media/$mediaId"
);
} | [
"public",
"function",
"processMedia",
"(",
"$",
"mediaId",
",",
"$",
"title",
",",
"$",
"description",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"extension",
",",
"$",
"presetGroup",
")",
"=",
"$",
... | process a vod media
After applying media, uploading original video to bosClient,
you MUST call processMedia method to get a VOD media.
@param $mediaId
@param $title string, the title of the media
@param $description string, the description of the media
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
sourceExtension: extension of the media source.
transcodingPresetGroupName: preset group to be used for the media
}
@return mixed created vod media info
@throws BceClientException | [
"process",
"a",
"vod",
"media",
"After",
"applying",
"media",
"uploading",
"original",
"video",
"to",
"bosClient",
"you",
"MUST",
"call",
"processMedia",
"method",
"to",
"get",
"a",
"VOD",
"media",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L106-L129 |
42,220 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.rerunMedia | public function rerunMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
$params = array(
'rerun' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/media/$mediaId"
);
} | php | public function rerunMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
$params = array(
'rerun' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/media/$mediaId"
);
} | [
"public",
"function",
"rerunMedia",
"(",
"$",
"mediaId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"$",
"params",
... | rerun a vod media
you can call rerunMedia method to re-process a VOD media.
@param $mediaId
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed created vod media info
@throws BceClientException | [
"rerun",
"a",
"vod",
"media",
"you",
"can",
"call",
"rerunMedia",
"method",
"to",
"re",
"-",
"process",
"a",
"VOD",
"media",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L145-L161 |
42,221 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.createMediaFromFile | public function createMediaFromFile($fileName, $title, $description = '', $options = array())
{
if (empty($fileName)) {
throw new BceClientException("The parameter fileName should NOT be null or empty string");
}
if (empty($title)) {
throw new BceClientException("The parameter title should NOT be null or empty string");
}
// apply media
$uploadInfo = $this->applyMedia($options);
// upload file to bos
$this->uploadMedia($fileName, $uploadInfo->sourceBucket, $uploadInfo->sourceKey);
// process media
// try to cal the extension of the file
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (!preg_match("/^[a-z0-9]{0,10}$/", $extension)) {
$extension = '';
}
$options['extension'] = $extension;
return $this->processMedia($uploadInfo->mediaId, $title, $description, $options);
} | php | public function createMediaFromFile($fileName, $title, $description = '', $options = array())
{
if (empty($fileName)) {
throw new BceClientException("The parameter fileName should NOT be null or empty string");
}
if (empty($title)) {
throw new BceClientException("The parameter title should NOT be null or empty string");
}
// apply media
$uploadInfo = $this->applyMedia($options);
// upload file to bos
$this->uploadMedia($fileName, $uploadInfo->sourceBucket, $uploadInfo->sourceKey);
// process media
// try to cal the extension of the file
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (!preg_match("/^[a-z0-9]{0,10}$/", $extension)) {
$extension = '';
}
$options['extension'] = $extension;
return $this->processMedia($uploadInfo->mediaId, $title, $description, $options);
} | [
"public",
"function",
"createMediaFromFile",
"(",
"$",
"fileName",
",",
"$",
"title",
",",
"$",
"description",
"=",
"''",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"fileName",
")",
")",
"{",
"throw",
"new",
... | Create a vod media via local file.
@param $fileName string, path of local file
@param $title string, the title of the media
@param $description string, the description of the media, optional
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed created vod media info
@throws BceClientException | [
"Create",
"a",
"vod",
"media",
"via",
"local",
"file",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L218-L239 |
42,222 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.createMediaFromBosObject | public function createMediaFromBosObject($bucket, $key, $title, $description = '', $options = array())
{
if (empty($bucket)) {
throw new BceClientException("The parameter fileName should NOT be null or empty string");
}
if (empty($key)) {
throw new BceClientException("The parameter fileName should NOT be null or empty string");
}
if (empty($title)) {
throw new BceClientException("The parameter title should NOT be null or empty string");
}
// apply media
$uploadInfo = $this->applyMedia($options);
// copy bos object
$this->bosClient->copyObject($bucket, $key, $uploadInfo->sourceBucket, $uploadInfo->sourceKey);
// process media
// try to cal the extension of the file
$extension = strtolower(pathinfo($key, PATHINFO_EXTENSION));
if (!preg_match("/^[a-z0-9]{0,10}$/", $extension)) {
$extension = '';
}
$options['extension'] = $extension;
return $this->processMedia($uploadInfo->mediaId, $title, $description, $options);
} | php | public function createMediaFromBosObject($bucket, $key, $title, $description = '', $options = array())
{
if (empty($bucket)) {
throw new BceClientException("The parameter fileName should NOT be null or empty string");
}
if (empty($key)) {
throw new BceClientException("The parameter fileName should NOT be null or empty string");
}
if (empty($title)) {
throw new BceClientException("The parameter title should NOT be null or empty string");
}
// apply media
$uploadInfo = $this->applyMedia($options);
// copy bos object
$this->bosClient->copyObject($bucket, $key, $uploadInfo->sourceBucket, $uploadInfo->sourceKey);
// process media
// try to cal the extension of the file
$extension = strtolower(pathinfo($key, PATHINFO_EXTENSION));
if (!preg_match("/^[a-z0-9]{0,10}$/", $extension)) {
$extension = '';
}
$options['extension'] = $extension;
return $this->processMedia($uploadInfo->mediaId, $title, $description, $options);
} | [
"public",
"function",
"createMediaFromBosObject",
"(",
"$",
"bucket",
",",
"$",
"key",
",",
"$",
"title",
",",
"$",
"description",
"=",
"''",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"bucket",
")",
")",
"... | Create a vod media via bos object.
@param $bucket string, bos bucket name
@param $key string, bos object key
@param $title string, the title of the media
@param $description string, the description of the media, optional
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed created vod media info
@throws BceClientException | [
"Create",
"a",
"vod",
"media",
"via",
"bos",
"object",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L257-L280 |
42,223 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.getMedia | public function getMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/media/$mediaId"
);
} | php | public function getMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/media/$mediaId"
);
} | [
"public",
"function",
"getMedia",
"(",
"$",
"mediaId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"empty... | get the info of a vod media by mediaId
@param $mediaId string, mediaId of the media
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed media info
@throws BceClientException | [
"get",
"the",
"info",
"of",
"a",
"vod",
"media",
"by",
"mediaId"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L294-L309 |
42,224 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.listMediaByMarker | public function listMediaByMarker($options = array())
{
list($config, $marker, $maxSize, $title, $status, $begin, $end) =
$this->parseOptions($options, 'config', 'marker', 'maxSize', 'title', 'status', 'begin', 'end');
$params = array(
'marker' => $marker,
'maxSize' => $maxSize,
'title' => $title,
'status' => $status,
'begin' => $begin,
'end' => $end,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/media'
);
} | php | public function listMediaByMarker($options = array())
{
list($config, $marker, $maxSize, $title, $status, $begin, $end) =
$this->parseOptions($options, 'config', 'marker', 'maxSize', 'title', 'status', 'begin', 'end');
$params = array(
'marker' => $marker,
'maxSize' => $maxSize,
'title' => $title,
'status' => $status,
'begin' => $begin,
'end' => $end,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/media'
);
} | [
"public",
"function",
"listMediaByMarker",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"marker",
",",
"$",
"maxSize",
",",
"$",
"title",
",",
"$",
"status",
",",
"$",
"begin",
",",
"$",
"end",
")",
... | get the info of current user's all vod media by marker
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
marker: string, marker of current query
maxSize: int, max size of media(s) of current query
title: string, title prefix of the media(s)
status: string, status of the media(s)
begin: string, the low limit of the createTime of the media(s)
end: string, the upper limit of the createTime of the media(s)
}
@return mixed the info of user's all media
@throws BceClientException | [
"get",
"the",
"info",
"of",
"current",
"user",
"s",
"all",
"vod",
"media",
"by",
"marker"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L328-L350 |
42,225 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.listMediaByPage | public function listMediaByPage($pageNo,
$pageSize,
$options = array())
{
list($config, $title, $status, $begin, $end) =
$this->parseOptions($options, 'config', 'title', 'status', 'begin', 'end');
$params = array(
'pageNo' => $pageNo,
'pageSize' => $pageSize,
'title' => $title,
'status' => $status,
'begin' => $begin,
'end' => $end,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/media'
);
} | php | public function listMediaByPage($pageNo,
$pageSize,
$options = array())
{
list($config, $title, $status, $begin, $end) =
$this->parseOptions($options, 'config', 'title', 'status', 'begin', 'end');
$params = array(
'pageNo' => $pageNo,
'pageSize' => $pageSize,
'title' => $title,
'status' => $status,
'begin' => $begin,
'end' => $end,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/media'
);
} | [
"public",
"function",
"listMediaByPage",
"(",
"$",
"pageNo",
",",
"$",
"pageSize",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"title",
",",
"$",
"status",
",",
"$",
"begin",
",",
"$",
"end",
")",
... | get the info of current user's all vod media by page
@param $pageNo integer, pageNo of the resultSet
@param $pageSize integer, pageSize of the resultSet
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
title: string, title prefix of the media(s)
status: string, status of the media(s)
begin: string, the low limit of the createTime of the media(s)
end: string, the upper limit of the createTime of the media(s)
}
@return mixed the info of user's all media
@throws BceClientException | [
"get",
"the",
"info",
"of",
"current",
"user",
"s",
"all",
"vod",
"media",
"by",
"page"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L369-L393 |
42,226 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.updateMedia | public function updateMedia($mediaId, $title, $description, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
if (empty($title)) {
throw new BceClientException("The parameter title should NOT be null or empty string");
}
$body = array(
'title' => $title,
'description' => $description,
);
$params = array(
'attributes' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'body' => json_encode($body),
'params' => $params,
),
"/media/$mediaId"
);
} | php | public function updateMedia($mediaId, $title, $description, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
if (empty($title)) {
throw new BceClientException("The parameter title should NOT be null or empty string");
}
$body = array(
'title' => $title,
'description' => $description,
);
$params = array(
'attributes' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'body' => json_encode($body),
'params' => $params,
),
"/media/$mediaId"
);
} | [
"public",
"function",
"updateMedia",
"(",
"$",
"mediaId",
",",
"$",
"title",
",",
"$",
"description",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",... | update the attributes of a vod media
@param $mediaId string, mediaId of the media
@param $title string, new title of the media
@param $description string, new description of the media
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed the result of updating
@throws BceClientException | [
"update",
"the",
"attributes",
"of",
"a",
"vod",
"media"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L409-L439 |
42,227 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.publishMedia | public function publishMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
$params = array(
'publish' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/media/$mediaId"
);
} | php | public function publishMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
$params = array(
'publish' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/media/$mediaId"
);
} | [
"public",
"function",
"publishMedia",
"(",
"$",
"mediaId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"e... | publish a vod media
@param $mediaId string, mediaId of the media
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed the result of publishing
@throws BceClientException | [
"publish",
"a",
"vod",
"media"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L534-L554 |
42,228 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.getMediaStatistic | public function getMediaStatistic($mediaId,
$startTime,
$endTime,
$aggregate,
$options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
$params = array();
if (!empty($startTime)) {
$params['startTime'] = $startTime;
}
if (!empty($endTime)) {
$params['endTime'] = $endTime;
}
if (!empty($aggregate)) {
$params['aggregate'] = $aggregate;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistic/media/$mediaId"
);
} | php | public function getMediaStatistic($mediaId,
$startTime,
$endTime,
$aggregate,
$options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
$params = array();
if (!empty($startTime)) {
$params['startTime'] = $startTime;
}
if (!empty($endTime)) {
$params['endTime'] = $endTime;
}
if (!empty($aggregate)) {
$params['aggregate'] = $aggregate;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistic/media/$mediaId"
);
} | [
"public",
"function",
"getMediaStatistic",
"(",
"$",
"mediaId",
",",
"$",
"startTime",
",",
"$",
"endTime",
",",
"$",
"aggregate",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseO... | get the statistic of a vod media
@param $mediaId string, mediaId of the media
@param $startTime string
@param $endTime string
@param $aggregate string, 'true' or 'false'
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed the result of publishing
@throws BceClientException | [
"get",
"the",
"statistic",
"of",
"a",
"vod",
"media"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L572-L601 |
42,229 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.deleteMedia | public function deleteMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/media/$mediaId"
);
} | php | public function deleteMedia($mediaId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/media/$mediaId"
);
} | [
"public",
"function",
"deleteMedia",
"(",
"$",
"mediaId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"em... | delete a vod media
@param $mediaId string, mediaId of the media
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed the result of deleting
@throws BceClientException | [
"delete",
"a",
"vod",
"media"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L615-L630 |
42,230 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.getMediaSource | public function getMediaSource($mediaId, $expiredInSeconds, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
if (empty($expiredInSeconds)) {
$expiredInSeconds = -1;
}
$params = array(
'sourcedownload' => null,
'expiredInSeconds' => $expiredInSeconds,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/media/$mediaId"
);
} | php | public function getMediaSource($mediaId, $expiredInSeconds, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($mediaId)) {
throw new BceClientException("The parameter mediaId should NOT be null or empty string");
}
if (empty($expiredInSeconds)) {
$expiredInSeconds = -1;
}
$params = array(
'sourcedownload' => null,
'expiredInSeconds' => $expiredInSeconds,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/media/$mediaId"
);
} | [
"public",
"function",
"getMediaSource",
"(",
"$",
"mediaId",
",",
"$",
"expiredInSeconds",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'confi... | get the source download info of a vod media
@param $mediaId string, mediaId of the media
@param $expiredInSeconds integer, expire time of the url
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default vod client configuration that was passed in constructor.
}
@return mixed the vod media's playable source file and cover page
@throws BceClientException | [
"get",
"the",
"source",
"download",
"info",
"of",
"a",
"vod",
"media"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L958-L981 |
42,231 | baidubce/bce-sdk-php | src/BaiduBce/Services/Vod/VodClient.php | VodClient.uploadMedia | private function uploadMedia($fileName, $bucket, $key)
{
// init multi-part upload
$initUploadResponse = $this->bosClient->initiateMultipartUpload($bucket, $key);
$uploadId = $initUploadResponse->uploadId;
// do upload part
try {
$offset = 0;
$partNumber = 1;
$partSize = BosClient::MIN_PART_SIZE;
$length = $partSize;
$partList = array();
$bytesLeft = filesize($fileName);
while ($bytesLeft > 0) {
$length = ($length > $bytesLeft) ? $bytesLeft : $length;
$uploadResponse = $this->bosClient->uploadPartFromFile(
$bucket,
$key,
$uploadId,
$partNumber,
$fileName,
$offset,
$length);
array_push($partList, array(
'partNumber' => $partNumber,
'eTag' => $uploadResponse->metadata['etag'],
));
$offset += $length;
$partNumber++;
$bytesLeft -= $length;
}
// complete upload
$this->bosClient->completeMultipartUpload($bucket, $key, $uploadId, $partList);
} catch (\Exception $e) {
$this->bosClient->abortMultipartUpload($bucket, $key, $uploadId);
throw $e;
}
} | php | private function uploadMedia($fileName, $bucket, $key)
{
// init multi-part upload
$initUploadResponse = $this->bosClient->initiateMultipartUpload($bucket, $key);
$uploadId = $initUploadResponse->uploadId;
// do upload part
try {
$offset = 0;
$partNumber = 1;
$partSize = BosClient::MIN_PART_SIZE;
$length = $partSize;
$partList = array();
$bytesLeft = filesize($fileName);
while ($bytesLeft > 0) {
$length = ($length > $bytesLeft) ? $bytesLeft : $length;
$uploadResponse = $this->bosClient->uploadPartFromFile(
$bucket,
$key,
$uploadId,
$partNumber,
$fileName,
$offset,
$length);
array_push($partList, array(
'partNumber' => $partNumber,
'eTag' => $uploadResponse->metadata['etag'],
));
$offset += $length;
$partNumber++;
$bytesLeft -= $length;
}
// complete upload
$this->bosClient->completeMultipartUpload($bucket, $key, $uploadId, $partList);
} catch (\Exception $e) {
$this->bosClient->abortMultipartUpload($bucket, $key, $uploadId);
throw $e;
}
} | [
"private",
"function",
"uploadMedia",
"(",
"$",
"fileName",
",",
"$",
"bucket",
",",
"$",
"key",
")",
"{",
"// init multi-part upload",
"$",
"initUploadResponse",
"=",
"$",
"this",
"->",
"bosClient",
"->",
"initiateMultipartUpload",
"(",
"$",
"bucket",
",",
"$... | Upload the media source to bos.
@param $fileName
@param $bucket
@param $key
@throws \Exception | [
"Upload",
"the",
"media",
"source",
"to",
"bos",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Vod/VodClient.php#L995-L1035 |
42,232 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getSession | public function getSession($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/session/$sessionId"
);
} | php | public function getSession($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/session/$sessionId"
);
} | [
"public",
"function",
"getSession",
"(",
"$",
"sessionId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"e... | Get a session.
@param $sessionId string, session id
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed session detail
@throws BceClientException | [
"Get",
"a",
"session",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L198-L214 |
42,233 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.listSessions | public function listSessions($options = array())
{
list($config, $status, $marker, $maxSize) = $this->parseOptions($options, 'config', 'status', 'marker', 'maxSize');
$params = array();
if ($status !== null) {
$params['status'] = $status;
}
if ($marker !== null) {
$params['marker'] = $marker;
}
if ($maxSize !== null) {
$params['maxSize'] = $maxSize;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/session'
);
} | php | public function listSessions($options = array())
{
list($config, $status, $marker, $maxSize) = $this->parseOptions($options, 'config', 'status', 'marker', 'maxSize');
$params = array();
if ($status !== null) {
$params['status'] = $status;
}
if ($marker !== null) {
$params['marker'] = $marker;
}
if ($maxSize !== null) {
$params['maxSize'] = $maxSize;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/session'
);
} | [
"public",
"function",
"listSessions",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"status",
",",
"$",
"marker",
",",
"$",
"maxSize",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
... | List sessions.
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
status: session status, READY / ONGOING / PAUSED
marker: query marker.
maxSize: max number of listed sessions.
}
@return mixed session list | [
"List",
"sessions",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L326-L350 |
42,234 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.listSessionsByStatus | public function listSessionsByStatus($status, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($status)) {
throw new BceClientException("The parameter status "
. "should NOT be null or empty string");
}
$params = array(
'status' => $status,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/session'
);
} | php | public function listSessionsByStatus($status, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($status)) {
throw new BceClientException("The parameter status "
. "should NOT be null or empty string");
}
$params = array(
'status' => $status,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
'/session'
);
} | [
"public",
"function",
"listSessionsByStatus",
"(",
"$",
"status",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(... | List sessions with a status filter.
@param $status string, session status as a filter,
valid values: READY / ONGOING / PAUSED
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed session list
@throws BceClientException | [
"List",
"sessions",
"with",
"a",
"status",
"filter",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L365-L386 |
42,235 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.resumeSession | public function resumeSession($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
$params = array(
'resume' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/session/$sessionId"
);
} | php | public function resumeSession($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
$params = array(
'resume' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/session/$sessionId"
);
} | [
"public",
"function",
"resumeSession",
"(",
"$",
"sessionId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
... | Resume a session.
@param $sessionId string, session id
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Resume",
"a",
"session",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L471-L492 |
42,236 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.deleteSession | public function deleteSession($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/session/$sessionId"
);
} | php | public function deleteSession($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/session/$sessionId"
);
} | [
"public",
"function",
"deleteSession",
"(",
"$",
"sessionId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
... | Delete a session.
@param $sessionId string, session id
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Delete",
"a",
"session",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L541-L557 |
42,237 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.setCuepoint | public function setCuepoint($sessionId, $callback, $options = array())
{
list($config, $arguments) = $this->parseOptions(
$options,
'config',
'arguments'
);
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
if (empty($callback)) {
throw new BceClientException("The parameter callback "
. "should NOT be null or empty string");
}
$body = array();
$body['callback'] = $callback;
if ($arguments !== null) {
$body['arguments'] = $arguments;
}
$params = array(
'cuepoint' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
'body' => json_encode($body, JSON_FORCE_OBJECT),
),
"/session/$sessionId"
);
} | php | public function setCuepoint($sessionId, $callback, $options = array())
{
list($config, $arguments) = $this->parseOptions(
$options,
'config',
'arguments'
);
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
if (empty($callback)) {
throw new BceClientException("The parameter callback "
. "should NOT be null or empty string");
}
$body = array();
$body['callback'] = $callback;
if ($arguments !== null) {
$body['arguments'] = $arguments;
}
$params = array(
'cuepoint' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
'body' => json_encode($body, JSON_FORCE_OBJECT),
),
"/session/$sessionId"
);
} | [
"public",
"function",
"setCuepoint",
"(",
"$",
"sessionId",
",",
"$",
"callback",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"arguments",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"option... | Set cuepoint to session.
@param $sessionId string, session id
@param $callback string, callback method name
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
arguments: array, callback arguments
}
@return mixed
@throws BceClientException | [
"Set",
"cuepoint",
"to",
"session",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L573-L611 |
42,238 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getSessionSourceInfo | public function getSessionSourceInfo($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
$params = array(
'sourceInfo' => null,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/session/$sessionId"
);
} | php | public function getSessionSourceInfo($sessionId, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($sessionId)) {
throw new BceClientException("The parameter sessionId "
. "should NOT be null or empty string");
}
$params = array(
'sourceInfo' => null,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/session/$sessionId"
);
} | [
"public",
"function",
"getSessionSourceInfo",
"(",
"$",
"sessionId",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
... | Get session real-time source info.
@param $sessionId string, session id
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"session",
"real",
"-",
"time",
"source",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L701-L722 |
42,239 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.createPreset | public function createPreset($name, $options = array())
{
list($config, $description, $forwardOnly, $audio, $video, $hls, $rtmp) = $this->parseOptions(
$options,
'config',
'description',
'forwardOnly',
'audio',
'video',
'hls',
'rtmp'
);
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
$body = array(
'name' => $name,
);
if ($description !== null) {
$body['description'] = $description;
}
if ($forwardOnly !== null) {
$body['forwardOnly'] = $forwardOnly;
}
if ($audio !== null) {
$body['audio'] = $audio;
}
if ($video !== null) {
$body['video'] = $video;
}
if ($hls !== null) {
$body['hls'] = $hls;
}
if ($rtmp !== null) {
$body['rtmp'] = $rtmp;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/preset'
);
} | php | public function createPreset($name, $options = array())
{
list($config, $description, $forwardOnly, $audio, $video, $hls, $rtmp) = $this->parseOptions(
$options,
'config',
'description',
'forwardOnly',
'audio',
'video',
'hls',
'rtmp'
);
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
$body = array(
'name' => $name,
);
if ($description !== null) {
$body['description'] = $description;
}
if ($forwardOnly !== null) {
$body['forwardOnly'] = $forwardOnly;
}
if ($audio !== null) {
$body['audio'] = $audio;
}
if ($video !== null) {
$body['video'] = $video;
}
if ($hls !== null) {
$body['hls'] = $hls;
}
if ($rtmp !== null) {
$body['rtmp'] = $rtmp;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
'/preset'
);
} | [
"public",
"function",
"createPreset",
"(",
"$",
"name",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"description",
",",
"$",
"forwardOnly",
",",
"$",
"audio",
",",
"$",
"video",
",",
"$",
"hls",
",",... | Create a preset.
@param $name string, preset name
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
description: string, preset description
forwardOnly: boolean, whether the preset is forward-only.
when forwardOnly = true, should not set audio/video.
audio: { audio output settings
bitRateInBps: number, output audio bit rate
sampleRateInHz: number, output audio sample rate
channels: number, output audio
},
video: { video output settings
codec: string, output video codec, valid values: h264
codecOptions: {
profile: string, valid values: baseline/main/high
}
bitRateInBps: number, output video bit rate
maxFrameRate: number, output video max frame rate
maxWidthInPixel: number, output video max width
maxHeightInPixel: number, output video max height
sizingPolicy: string, output video sizing policy,
valid values: keep/stretch/shrinkToFit
},
hls: { hls output settings
segmentTimeInSecond: number, each hls segment time length
segmentListSize: number, length of segment list in the output m3u8
adaptive: boolean, whether adaptive hls is enabled
},
rmtp: { rmtp output settings
gopCache: boolean, whether or not cache 1 gop
}
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"preset",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L764-L813 |
42,240 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getPreset | public function getPreset($name, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/preset/$name"
);
} | php | public function getPreset($name, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/preset/$name"
);
} | [
"public",
"function",
"getPreset",
"(",
"$",
"name",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"empty",... | Get a preset.
@param $name string, preset name
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed preset detail
@throws BceClientException | [
"Get",
"a",
"preset",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L827-L843 |
42,241 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.deletePreset | public function deletePreset($name, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/preset/$name"
);
} | php | public function deletePreset($name, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::DELETE,
array(
'config' => $config,
),
"/preset/$name"
);
} | [
"public",
"function",
"deletePreset",
"(",
"$",
"name",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"if",
"(",
"empt... | Delete a preset.
@param $name string, preset name
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Delete",
"a",
"preset",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L881-L897 |
42,242 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.listNotifications | public function listNotifications($options = array())
{
list($config) = $this->parseOptions($options, 'config');
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
'/notification'
);
} | php | public function listNotifications($options = array())
{
list($config) = $this->parseOptions($options, 'config');
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
'/notification'
);
} | [
"public",
"function",
"listNotifications",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'config'",
")",
";",
"return",
"$",
"this",
"->",
"s... | List notifications.
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed notification list | [
"List",
"notifications",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L980-L991 |
42,243 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.createImageWatermark | public function createImageWatermark($name, $content, $options = array())
{
list($config, $maxWidthInPixel, $maxHeightInPixel,
$sizingPolicy, $verticalAlignment, $horizontalAlignment,
$verticalOffsetInPixel, $horizontalOffsetInPixel) = $this->parseOptions(
$options,
'config',
'maxWidthInPixel',
'maxHeightInPixel',
'sizingPolicy',
'verticalAlignment',
'horizontalAlignment',
'verticalOffsetInPixel',
'horizontalOffsetInPixel'
);
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
if (empty($content)) {
throw new BceClientException("The parameter content "
. "should NOT be null or empty string");
}
$body = array(
'name' => $name,
'content' => $content,
);
$size = array();
if ($maxWidthInPixel !== null) {
$size['maxWidthInPixel'] = $maxWidthInPixel;
}
if ($maxHeightInPixel !== null) {
$size['maxHeightInPixel'] = $maxHeightInPixel;
}
if ($sizingPolicy !== null) {
$size['sizingPolicy'] = $sizingPolicy;
}
if (count($size) > 0) {
$body['size'] = $size;
}
$position = array();
if ($verticalAlignment !== null) {
$position['verticalAlignment'] = $verticalAlignment;
}
if ($horizontalAlignment !== null) {
$position['horizontalAlignment'] = $horizontalAlignment;
}
if ($verticalOffsetInPixel !== null) {
$position['verticalOffsetInPixel'] = $verticalOffsetInPixel;
}
if ($horizontalOffsetInPixel !== null) {
$position['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
}
if (count($position) > 0) {
$body['position'] = $position;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body, JSON_FORCE_OBJECT),
),
"/watermark/image"
);
} | php | public function createImageWatermark($name, $content, $options = array())
{
list($config, $maxWidthInPixel, $maxHeightInPixel,
$sizingPolicy, $verticalAlignment, $horizontalAlignment,
$verticalOffsetInPixel, $horizontalOffsetInPixel) = $this->parseOptions(
$options,
'config',
'maxWidthInPixel',
'maxHeightInPixel',
'sizingPolicy',
'verticalAlignment',
'horizontalAlignment',
'verticalOffsetInPixel',
'horizontalOffsetInPixel'
);
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
if (empty($content)) {
throw new BceClientException("The parameter content "
. "should NOT be null or empty string");
}
$body = array(
'name' => $name,
'content' => $content,
);
$size = array();
if ($maxWidthInPixel !== null) {
$size['maxWidthInPixel'] = $maxWidthInPixel;
}
if ($maxHeightInPixel !== null) {
$size['maxHeightInPixel'] = $maxHeightInPixel;
}
if ($sizingPolicy !== null) {
$size['sizingPolicy'] = $sizingPolicy;
}
if (count($size) > 0) {
$body['size'] = $size;
}
$position = array();
if ($verticalAlignment !== null) {
$position['verticalAlignment'] = $verticalAlignment;
}
if ($horizontalAlignment !== null) {
$position['horizontalAlignment'] = $horizontalAlignment;
}
if ($verticalOffsetInPixel !== null) {
$position['verticalOffsetInPixel'] = $verticalOffsetInPixel;
}
if ($horizontalOffsetInPixel !== null) {
$position['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
}
if (count($position) > 0) {
$body['position'] = $position;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body, JSON_FORCE_OBJECT),
),
"/watermark/image"
);
} | [
"public",
"function",
"createImageWatermark",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"maxWidthInPixel",
",",
"$",
"maxHeightInPixel",
",",
"$",
"sizingPolicy",
"... | Create a image watermark.
@param $name string, image watermark name
@param $content string, watermark image base64 encode
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
maxWidthInPixel: number, watermark maximum width in pixel
maxHeightInPixel: number, watermark maximum Height in pixel
sizingPolicy: string, watermark size retractable policy
verticalAlignment: string, vertically aligned manner
horizontalAlignment: string, horizontal aligned manner
verticalOffsetInPixel: number, vertical offset in pixel
horizontalOffsetInPixel: number, horizontal offset in pixel
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"image",
"watermark",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1147-L1216 |
42,244 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.createTimestampWatermark | public function createTimestampWatermark($name, $options = array())
{
list($config, $timezone, $alpha, $fontFamily, $fontSizeInPoint,
$fontColor, $backgroundColor, $verticalAlignment, $horizontalAlignment,
$verticalOffsetInPixel, $horizontalOffsetInPixel) = $this->parseOptions(
$options,
'config',
'timezone',
'alpha',
'fontFamily',
'fontSizeInPoint',
'fontColor',
'backgroundColor',
'verticalAlignment',
'horizontalAlignment',
'verticalOffsetInPixel',
'horizontalOffsetInPixel'
);
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
$body = array(
'name' => $name,
);
if ($timezone !== null) {
$body['timezone'] = $timezone;
}
if ($alpha !== null) {
$body['alpha'] = $alpha;
}
$font = array();
if ($fontFamily !== null) {
$font['family'] = $fontFamily;
}
if ($fontSizeInPoint !== null) {
$font['sizeInPoint'] = $fontSizeInPoint;
}
if ($fontColor !== null) {
$font['color'] = $fontColor;
}
if (count($font) > 0) {
$body['font'] = $font;
}
$background = array();
if ($backgroundColor !== null) {
$background['color'] = $backgroundColor;
$body['background'] = $background;
}
$position = array();
if ($verticalAlignment !== null) {
$position['verticalAlignment'] = $verticalAlignment;
}
if ($horizontalAlignment !== null) {
$position['horizontalAlignment'] = $horizontalAlignment;
}
if ($verticalOffsetInPixel !== null) {
$position['verticalOffsetInPixel'] = $verticalOffsetInPixel;
}
if ($horizontalOffsetInPixel !== null) {
$position['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
}
if (count($position) > 0) {
$body['position'] = $position;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body, JSON_FORCE_OBJECT),
),
"/watermark/timestamp"
);
} | php | public function createTimestampWatermark($name, $options = array())
{
list($config, $timezone, $alpha, $fontFamily, $fontSizeInPoint,
$fontColor, $backgroundColor, $verticalAlignment, $horizontalAlignment,
$verticalOffsetInPixel, $horizontalOffsetInPixel) = $this->parseOptions(
$options,
'config',
'timezone',
'alpha',
'fontFamily',
'fontSizeInPoint',
'fontColor',
'backgroundColor',
'verticalAlignment',
'horizontalAlignment',
'verticalOffsetInPixel',
'horizontalOffsetInPixel'
);
if (empty($name)) {
throw new BceClientException("The parameter name "
. "should NOT be null or empty string");
}
$body = array(
'name' => $name,
);
if ($timezone !== null) {
$body['timezone'] = $timezone;
}
if ($alpha !== null) {
$body['alpha'] = $alpha;
}
$font = array();
if ($fontFamily !== null) {
$font['family'] = $fontFamily;
}
if ($fontSizeInPoint !== null) {
$font['sizeInPoint'] = $fontSizeInPoint;
}
if ($fontColor !== null) {
$font['color'] = $fontColor;
}
if (count($font) > 0) {
$body['font'] = $font;
}
$background = array();
if ($backgroundColor !== null) {
$background['color'] = $backgroundColor;
$body['background'] = $background;
}
$position = array();
if ($verticalAlignment !== null) {
$position['verticalAlignment'] = $verticalAlignment;
}
if ($horizontalAlignment !== null) {
$position['horizontalAlignment'] = $horizontalAlignment;
}
if ($verticalOffsetInPixel !== null) {
$position['verticalOffsetInPixel'] = $verticalOffsetInPixel;
}
if ($horizontalOffsetInPixel !== null) {
$position['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
}
if (count($position) > 0) {
$body['position'] = $position;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body, JSON_FORCE_OBJECT),
),
"/watermark/timestamp"
);
} | [
"public",
"function",
"createTimestampWatermark",
"(",
"$",
"name",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"timezone",
",",
"$",
"alpha",
",",
"$",
"fontFamily",
",",
"$",
"fontSizeInPoint",
",",
"$... | Create a timestamp watermark.
@param $name string, image watermark name
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
timezone: string, timestamp time zone
alpha: number, timestamp watermark transparency
fontFamily: string, timestamp watermark fonts
fontSizeInPoint: number, font size in point
fontColor: string, timestamp watermark font color
backgroundColor: string, background color
verticalAlignment: string, vertically aligned manner
horizontalAlignment: string, horizontal aligned manner
verticalOffsetInPixel: number, vertical offset in pixel
horizontalOffsetInPixel: number, horizontal offset in pixel
}
@return mixed
@throws BceClientException | [
"Create",
"a",
"timestamp",
"watermark",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1323-L1403 |
42,245 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getStream | public function getStream($domain, $app, $stream, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/domain/$domain/app/$app/stream/$stream"
);
} | php | public function getStream($domain, $app, $stream, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
),
"/domain/$domain/app/$app/stream/$stream"
);
} | [
"public",
"function",
"getStream",
"(",
"$",
"domain",
",",
"$",
"app",
",",
"$",
"stream",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
... | Get a stream info.
@param $domain string, name of play domain
@param $app string, name of app
@param $stream string, name of stream
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed session detail
@throws BceClientException | [
"Get",
"a",
"stream",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1507-L1531 |
42,246 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.createStream | public function createStream($domain, $options = array())
{
list($config,
$app,
$publish,
$scene,
$recording,
$notification,
$thumbnail,
$thumbnails,
$watermarks,
$destinationPushUrl
) = $this->parseOptions(
$options,
'config',
'app',
'publish',
'scene',
'recording',
'notification',
'thumbnail',
'thumbnails',
'watermarks',
'destinationPushUrl');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
$body = array();
if ($app !== null) {
$body['app'] = $app;
}
if ($publish !== null) {
$body['publish'] = $publish;
}
if ($scene !== null) {
$body['scene'] = $scene;
}
if ($recording !== null) {
$body['recording'] = $recording;
}
if ($notification !== null) {
$body['notification'] = $notification;
}
if ($thumbnail !== null) {
$body['thumbnail'] = $thumbnail;
}
if ($thumbnails !== null) {
$body['thumbnails'] = $thumbnails;
}
if ($watermarks !== null) {
$body['watermarks'] = $watermarks;
}
if ($destinationPushUrl !== null) {
$body['destinationPushUrl'] = $destinationPushUrl;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
"/domain/$domain/stream"
);
} | php | public function createStream($domain, $options = array())
{
list($config,
$app,
$publish,
$scene,
$recording,
$notification,
$thumbnail,
$thumbnails,
$watermarks,
$destinationPushUrl
) = $this->parseOptions(
$options,
'config',
'app',
'publish',
'scene',
'recording',
'notification',
'thumbnail',
'thumbnails',
'watermarks',
'destinationPushUrl');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
$body = array();
if ($app !== null) {
$body['app'] = $app;
}
if ($publish !== null) {
$body['publish'] = $publish;
}
if ($scene !== null) {
$body['scene'] = $scene;
}
if ($recording !== null) {
$body['recording'] = $recording;
}
if ($notification !== null) {
$body['notification'] = $notification;
}
if ($thumbnail !== null) {
$body['thumbnail'] = $thumbnail;
}
if ($thumbnails !== null) {
$body['thumbnails'] = $thumbnails;
}
if ($watermarks !== null) {
$body['watermarks'] = $watermarks;
}
if ($destinationPushUrl !== null) {
$body['destinationPushUrl'] = $destinationPushUrl;
}
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'body' => json_encode($body),
),
"/domain/$domain/stream"
);
} | [
"public",
"function",
"createStream",
"(",
"$",
"domain",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"app",
",",
"$",
"publish",
",",
"$",
"scene",
",",
"$",
"recording",
",",
"$",
"notification",
"... | Create a stream.
@param $domain string, name of play domain
@param $stream string, name of stream
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed session detail
@throws BceClientException | [
"Create",
"a",
"stream",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1546-L1614 |
42,247 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.listStreams | public function listStreams($domain, $options = array())
{
list($config, $status, $marker, $maxSize) = $this->parseOptions($options, 'config', 'status', 'marker', 'maxSize');
$params = array();
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if ($status !== null) {
$params['status'] = $status;
}
if ($marker !== null) {
$params['marker'] = $marker;
}
if ($maxSize !== null) {
$params['maxSize'] = $maxSize;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/domain/$domain/stream"
);
} | php | public function listStreams($domain, $options = array())
{
list($config, $status, $marker, $maxSize) = $this->parseOptions($options, 'config', 'status', 'marker', 'maxSize');
$params = array();
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if ($status !== null) {
$params['status'] = $status;
}
if ($marker !== null) {
$params['marker'] = $marker;
}
if ($maxSize !== null) {
$params['maxSize'] = $maxSize;
}
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/domain/$domain/stream"
);
} | [
"public",
"function",
"listStreams",
"(",
"$",
"domain",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"status",
",",
"$",
"marker",
",",
"$",
"maxSize",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(... | List streams.
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
status: stream status, READY / ONGOING / PAUSED
marker: query marker.
maxSize: max number of listed sessions.
}
@return mixed stream list | [
"List",
"streams",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1669-L1697 |
42,248 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.pauseStream | public function pauseStream($domain, $app, $stream, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
$params = array(
'pause' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/domain/$domain/app/$app/stream/$stream"
);
} | php | public function pauseStream($domain, $app, $stream, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
$params = array(
'pause' => null,
);
return $this->sendRequest(
HttpMethod::PUT,
array(
'config' => $config,
'params' => $params,
),
"/domain/$domain/app/$app/stream/$stream"
);
} | [
"public",
"function",
"pauseStream",
"(",
"$",
"domain",
",",
"$",
"app",
",",
"$",
"stream",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
... | Pause a stream.
@param $domain string, name of play domain
@param $app string, name of app
@param $stream string, name of stream
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Pause",
"a",
"stream",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1713-L1742 |
42,249 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getDomainStatistics | public function getDomainStatistics($domain, $options = array())
{
list($config, $startDate, $endDate, $aggregate) = $this->parseOptions(
$options,
'config',
'startDate',
'endDate',
'aggregate'
);
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($startDate)) {
throw new BceClientException("The query parameter startDate "
. "should NOT be null or empty string");
}
if (empty($endDate)) {
throw new BceClientException("The query parameter endDate "
. "should NOT be null or empty string");
}
$params = array(
'startDate' => $startDate,
'endDate' => $endDate,
'aggregate' => $aggregate,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/$domain"
);
} | php | public function getDomainStatistics($domain, $options = array())
{
list($config, $startDate, $endDate, $aggregate) = $this->parseOptions(
$options,
'config',
'startDate',
'endDate',
'aggregate'
);
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($startDate)) {
throw new BceClientException("The query parameter startDate "
. "should NOT be null or empty string");
}
if (empty($endDate)) {
throw new BceClientException("The query parameter endDate "
. "should NOT be null or empty string");
}
$params = array(
'startDate' => $startDate,
'endDate' => $endDate,
'aggregate' => $aggregate,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/$domain"
);
} | [
"public",
"function",
"getDomainStatistics",
"(",
"$",
"domain",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"startDate",
",",
"$",
"endDate",
",",
"$",
"aggregate",
")",
"=",
"$",
"this",
"->",
"parse... | Get domain static info.
@param $domain string, name of play domain
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"domain",
"static",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1801-L1838 |
42,250 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getDomainSummaryStatistics | public function getDomainSummaryStatistics($options = array())
{
list($config, $startTime, $endTime) = $this->parseOptions(
$options,
'config',
'startTime',
'endTime'
);
if (empty($startTime)) {
throw new BceClientException("The query parameter startTime "
. "should NOT be null or empty string");
}
if (empty($endTime)) {
throw new BceClientException("The query parameter endTime "
. "should NOT be null or empty string");
}
$params = array(
'startTime' => $startTime,
'endTime' => $endTime,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/summary"
);
} | php | public function getDomainSummaryStatistics($options = array())
{
list($config, $startTime, $endTime) = $this->parseOptions(
$options,
'config',
'startTime',
'endTime'
);
if (empty($startTime)) {
throw new BceClientException("The query parameter startTime "
. "should NOT be null or empty string");
}
if (empty($endTime)) {
throw new BceClientException("The query parameter endTime "
. "should NOT be null or empty string");
}
$params = array(
'startTime' => $startTime,
'endTime' => $endTime,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/summary"
);
} | [
"public",
"function",
"getDomainSummaryStatistics",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"startTime",
",",
"$",
"endTime",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
",",
"'... | Get domain summary static info.
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"domain",
"summary",
"static",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1851-L1882 |
42,251 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.listDomainStatistics | public function listDomainStatistics($options = array())
{
list($config, $startTime, $endTime, $keywordType, $keyword, $orderBy) = $this->parseOptions(
$options,
'config',
'startTime',
'endTime',
'keywordType',
'keyword',
'orderBy'
);
if (empty($startTime)) {
throw new BceClientException("The query parameter startTime "
. "should NOT be null or empty string");
}
if (empty($endTime)) {
throw new BceClientException("The query parameter endTime "
. "should NOT be null or empty string");
}
$params = array(
'startTime' => $startTime,
'endTime' => $endTime,
'keywordType' => $keywordType,
'keyword' => $keyword,
'orderBy' => $orderBy,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/list"
);
} | php | public function listDomainStatistics($options = array())
{
list($config, $startTime, $endTime, $keywordType, $keyword, $orderBy) = $this->parseOptions(
$options,
'config',
'startTime',
'endTime',
'keywordType',
'keyword',
'orderBy'
);
if (empty($startTime)) {
throw new BceClientException("The query parameter startTime "
. "should NOT be null or empty string");
}
if (empty($endTime)) {
throw new BceClientException("The query parameter endTime "
. "should NOT be null or empty string");
}
$params = array(
'startTime' => $startTime,
'endTime' => $endTime,
'keywordType' => $keywordType,
'keyword' => $keyword,
'orderBy' => $orderBy,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/list"
);
} | [
"public",
"function",
"listDomainStatistics",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"startTime",
",",
"$",
"endTime",
",",
"$",
"keywordType",
",",
"$",
"keyword",
",",
"$",
"orderBy",
")",
"=",
... | List domain static info.
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"List",
"domain",
"static",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1895-L1932 |
42,252 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getStreamStatistics | public function getStreamStatistics($domain, $app, $stream, $options = array())
{
list($config, $startDate, $endDate, $aggregate) = $this->parseOptions(
$options,
'config',
'startDate',
'endDate',
'aggregate'
);
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
if (empty($startDate)) {
throw new BceClientException("The query parameter startDate "
. "should NOT be null or empty string");
}
if (empty($endDate)) {
throw new BceClientException("The query parameter endDate "
. "should NOT be null or empty string");
}
$params = array(
'startDate' => $startDate,
'endDate' => $endDate,
'aggregate' => $aggregate,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/$domain/app/$app/stream/$stream"
);
} | php | public function getStreamStatistics($domain, $app, $stream, $options = array())
{
list($config, $startDate, $endDate, $aggregate) = $this->parseOptions(
$options,
'config',
'startDate',
'endDate',
'aggregate'
);
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
if (empty($startDate)) {
throw new BceClientException("The query parameter startDate "
. "should NOT be null or empty string");
}
if (empty($endDate)) {
throw new BceClientException("The query parameter endDate "
. "should NOT be null or empty string");
}
$params = array(
'startDate' => $startDate,
'endDate' => $endDate,
'aggregate' => $aggregate,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/$domain/app/$app/stream/$stream"
);
} | [
"public",
"function",
"getStreamStatistics",
"(",
"$",
"domain",
",",
"$",
"app",
",",
"$",
"stream",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"startDate",
",",
"$",
"endDate",
",",
"$",
"aggregate"... | Get stream static info.
@param $domain string, name of play domain
@param $app string, name of app
@param $stream string, name of stream
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"stream",
"static",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L1948-L1994 |
42,253 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.listStreamStatistics | public function listStreamStatistics($domain, $options = array())
{
list($config, $app, $startTime, $endTime, $pageNo, $pageSize,
$keywordType, $keyword, $orderBy) = $this->parseOptions(
$options,
'config',
'app',
'startTime',
'endTime',
'pageNo',
'pageSize',
'keywordType',
'keyword',
'orderBy'
);
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($startTime)) {
throw new BceClientException("The query parameter startTime "
. "should NOT be null or empty string");
}
if (empty($endTime)) {
throw new BceClientException("The query parameter endTime "
. "should NOT be null or empty string");
}
$params = array(
'app' => $app,
'startTime' => $startTime,
'endTime' => $endTime,
'pageNo' => $pageNo,
'pageSize' => $pageSize,
'keywordType' => $keywordType,
'keyword' => $keyword,
'orderBy' => $orderBy,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/$domain/stream"
);
} | php | public function listStreamStatistics($domain, $options = array())
{
list($config, $app, $startTime, $endTime, $pageNo, $pageSize,
$keywordType, $keyword, $orderBy) = $this->parseOptions(
$options,
'config',
'app',
'startTime',
'endTime',
'pageNo',
'pageSize',
'keywordType',
'keyword',
'orderBy'
);
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($startTime)) {
throw new BceClientException("The query parameter startTime "
. "should NOT be null or empty string");
}
if (empty($endTime)) {
throw new BceClientException("The query parameter endTime "
. "should NOT be null or empty string");
}
$params = array(
'app' => $app,
'startTime' => $startTime,
'endTime' => $endTime,
'pageNo' => $pageNo,
'pageSize' => $pageSize,
'keywordType' => $keywordType,
'keyword' => $keyword,
'orderBy' => $orderBy,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/statistics/domain/$domain/stream"
);
} | [
"public",
"function",
"listStreamStatistics",
"(",
"$",
"domain",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"app",
",",
"$",
"startTime",
",",
"$",
"endTime",
",",
"$",
"pageNo",
",",
"$",
"pageSize"... | List stream static info.
@param $domain string, name of play domain
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"List",
"stream",
"static",
"info",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L2008-L2056 |
42,254 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.updateWatermarksOfStream | public function updateWatermarksOfStream($domain, $app, $stream, $options = array())
{
list($config, $watermarks) = $this->parseOptions($options, 'config', 'watermarks');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
$body = array();
if (count($watermarks) > 0) {
$body['watermarks'] = $watermarks;
}
$params = array(
'watermark' => null,
);
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'params' => $params,
'body' => json_encode($body),
),
"/domain/$domain/app/$app/stream/$stream"
);
} | php | public function updateWatermarksOfStream($domain, $app, $stream, $options = array())
{
list($config, $watermarks) = $this->parseOptions($options, 'config', 'watermarks');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
$body = array();
if (count($watermarks) > 0) {
$body['watermarks'] = $watermarks;
}
$params = array(
'watermark' => null,
);
return $this->sendRequest(
HttpMethod::POST,
array(
'config' => $config,
'params' => $params,
'body' => json_encode($body),
),
"/domain/$domain/app/$app/stream/$stream"
);
} | [
"public",
"function",
"updateWatermarksOfStream",
"(",
"$",
"domain",
",",
"$",
"app",
",",
"$",
"stream",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
",",
"$",
"watermarks",
")",
"=",
"$",
"this",
"->",
"parseO... | Update watermark of the stream.
@param $domain string, name of play domain
@param $app string, name of app
@param $stream string, name of stream
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Update",
"watermark",
"of",
"the",
"stream",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L2394-L2430 |
42,255 | baidubce/bce-sdk-php | src/BaiduBce/Services/Lss/LssClient.php | LssClient.getRealtimeStreamSourceInfo | public function getRealtimeStreamSourceInfo($domain, $app, $stream, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
$params = array(
'sourceInfo' => null,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/domain/$domain/app/$app/stream/$stream"
);
} | php | public function getRealtimeStreamSourceInfo($domain, $app, $stream, $options = array())
{
list($config) = $this->parseOptions($options, 'config');
if (empty($domain)) {
throw new BceClientException("The parameter domain "
. "should NOT be null or empty string");
}
if (empty($app)) {
throw new BceClientException("The parameter app "
. "should NOT be null or empty string");
}
if (empty($stream)) {
throw new BceClientException("The parameter stream "
. "should NOT be null or empty string");
}
$params = array(
'sourceInfo' => null,
);
return $this->sendRequest(
HttpMethod::GET,
array(
'config' => $config,
'params' => $params,
),
"/domain/$domain/app/$app/stream/$stream"
);
} | [
"public",
"function",
"getRealtimeStreamSourceInfo",
"(",
"$",
"domain",
",",
"$",
"app",
",",
"$",
"stream",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"list",
"(",
"$",
"config",
")",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"o... | Get realtime live source info of the stream.
@param $domain string, name of play domain
@param $app string, name of app
@param $stream string, name of stream
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
}
@return mixed
@throws BceClientException | [
"Get",
"realtime",
"live",
"source",
"info",
"of",
"the",
"stream",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Services/Lss/LssClient.php#L2481-L2510 |
42,256 | baidubce/bce-sdk-php | src/BaiduBce/BceBaseClient.php | BceBaseClient.computeEndpoint | private function computeEndpoint()
{
$protocol = $this->config[BceClientConfigOptions::PROTOCOL];
if ($this->regionSupported) {
return sprintf(
'%s://%s.%s.%s',
$protocol,
$this->serviceId,
$this->config[BceClientConfigOptions::REGION],
Bce::DEFAULT_SERVICE_DOMAIN
);
} else {
return sprintf(
'%s://%s.%s',
$protocol,
$this->serviceId,
Bce::DEFAULT_SERVICE_DOMAIN
);
}
} | php | private function computeEndpoint()
{
$protocol = $this->config[BceClientConfigOptions::PROTOCOL];
if ($this->regionSupported) {
return sprintf(
'%s://%s.%s.%s',
$protocol,
$this->serviceId,
$this->config[BceClientConfigOptions::REGION],
Bce::DEFAULT_SERVICE_DOMAIN
);
} else {
return sprintf(
'%s://%s.%s',
$protocol,
$this->serviceId,
Bce::DEFAULT_SERVICE_DOMAIN
);
}
} | [
"private",
"function",
"computeEndpoint",
"(",
")",
"{",
"$",
"protocol",
"=",
"$",
"this",
"->",
"config",
"[",
"BceClientConfigOptions",
"::",
"PROTOCOL",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"regionSupported",
")",
"{",
"return",
"sprintf",
"(",
"'%s... | compute endpoint based on the configuration and service id
@return string The endpoint | [
"compute",
"endpoint",
"based",
"on",
"the",
"configuration",
"and",
"service",
"id"
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/BceBaseClient.php#L161-L180 |
42,257 | baidubce/bce-sdk-php | src/BaiduBce/Util/MimeTypes.php | MimeTypes.guessMimeType | static function guessMimeType($fileName)
{
self::$map = include(__DIR__ . "/mime.types.php");
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
return isset(self::$map[$ext]) ? self::$map[$ext] : 'application/octet-stream';
} | php | static function guessMimeType($fileName)
{
self::$map = include(__DIR__ . "/mime.types.php");
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
return isset(self::$map[$ext]) ? self::$map[$ext] : 'application/octet-stream';
} | [
"static",
"function",
"guessMimeType",
"(",
"$",
"fileName",
")",
"{",
"self",
"::",
"$",
"map",
"=",
"include",
"(",
"__DIR__",
".",
"\"/mime.types.php\"",
")",
";",
"$",
"ext",
"=",
"pathinfo",
"(",
"$",
"fileName",
",",
"PATHINFO_EXTENSION",
")",
";",
... | Guess mime-type from file name extension. Return default mime-type if guess failed.
@param string $fileName
@return string | [
"Guess",
"mime",
"-",
"type",
"from",
"file",
"name",
"extension",
".",
"Return",
"default",
"mime",
"-",
"type",
"if",
"guess",
"failed",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Util/MimeTypes.php#L30-L35 |
42,258 | baidubce/bce-sdk-php | src/BaiduBce/Log/MonoLogFactory.php | MonoLogFactory.getLogger | public function getLogger($name)
{
$logger = new Logger($name);
if ($this->handlers !== null) {
foreach ($this->handlers as $handler) {
$logger->pushHandler($handler);
}
}
return $logger;
} | php | public function getLogger($name)
{
$logger = new Logger($name);
if ($this->handlers !== null) {
foreach ($this->handlers as $handler) {
$logger->pushHandler($handler);
}
}
return $logger;
} | [
"public",
"function",
"getLogger",
"(",
"$",
"name",
")",
"{",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"this",
"->",
"handlers",
"!==",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
... | Returns \Monolog\Logger.
@param string $name the name of logger
@return \Monolog\Logger a monolog logger instance | [
"Returns",
"\\",
"Monolog",
"\\",
"Logger",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Log/MonoLogFactory.php#L50-L59 |
42,259 | baidubce/bce-sdk-php | src/BaiduBce/Util/HttpUtils.php | HttpUtils.appendUri | public static function appendUri()
{
$path = array();
foreach (func_get_args() as $arg) {
if ($arg !== null) {
$path[] = $arg;
}
}
if (count($path) > 1) {
$last = count($path) - 1;
$path[0] = rtrim($path[0], '/');
$path[$last] = ltrim($path[$last], '/');
for ($i = 1; $i < $last; ++$i) {
$path[$i] = trim($path[$i], '/');
}
}
return implode("/", $path);
} | php | public static function appendUri()
{
$path = array();
foreach (func_get_args() as $arg) {
if ($arg !== null) {
$path[] = $arg;
}
}
if (count($path) > 1) {
$last = count($path) - 1;
$path[0] = rtrim($path[0], '/');
$path[$last] = ltrim($path[$last], '/');
for ($i = 1; $i < $last; ++$i) {
$path[$i] = trim($path[$i], '/');
}
}
return implode("/", $path);
} | [
"public",
"static",
"function",
"appendUri",
"(",
")",
"{",
"$",
"path",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"arg",
")",
"{",
"if",
"(",
"$",
"arg",
"!==",
"null",
")",
"{",
"$",
"path",
"[",
"]",
... | Append the given path to the given baseUri.
<p>
This method will encode the given path but not the given baseUri. | [
"Append",
"the",
"given",
"path",
"to",
"the",
"given",
"baseUri",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Util/HttpUtils.php#L190-L208 |
42,260 | baidubce/bce-sdk-php | src/BaiduBce/Http/GuzzleLogAdapter.php | GuzzleLogAdapter.log | public function log($message, $priority = LOG_INFO, $extras = array())
{
// All guzzle logs should be DEBUG, regardless of its own priority.
if (LogFactory::isDebugEnabled()) {
// To avoid memory exhausted, truncate request or response longer than 1024 bytes.
if(strlen($extras['request']) > 1024){
$extras['request'] = substr($request, 0, 1024);
}
if(strlen($extras['response']) > 1024){
$extras['response'] = substr($response, 0, 1024);
}
$this->logger->log(LogLevel::DEBUG, $message, $extras);
}
} | php | public function log($message, $priority = LOG_INFO, $extras = array())
{
// All guzzle logs should be DEBUG, regardless of its own priority.
if (LogFactory::isDebugEnabled()) {
// To avoid memory exhausted, truncate request or response longer than 1024 bytes.
if(strlen($extras['request']) > 1024){
$extras['request'] = substr($request, 0, 1024);
}
if(strlen($extras['response']) > 1024){
$extras['response'] = substr($response, 0, 1024);
}
$this->logger->log(LogLevel::DEBUG, $message, $extras);
}
} | [
"public",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"priority",
"=",
"LOG_INFO",
",",
"$",
"extras",
"=",
"array",
"(",
")",
")",
"{",
"// All guzzle logs should be DEBUG, regardless of its own priority.",
"if",
"(",
"LogFactory",
"::",
"isDebugEnabled",
"... | Logs the message.
@param string $message the log message
@param int $priority the log level
@param array $extras extra arguments | [
"Logs",
"the",
"message",
"."
] | c3164434c8f0fe53b6ffe4479def893465137282 | https://github.com/baidubce/bce-sdk-php/blob/c3164434c8f0fe53b6ffe4479def893465137282/src/BaiduBce/Http/GuzzleLogAdapter.php#L46-L59 |
42,261 | networking/init-cms-bundle | src/EventListener/AdminTrackerListener.php | AdminTrackerListener.updateTrackedInfo | protected function updateTrackedInfo($session, $sessionKey, $trackInfoArray, $limit = 5)
{
// save the url, controller and action in the session
$value = json_decode($session->get($sessionKey), true);
if (is_null($value)) {
$value = [];
}
// add new value as first value (to the top of the stack)
array_unshift(
$value,
$trackInfoArray
);
// remove last value, if array has more than limit items
if ($limit > 0 and count($value) > $limit) {
array_pop($value);
}
// set the session value
$session->set($sessionKey, json_encode($value));
} | php | protected function updateTrackedInfo($session, $sessionKey, $trackInfoArray, $limit = 5)
{
// save the url, controller and action in the session
$value = json_decode($session->get($sessionKey), true);
if (is_null($value)) {
$value = [];
}
// add new value as first value (to the top of the stack)
array_unshift(
$value,
$trackInfoArray
);
// remove last value, if array has more than limit items
if ($limit > 0 and count($value) > $limit) {
array_pop($value);
}
// set the session value
$session->set($sessionKey, json_encode($value));
} | [
"protected",
"function",
"updateTrackedInfo",
"(",
"$",
"session",
",",
"$",
"sessionKey",
",",
"$",
"trackInfoArray",
",",
"$",
"limit",
"=",
"5",
")",
"{",
"// save the url, controller and action in the session",
"$",
"value",
"=",
"json_decode",
"(",
"$",
"sess... | update tracker info in session.
@param $session
@param string $sessionKey
@param array $trackInfoArray
@param int $limit | [
"update",
"tracker",
"info",
"in",
"session",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/AdminTrackerListener.php#L114-L134 |
42,262 | networking/init-cms-bundle | src/Admin/Model/PageAdmin.php | PageAdmin.getPageTemplates | protected function getPageTemplates()
{
$choices = [];
$templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
foreach ($templates as $key => $template) {
$choices[$template['name']] = $key;
}
return $choices;
} | php | protected function getPageTemplates()
{
$choices = [];
$templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
foreach ($templates as $key => $template) {
$choices[$template['name']] = $key;
}
return $choices;
} | [
"protected",
"function",
"getPageTemplates",
"(",
")",
"{",
"$",
"choices",
"=",
"[",
"]",
";",
"$",
"templates",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"getParameter",
"(",
"'networking_init_cms.page.templates'",
")",
";",
"foreach",
"(",
"... | Get the page templates from the configuration and create an array to use in the
choice field in the admin form.
@return array | [
"Get",
"the",
"page",
"templates",
"from",
"the",
"configuration",
"and",
"create",
"an",
"array",
"to",
"use",
"in",
"the",
"choice",
"field",
"in",
"the",
"admin",
"form",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Admin/Model/PageAdmin.php#L649-L659 |
42,263 | networking/init-cms-bundle | src/Admin/Model/PageAdmin.php | PageAdmin.getDefaultTemplate | protected function getDefaultTemplate()
{
if ($this->getSubject()->getId()) {
return $this->getSubject()->getTemplateName();
}
$templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
reset($templates);
$defaultTemplate = key($templates);
return $defaultTemplate;
} | php | protected function getDefaultTemplate()
{
if ($this->getSubject()->getId()) {
return $this->getSubject()->getTemplateName();
}
$templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
reset($templates);
$defaultTemplate = key($templates);
return $defaultTemplate;
} | [
"protected",
"function",
"getDefaultTemplate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getSubject",
"(",
")",
"->",
"getId",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getSubject",
"(",
")",
"->",
"getTemplateName",
"(",
")",
";",
"}",
"... | If there is an object get the object template variable, else get first in template array.
@return string | [
"If",
"there",
"is",
"an",
"object",
"get",
"the",
"object",
"template",
"variable",
"else",
"get",
"first",
"in",
"template",
"array",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Admin/Model/PageAdmin.php#L666-L676 |
42,264 | networking/init-cms-bundle | src/Admin/Model/PageAdmin.php | PageAdmin.getPageTemplateIcons | protected function getPageTemplateIcons()
{
$icons = [];
$templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
foreach ($templates as $key => $template) {
$icons[$key] = isset($template['icon']) ? $template['icon'] : '';
}
return $icons;
} | php | protected function getPageTemplateIcons()
{
$icons = [];
$templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
foreach ($templates as $key => $template) {
$icons[$key] = isset($template['icon']) ? $template['icon'] : '';
}
return $icons;
} | [
"protected",
"function",
"getPageTemplateIcons",
"(",
")",
"{",
"$",
"icons",
"=",
"[",
"]",
";",
"$",
"templates",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"getParameter",
"(",
"'networking_init_cms.page.templates'",
")",
";",
"foreach",
"(",
... | Get the icons which represent the templates.
@return array | [
"Get",
"the",
"icons",
"which",
"represent",
"the",
"templates",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Admin/Model/PageAdmin.php#L683-L693 |
42,265 | networking/init-cms-bundle | src/Controller/PageAdminController.php | PageAdminController.translateAction | public function translateAction(Request $request, $id, $locale)
{
/** @var PageInterface $page */
$page = $this->admin->getObject($id);
if (!$page) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
}
$language = \Locale::getDisplayLanguage($locale);
if ($request->getMethod() == 'POST') {
$pageHelper = $this->container->get('networking_init_cms.helper.page_helper');
try {
$pageCopy = $pageHelper->makeTranslationCopy($page, $locale);
$this->admin->createObjectSecurity($pageCopy);
$status = 'success';
$message = $this->translate(
'message.translation_saved',
['%language%' => $language]
);
$result = 'ok';
$html = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_translation_settings.html.twig',
['object' => $page, 'admin' => $this->admin]
);
} catch (\Exception $e) {
$status = 'error';
$message = $message = $this->translate(
'message.translation_not_saved',
['%language%' => $language, '%url%' => $page->getFullPath()]
);
$result = 'error';
$html = '';
}
if ($this->isXmlHttpRequest()) {
return $this->renderJson(
[
'result' => $result,
'status' => $status,
'html' => $html,
'message' => $message,
]
);
}
$this->get('session')->getFlashBag()->add(
'sonata_flash_'.$status,
$message
);
return $this->redirect($this->admin->generateUrl('edit', ['id' => $id]));
}
return $this->render(
'@NetworkingInitCms/PageAdmin/page_translation_copy.html.twig',
[
'action' => 'copy',
'page' => $page,
'id' => $id,
'locale' => $locale,
'language' => $language,
'admin' => $this->admin,
]
);
} | php | public function translateAction(Request $request, $id, $locale)
{
/** @var PageInterface $page */
$page = $this->admin->getObject($id);
if (!$page) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
}
$language = \Locale::getDisplayLanguage($locale);
if ($request->getMethod() == 'POST') {
$pageHelper = $this->container->get('networking_init_cms.helper.page_helper');
try {
$pageCopy = $pageHelper->makeTranslationCopy($page, $locale);
$this->admin->createObjectSecurity($pageCopy);
$status = 'success';
$message = $this->translate(
'message.translation_saved',
['%language%' => $language]
);
$result = 'ok';
$html = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_translation_settings.html.twig',
['object' => $page, 'admin' => $this->admin]
);
} catch (\Exception $e) {
$status = 'error';
$message = $message = $this->translate(
'message.translation_not_saved',
['%language%' => $language, '%url%' => $page->getFullPath()]
);
$result = 'error';
$html = '';
}
if ($this->isXmlHttpRequest()) {
return $this->renderJson(
[
'result' => $result,
'status' => $status,
'html' => $html,
'message' => $message,
]
);
}
$this->get('session')->getFlashBag()->add(
'sonata_flash_'.$status,
$message
);
return $this->redirect($this->admin->generateUrl('edit', ['id' => $id]));
}
return $this->render(
'@NetworkingInitCms/PageAdmin/page_translation_copy.html.twig',
[
'action' => 'copy',
'page' => $page,
'id' => $id,
'locale' => $locale,
'language' => $language,
'admin' => $this->admin,
]
);
} | [
"public",
"function",
"translateAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
",",
"$",
"locale",
")",
"{",
"/** @var PageInterface $page */",
"$",
"page",
"=",
"$",
"this",
"->",
"admin",
"->",
"getObject",
"(",
"$",
"id",
")",
";",
"if",
"("... | Create a copy of a page in the given local and connect the pages.
@param Request $request
@param $id
@param $locale
@return RedirectResponse|Response
@throws NotFoundHttpException | [
"Create",
"a",
"copy",
"of",
"a",
"page",
"in",
"the",
"given",
"local",
"and",
"connect",
"the",
"pages",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/PageAdminController.php#L45-L111 |
42,266 | networking/init-cms-bundle | src/Controller/PageAdminController.php | PageAdminController.linkAction | public function linkAction(Request $request, $id, $locale)
{
/** @var PageInterface $page */
$page = $this->admin->getObject($id);
if (!$page) {
throw new NotFoundHttpException(sprintf('unable to find the Page with id : %s', $id));
}
if ($request->getMethod() == 'POST') {
$linkPageId = $request->get('page');
if (!$linkPageId) {
$this->get('session')->getFlashBag()->add('sonata_flash_error', 'flash_link_error');
} else {
/** @var PageInterface $linkPage */
$linkPage = $this->admin->getObject($linkPageId);
$page->addTranslation($linkPage);
$this->admin->update($page);
if ($this->isXmlHttpRequest()) {
$html = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_translation_settings.html.twig',
['object' => $page, 'admin' => $this->admin]
);
return $this->renderJson(
[
'result' => 'ok',
'html' => $html,
]
);
}
$this->get('session')->getFlashBag()->add('sonata_flash_success', 'flash_link_success');
return new RedirectResponse($this->admin->generateUrl('edit', ['id' => $page->getId()]));
}
}
$pages = $this->admin->getModelManager()->findBy($this->admin->getClass(), ['locale' => $locale]);
if (count($pages)) {
$pages = new ArrayCollection($pages);
$originalLocale = $page->getLocale();
$pages = $pages->filter(
function (PageInterface $linkPage) use ($originalLocale) {
return !in_array($originalLocale, $linkPage->getTranslatedLocales());
}
);
}
return $this->renderWithExtraParams(
'@NetworkingInitCms/PageAdmin/page_translation_link_list.html.twig',
[
'page' => $page,
'pages' => $pages,
'locale' => $locale,
'original_language' => \Locale::getDisplayLanguage($page->getLocale()),
'language' => \Locale::getDisplayLanguage($locale),
'admin' => $this->admin,
]
);
} | php | public function linkAction(Request $request, $id, $locale)
{
/** @var PageInterface $page */
$page = $this->admin->getObject($id);
if (!$page) {
throw new NotFoundHttpException(sprintf('unable to find the Page with id : %s', $id));
}
if ($request->getMethod() == 'POST') {
$linkPageId = $request->get('page');
if (!$linkPageId) {
$this->get('session')->getFlashBag()->add('sonata_flash_error', 'flash_link_error');
} else {
/** @var PageInterface $linkPage */
$linkPage = $this->admin->getObject($linkPageId);
$page->addTranslation($linkPage);
$this->admin->update($page);
if ($this->isXmlHttpRequest()) {
$html = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_translation_settings.html.twig',
['object' => $page, 'admin' => $this->admin]
);
return $this->renderJson(
[
'result' => 'ok',
'html' => $html,
]
);
}
$this->get('session')->getFlashBag()->add('sonata_flash_success', 'flash_link_success');
return new RedirectResponse($this->admin->generateUrl('edit', ['id' => $page->getId()]));
}
}
$pages = $this->admin->getModelManager()->findBy($this->admin->getClass(), ['locale' => $locale]);
if (count($pages)) {
$pages = new ArrayCollection($pages);
$originalLocale = $page->getLocale();
$pages = $pages->filter(
function (PageInterface $linkPage) use ($originalLocale) {
return !in_array($originalLocale, $linkPage->getTranslatedLocales());
}
);
}
return $this->renderWithExtraParams(
'@NetworkingInitCms/PageAdmin/page_translation_link_list.html.twig',
[
'page' => $page,
'pages' => $pages,
'locale' => $locale,
'original_language' => \Locale::getDisplayLanguage($page->getLocale()),
'language' => \Locale::getDisplayLanguage($locale),
'admin' => $this->admin,
]
);
} | [
"public",
"function",
"linkAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
",",
"$",
"locale",
")",
"{",
"/** @var PageInterface $page */",
"$",
"page",
"=",
"$",
"this",
"->",
"admin",
"->",
"getObject",
"(",
"$",
"id",
")",
";",
"if",
"(",
"... | Link pages as translations of each other.
@param Request $request
@param $id
@param $locale
@throws NotFoundHttpException
@return RedirectResponse|Response | [
"Link",
"pages",
"as",
"translations",
"of",
"each",
"other",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/PageAdminController.php#L203-L267 |
42,267 | networking/init-cms-bundle | src/Controller/PageAdminController.php | PageAdminController.getAjaxEditResponse | protected function getAjaxEditResponse(Form $form, PageInterface $page)
{
$view = $form->createView();
// set the theme for the current Admin Form
$this->setFormTheme($view, $this->admin->getFormTheme());
$pageSettingsHtml = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_settings_fields.html.twig',
[
'action' => 'edit',
'form' => $view,
'object' => $page,
'admin' => $this->admin,
'admin_pool' => $this->get('sonata.admin.pool'),
]
);
$pageStatusSettingsHtml = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_status_settings.html.twig',
[
'action' => 'edit',
'form' => $view,
'object' => $page,
'admin' => $this->admin,
'admin_pool' => $this->get('sonata.admin.pool'),
]
);
return $this->renderJson(
[
'result' => 'ok',
'objectId' => $page->getId(),
'title' => $page->__toString(),
'messageStatus' => 'success',
'message' => $this->translate('info.page_settings_updated'),
'pageStatus' => $this->translate($page->getStatus()),
'pageStatusSettings' => $pageStatusSettingsHtml,
'pageSettings' => $pageSettingsHtml,
]
);
} | php | protected function getAjaxEditResponse(Form $form, PageInterface $page)
{
$view = $form->createView();
// set the theme for the current Admin Form
$this->setFormTheme($view, $this->admin->getFormTheme());
$pageSettingsHtml = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_settings_fields.html.twig',
[
'action' => 'edit',
'form' => $view,
'object' => $page,
'admin' => $this->admin,
'admin_pool' => $this->get('sonata.admin.pool'),
]
);
$pageStatusSettingsHtml = $this->renderView(
'@NetworkingInitCms/PageAdmin/page_status_settings.html.twig',
[
'action' => 'edit',
'form' => $view,
'object' => $page,
'admin' => $this->admin,
'admin_pool' => $this->get('sonata.admin.pool'),
]
);
return $this->renderJson(
[
'result' => 'ok',
'objectId' => $page->getId(),
'title' => $page->__toString(),
'messageStatus' => 'success',
'message' => $this->translate('info.page_settings_updated'),
'pageStatus' => $this->translate($page->getStatus()),
'pageStatusSettings' => $pageStatusSettingsHtml,
'pageSettings' => $pageSettingsHtml,
]
);
} | [
"protected",
"function",
"getAjaxEditResponse",
"(",
"Form",
"$",
"form",
",",
"PageInterface",
"$",
"page",
")",
"{",
"$",
"view",
"=",
"$",
"form",
"->",
"createView",
"(",
")",
";",
"// set the theme for the current Admin Form",
"$",
"this",
"->",
"setFormThe... | Return the json response for the ajax edit action.
@param Form $form
@param PageInterface $page
@return Response
@throws \Twig_Error_Runtime | [
"Return",
"the",
"json",
"response",
"for",
"the",
"ajax",
"edit",
"action",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/PageAdminController.php#L693-L734 |
42,268 | networking/init-cms-bundle | src/Controller/PageAdminController.php | PageAdminController.makeSnapshot | protected function makeSnapshot(PageInterface $page)
{
if (!$this->admin->isGranted('PUBLISH', $page)) {
return;
}
/** @var $pageHelper \Networking\InitCmsBundle\Helper\PageHelper */
$pageHelper = $this->get('networking_init_cms.helper.page_helper');
$pageHelper->makePageSnapshot($page);
} | php | protected function makeSnapshot(PageInterface $page)
{
if (!$this->admin->isGranted('PUBLISH', $page)) {
return;
}
/** @var $pageHelper \Networking\InitCmsBundle\Helper\PageHelper */
$pageHelper = $this->get('networking_init_cms.helper.page_helper');
$pageHelper->makePageSnapshot($page);
} | [
"protected",
"function",
"makeSnapshot",
"(",
"PageInterface",
"$",
"page",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"admin",
"->",
"isGranted",
"(",
"'PUBLISH'",
",",
"$",
"page",
")",
")",
"{",
"return",
";",
"}",
"/** @var $pageHelper \\Networking\\In... | Create a snapshot of a published page.
@param PageInterface $page | [
"Create",
"a",
"snapshot",
"of",
"a",
"published",
"page",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/PageAdminController.php#L967-L977 |
42,269 | networking/init-cms-bundle | src/Controller/PageAdminController.php | PageAdminController.getPathAction | public function getPathAction(Request $request)
{
$id = $request->get('page_id');
$getPath = $request->get('path');
$object = $this->admin->getObject($id);
if ($id && $object) {
$path = $object->getFullPath();
} else {
$path = '/';
}
$getPath = Urlizer::urlize($getPath);
return $this->renderJson(['path' => $path.$getPath]);
} | php | public function getPathAction(Request $request)
{
$id = $request->get('page_id');
$getPath = $request->get('path');
$object = $this->admin->getObject($id);
if ($id && $object) {
$path = $object->getFullPath();
} else {
$path = '/';
}
$getPath = Urlizer::urlize($getPath);
return $this->renderJson(['path' => $path.$getPath]);
} | [
"public",
"function",
"getPathAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"$",
"request",
"->",
"get",
"(",
"'page_id'",
")",
";",
"$",
"getPath",
"=",
"$",
"request",
"->",
"get",
"(",
"'path'",
")",
";",
"$",
"object",
"=",
... | Return a json array with the calculated path for a page object.
@param Request $request
@internal param string $path
@return Response | [
"Return",
"a",
"json",
"array",
"with",
"the",
"calculated",
"path",
"for",
"a",
"page",
"object",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/PageAdminController.php#L988-L1004 |
42,270 | networking/init-cms-bundle | src/Controller/XmlController.php | XmlController.sitemapAction | public function sitemapAction(Request $request, $locale)
{
$params = [];
$params['domain'] = $this->getDomainName($request);
$params['languages'] = $this->container->getParameter('networking_init_cms.page.languages');
if ($locale != '' or count($params['languages']) == 1) {
//sitemap ausgeben
if ($locale == '') { //use locale as default value
$locale = $params['languages']['locale'];
}
$page_filter = ['visibility' => 'public', 'status' => 'status_published', 'locale' => $locale];
$em = $this->getDoctrine()->getManager();
$pageClass = $this->getParameter('networking_init_cms.manager.page.class');
$params['pages'] = $em->getRepository($pageClass)->findBy($page_filter);
$params['additional_links'] = $this->getAdditionalLinks($locale);
//render xml
$response = $this->render(
'NetworkingInitCmsBundle:Sitemap:sitemap.xml.twig',
$params
);
} else {
//multilanguage site, return language overview sitemap
/* TODO , check if / how "last modified" is possible */
$response = $this->render(
'NetworkingInitCmsBundle:Sitemap:multilingual_sitemap.xml.twig',
$params
);
}
$response->headers->set('Content-Type', 'application/xml');
return $response;
} | php | public function sitemapAction(Request $request, $locale)
{
$params = [];
$params['domain'] = $this->getDomainName($request);
$params['languages'] = $this->container->getParameter('networking_init_cms.page.languages');
if ($locale != '' or count($params['languages']) == 1) {
//sitemap ausgeben
if ($locale == '') { //use locale as default value
$locale = $params['languages']['locale'];
}
$page_filter = ['visibility' => 'public', 'status' => 'status_published', 'locale' => $locale];
$em = $this->getDoctrine()->getManager();
$pageClass = $this->getParameter('networking_init_cms.manager.page.class');
$params['pages'] = $em->getRepository($pageClass)->findBy($page_filter);
$params['additional_links'] = $this->getAdditionalLinks($locale);
//render xml
$response = $this->render(
'NetworkingInitCmsBundle:Sitemap:sitemap.xml.twig',
$params
);
} else {
//multilanguage site, return language overview sitemap
/* TODO , check if / how "last modified" is possible */
$response = $this->render(
'NetworkingInitCmsBundle:Sitemap:multilingual_sitemap.xml.twig',
$params
);
}
$response->headers->set('Content-Type', 'application/xml');
return $response;
} | [
"public",
"function",
"sitemapAction",
"(",
"Request",
"$",
"request",
",",
"$",
"locale",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"params",
"[",
"'domain'",
"]",
"=",
"$",
"this",
"->",
"getDomainName",
"(",
"$",
"request",
")",
";",
"$",
... | Render the xml Sitemap.
@param Request $request
@return Response | [
"Render",
"the",
"xml",
"Sitemap",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/XmlController.php#L31-L65 |
42,271 | networking/init-cms-bundle | src/Controller/XmlController.php | XmlController.getDomainName | private function getDomainName(Request $request)
{
$domain = $this->container->getParameter('networking_init_cms.xml_sitemap.sitemap_url');
if ($domain == '') {
//domain is not set in config.yml
$domain = $request->getScheme().'://'.$request->getHost();
}
return $domain;
} | php | private function getDomainName(Request $request)
{
$domain = $this->container->getParameter('networking_init_cms.xml_sitemap.sitemap_url');
if ($domain == '') {
//domain is not set in config.yml
$domain = $request->getScheme().'://'.$request->getHost();
}
return $domain;
} | [
"private",
"function",
"getDomainName",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"domain",
"=",
"$",
"this",
"->",
"container",
"->",
"getParameter",
"(",
"'networking_init_cms.xml_sitemap.sitemap_url'",
")",
";",
"if",
"(",
"$",
"domain",
"==",
"''",
")... | check config for domain name, otherwise returns scheme & host. | [
"check",
"config",
"for",
"domain",
"name",
"otherwise",
"returns",
"scheme",
"&",
"host",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/XmlController.php#L86-L95 |
42,272 | networking/init-cms-bundle | src/Model/Page.php | Page.prePersist | public function prePersist()
{
$this->createdAt = $this->updatedAt = new \DateTime('now');
if (!$this->metaTitle) {
$this->setMetaTitle($this->pageName);
}
} | php | public function prePersist()
{
$this->createdAt = $this->updatedAt = new \DateTime('now');
if (!$this->metaTitle) {
$this->setMetaTitle($this->pageName);
}
} | [
"public",
"function",
"prePersist",
"(",
")",
"{",
"$",
"this",
"->",
"createdAt",
"=",
"$",
"this",
"->",
"updatedAt",
"=",
"new",
"\\",
"DateTime",
"(",
"'now'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"metaTitle",
")",
"{",
"$",
"this",
"->... | Hook on to pre-persist action. | [
"Hook",
"on",
"to",
"pre",
"-",
"persist",
"action",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L181-L188 |
42,273 | networking/init-cms-bundle | src/Model/Page.php | Page.setPageName | public function setPageName($title)
{
$this->oldTitle = $this->pageName;
$this->pageName = $title;
if ($this->pageName && $this->getContentRoute()) {
$this->getContentRoute()->setName($this->pageName);
}
return $this;
} | php | public function setPageName($title)
{
$this->oldTitle = $this->pageName;
$this->pageName = $title;
if ($this->pageName && $this->getContentRoute()) {
$this->getContentRoute()->setName($this->pageName);
}
return $this;
} | [
"public",
"function",
"setPageName",
"(",
"$",
"title",
")",
"{",
"$",
"this",
"->",
"oldTitle",
"=",
"$",
"this",
"->",
"pageName",
";",
"$",
"this",
"->",
"pageName",
"=",
"$",
"title",
";",
"if",
"(",
"$",
"this",
"->",
"pageName",
"&&",
"$",
"t... | Set pageName.
@param string $title
@return $this | [
"Set",
"pageName",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L269-L279 |
42,274 | networking/init-cms-bundle | src/Model/Page.php | Page.setStatus | public function setStatus($status)
{
if (!in_array($status, [self::STATUS_DRAFT, self::STATUS_PUBLISHED, self::STATUS_REVIEW, self::STATUS_OFFLINE])) {
throw new \InvalidArgumentException('Invalid status');
}
$this->status = $status;
return $this;
} | php | public function setStatus($status)
{
if (!in_array($status, [self::STATUS_DRAFT, self::STATUS_PUBLISHED, self::STATUS_REVIEW, self::STATUS_OFFLINE])) {
throw new \InvalidArgumentException('Invalid status');
}
$this->status = $status;
return $this;
} | [
"public",
"function",
"setStatus",
"(",
"$",
"status",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"status",
",",
"[",
"self",
"::",
"STATUS_DRAFT",
",",
"self",
"::",
"STATUS_PUBLISHED",
",",
"self",
"::",
"STATUS_REVIEW",
",",
"self",
"::",
"STATUS... | Set active.
@param string $status
@return $this
@throws \InvalidArgumentException | [
"Set",
"active",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L528-L536 |
42,275 | networking/init-cms-bundle | src/Model/Page.php | Page.setVisibility | public function setVisibility($visibility)
{
if (!in_array($visibility, [self::VISIBILITY_PROTECTED, self::VISIBILITY_PUBLIC])) {
throw new \InvalidArgumentException('Invalid visibility');
}
$this->visibility = $visibility;
return $this;
} | php | public function setVisibility($visibility)
{
if (!in_array($visibility, [self::VISIBILITY_PROTECTED, self::VISIBILITY_PUBLIC])) {
throw new \InvalidArgumentException('Invalid visibility');
}
$this->visibility = $visibility;
return $this;
} | [
"public",
"function",
"setVisibility",
"(",
"$",
"visibility",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"visibility",
",",
"[",
"self",
"::",
"VISIBILITY_PROTECTED",
",",
"self",
"::",
"VISIBILITY_PUBLIC",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
... | Set page visibility.
@param string $visibility
@return $this
@throws \InvalidArgumentException | [
"Set",
"page",
"visibility",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L557-L565 |
42,276 | networking/init-cms-bundle | src/Model/Page.php | Page.addLayoutBlock | public function addLayoutBlock(LayoutBlockInterface $layoutBlock)
{
$layoutBlock->setPage($this);
$this->layoutBlock->add($layoutBlock);
return $this;
} | php | public function addLayoutBlock(LayoutBlockInterface $layoutBlock)
{
$layoutBlock->setPage($this);
$this->layoutBlock->add($layoutBlock);
return $this;
} | [
"public",
"function",
"addLayoutBlock",
"(",
"LayoutBlockInterface",
"$",
"layoutBlock",
")",
"{",
"$",
"layoutBlock",
"->",
"setPage",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"layoutBlock",
"->",
"add",
"(",
"$",
"layoutBlock",
")",
";",
"return",
... | Add layout block.
@param LayoutBlockInterface $layoutBlock
@return $this | [
"Add",
"layout",
"block",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L698-L704 |
42,277 | networking/init-cms-bundle | src/Model/Page.php | Page.resetLayoutBlock | public function resetLayoutBlock($publishedBlocks)
{
$blocksToRemove = $this->layoutBlock->filter(function(LayoutBlock $originalBlock) use($publishedBlocks){
$toRemove = true;
foreach ($publishedBlocks as $block){
if(!$block->getId()){
$toRemove = false;
}
if($block->getId() == $originalBlock->getId()){
$toRemove = false;
}
}
return $toRemove;
});
foreach ($blocksToRemove as $block) {
$block->setNoAutoDraft(true);
$this->layoutBlock->removeElement($block);
}
} | php | public function resetLayoutBlock($publishedBlocks)
{
$blocksToRemove = $this->layoutBlock->filter(function(LayoutBlock $originalBlock) use($publishedBlocks){
$toRemove = true;
foreach ($publishedBlocks as $block){
if(!$block->getId()){
$toRemove = false;
}
if($block->getId() == $originalBlock->getId()){
$toRemove = false;
}
}
return $toRemove;
});
foreach ($blocksToRemove as $block) {
$block->setNoAutoDraft(true);
$this->layoutBlock->removeElement($block);
}
} | [
"public",
"function",
"resetLayoutBlock",
"(",
"$",
"publishedBlocks",
")",
"{",
"$",
"blocksToRemove",
"=",
"$",
"this",
"->",
"layoutBlock",
"->",
"filter",
"(",
"function",
"(",
"LayoutBlock",
"$",
"originalBlock",
")",
"use",
"(",
"$",
"publishedBlocks",
"... | Remove all layout blocks and replace with those in the
serialized page snapshot.
@param ArrayCollection $publishedBlocks | [
"Remove",
"all",
"layout",
"blocks",
"and",
"replace",
"with",
"those",
"in",
"the",
"serialized",
"page",
"snapshot",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L726-L749 |
42,278 | networking/init-cms-bundle | src/Model/Page.php | Page.getLayoutBlock | public function getLayoutBlock($zone = null)
{
if (!is_null($zone)) {
$layoutBlocks = $this->layoutBlock->filter(
function ($layoutBlock) use ($zone) {
return $layoutBlock->getZone() == $zone && $layoutBlock->isActive();
}
);
return array_merge($layoutBlocks->toArray());
}
return $this->layoutBlock;
} | php | public function getLayoutBlock($zone = null)
{
if (!is_null($zone)) {
$layoutBlocks = $this->layoutBlock->filter(
function ($layoutBlock) use ($zone) {
return $layoutBlock->getZone() == $zone && $layoutBlock->isActive();
}
);
return array_merge($layoutBlocks->toArray());
}
return $this->layoutBlock;
} | [
"public",
"function",
"getLayoutBlock",
"(",
"$",
"zone",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"zone",
")",
")",
"{",
"$",
"layoutBlocks",
"=",
"$",
"this",
"->",
"layoutBlock",
"->",
"filter",
"(",
"function",
"(",
"$",
"layou... | Get menuItem.
@param null $zone
@return \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection | [
"Get",
"menuItem",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L800-L813 |
42,279 | networking/init-cms-bundle | src/Model/Page.php | Page.setMenuItem | public function setMenuItem(MenuItemInterface $menuItem)
{
$menuItem->setPage($this);
$this->menuItem = $menuItem;
return $this;
} | php | public function setMenuItem(MenuItemInterface $menuItem)
{
$menuItem->setPage($this);
$this->menuItem = $menuItem;
return $this;
} | [
"public",
"function",
"setMenuItem",
"(",
"MenuItemInterface",
"$",
"menuItem",
")",
"{",
"$",
"menuItem",
"->",
"setPage",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"menuItem",
"=",
"$",
"menuItem",
";",
"return",
"$",
"this",
";",
"}"
] | Add menuItem.
@param MenuItemInterface $menuItem
@return $this | [
"Add",
"menuItem",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L822-L828 |
42,280 | networking/init-cms-bundle | src/Model/Page.php | Page.getRecursiveTranslations | public function getRecursiveTranslations(&$translationsArray)
{
// find all possible translations
if (!$this->getTranslations()->isEmpty()) {
foreach ($this->getTranslations() as $translation) {
if ($translation) {
// if we already meet you stop and go on with the next
$translationsArray[$translation->getLocale()] = $translation;
$translation->getRecursiveTranslations($translationsArray);
}
}
}
// find all possible originals
if (!$this->getOriginals()->isEmpty()) {
foreach ($this->getOriginals() as $translation) {
// if we already meet you stop and go on with the next
if (array_key_exists($translation->getLocale(), $translationsArray)) {
return;
}
$translationsArray[$translation->getLocale()] = $translation;
$translation->getRecursiveTranslations($translationsArray);
}
}
} | php | public function getRecursiveTranslations(&$translationsArray)
{
// find all possible translations
if (!$this->getTranslations()->isEmpty()) {
foreach ($this->getTranslations() as $translation) {
if ($translation) {
// if we already meet you stop and go on with the next
$translationsArray[$translation->getLocale()] = $translation;
$translation->getRecursiveTranslations($translationsArray);
}
}
}
// find all possible originals
if (!$this->getOriginals()->isEmpty()) {
foreach ($this->getOriginals() as $translation) {
// if we already meet you stop and go on with the next
if (array_key_exists($translation->getLocale(), $translationsArray)) {
return;
}
$translationsArray[$translation->getLocale()] = $translation;
$translation->getRecursiveTranslations($translationsArray);
}
}
} | [
"public",
"function",
"getRecursiveTranslations",
"(",
"&",
"$",
"translationsArray",
")",
"{",
"// find all possible translations",
"if",
"(",
"!",
"$",
"this",
"->",
"getTranslations",
"(",
")",
"->",
"isEmpty",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this... | Recursively search for all possible translations of this page, either originals
of this page, translations of this page or translations of the original of this page.
@param array $translationsArray
@return array | [
"Recursively",
"search",
"for",
"all",
"possible",
"translations",
"of",
"this",
"page",
"either",
"originals",
"of",
"this",
"page",
"translations",
"of",
"this",
"page",
"or",
"translations",
"of",
"the",
"original",
"of",
"this",
"page",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Model/Page.php#L1253-L1277 |
42,281 | networking/init-cms-bundle | src/EventListener/LocaleListener.php | LocaleListener.guessFrontendLocale | protected function guessFrontendLocale($locales)
{
// search for match in array
if (is_array($locales)) {
foreach ($locales as $locale) {
$match = $this->matchLocaleInAvailableLanguages($locale);
if (strlen($match) > 0) {
return $match;
}
}
} // check if locale matches in available languages
else {
$match = $this->matchLocaleInAvailableLanguages($locales);
if (strlen($match) > 0) {
return $match;
}
}
return $this->defaultLocale;
} | php | protected function guessFrontendLocale($locales)
{
// search for match in array
if (is_array($locales)) {
foreach ($locales as $locale) {
$match = $this->matchLocaleInAvailableLanguages($locale);
if (strlen($match) > 0) {
return $match;
}
}
} // check if locale matches in available languages
else {
$match = $this->matchLocaleInAvailableLanguages($locales);
if (strlen($match) > 0) {
return $match;
}
}
return $this->defaultLocale;
} | [
"protected",
"function",
"guessFrontendLocale",
"(",
"$",
"locales",
")",
"{",
"// search for match in array",
"if",
"(",
"is_array",
"(",
"$",
"locales",
")",
")",
"{",
"foreach",
"(",
"$",
"locales",
"as",
"$",
"locale",
")",
"{",
"$",
"match",
"=",
"$",... | guess frontend locale.
@param mixed $locales
@return string | [
"guess",
"frontend",
"locale",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/LocaleListener.php#L202-L221 |
42,282 | networking/init-cms-bundle | src/EventListener/LocaleListener.php | LocaleListener.matchLocaleInAvailableLanguages | protected function matchLocaleInAvailableLanguages($locale)
{
foreach ($this->availableLanguages as $language) {
// browser accept language matches an available language
if ($locale == $language['locale']) {
return $language['locale'];
}
// first part of browser accept language matches an available language
if (substr($locale, 0, 2) == substr($language['locale'], 0, 2)) {
return $language['locale'];
}
}
return false;
} | php | protected function matchLocaleInAvailableLanguages($locale)
{
foreach ($this->availableLanguages as $language) {
// browser accept language matches an available language
if ($locale == $language['locale']) {
return $language['locale'];
}
// first part of browser accept language matches an available language
if (substr($locale, 0, 2) == substr($language['locale'], 0, 2)) {
return $language['locale'];
}
}
return false;
} | [
"protected",
"function",
"matchLocaleInAvailableLanguages",
"(",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"availableLanguages",
"as",
"$",
"language",
")",
"{",
"// browser accept language matches an available language",
"if",
"(",
"$",
"locale",
"=... | try to match browser language with available languages.
@param $locale
@return string | [
"try",
"to",
"match",
"browser",
"language",
"with",
"available",
"languages",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/LocaleListener.php#L230-L244 |
42,283 | networking/init-cms-bundle | src/EventListener/LocaleListener.php | LocaleListener.getPreferredLocale | public function getPreferredLocale(Request $request)
{
$browserAcceptLanguages = $this->getBrowserAcceptLanguages($request);
if (empty($browserAcceptLanguages)) {
return $this->defaultLocale;
}
return $this->guessFrontendLocale($browserAcceptLanguages);
} | php | public function getPreferredLocale(Request $request)
{
$browserAcceptLanguages = $this->getBrowserAcceptLanguages($request);
if (empty($browserAcceptLanguages)) {
return $this->defaultLocale;
}
return $this->guessFrontendLocale($browserAcceptLanguages);
} | [
"public",
"function",
"getPreferredLocale",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"browserAcceptLanguages",
"=",
"$",
"this",
"->",
"getBrowserAcceptLanguages",
"(",
"$",
"request",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"browserAcceptLanguages",
")",
... | get preferred locale.
@param \Symfony\Component\HttpFoundation\Request $request
@return string | [
"get",
"preferred",
"locale",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/LocaleListener.php#L253-L261 |
42,284 | networking/init-cms-bundle | src/EventListener/LocaleListener.php | LocaleListener.getBrowserAcceptLanguages | public function getBrowserAcceptLanguages(Request $request)
{
$browserLanguages = [];
if (strlen($request->server->get('HTTP_ACCEPT_LANGUAGE')) == 0) {
return [];
}
$languages = $this->splitHttpAcceptHeader(
$request->server->get('HTTP_ACCEPT_LANGUAGE')
);
foreach ($languages as $lang) {
if (strstr($lang, '-')) {
$codes = explode('-', $lang);
if ($codes[0] == 'i') {
// Language not listed in ISO 639 that are not variants
// of any listed language, which can be registered with the
// i-prefix, such as i-cherokee
if (count($codes) > 1) {
$lang = $codes[1];
}
} else {
for ($i = 0, $max = count($codes); $i < $max; ++$i) {
if ($i == 0) {
$lang = strtolower($codes[0]);
} else {
$lang .= '_'.strtoupper($codes[$i]);
}
}
}
}
$browserLanguages[] = $lang;
}
return $browserLanguages;
} | php | public function getBrowserAcceptLanguages(Request $request)
{
$browserLanguages = [];
if (strlen($request->server->get('HTTP_ACCEPT_LANGUAGE')) == 0) {
return [];
}
$languages = $this->splitHttpAcceptHeader(
$request->server->get('HTTP_ACCEPT_LANGUAGE')
);
foreach ($languages as $lang) {
if (strstr($lang, '-')) {
$codes = explode('-', $lang);
if ($codes[0] == 'i') {
// Language not listed in ISO 639 that are not variants
// of any listed language, which can be registered with the
// i-prefix, such as i-cherokee
if (count($codes) > 1) {
$lang = $codes[1];
}
} else {
for ($i = 0, $max = count($codes); $i < $max; ++$i) {
if ($i == 0) {
$lang = strtolower($codes[0]);
} else {
$lang .= '_'.strtoupper($codes[$i]);
}
}
}
}
$browserLanguages[] = $lang;
}
return $browserLanguages;
} | [
"public",
"function",
"getBrowserAcceptLanguages",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"browserLanguages",
"=",
"[",
"]",
";",
"if",
"(",
"strlen",
"(",
"$",
"request",
"->",
"server",
"->",
"get",
"(",
"'HTTP_ACCEPT_LANGUAGE'",
")",
")",
"==",
... | get browser accept languages.
@param \Symfony\Component\HttpFoundation\Request $request
@return array | [
"get",
"browser",
"accept",
"languages",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/LocaleListener.php#L270-L306 |
42,285 | networking/init-cms-bundle | src/EventListener/LocaleListener.php | LocaleListener.splitHttpAcceptHeader | public function splitHttpAcceptHeader($header)
{
$values = [];
foreach (array_filter(explode(',', $header)) as $value) {
// Cut off any q-value that might come after a semi-colon
if ($pos = strpos($value, ';')) {
$q = (float) trim(substr($value, strpos($value, '=') + 1));
$value = substr($value, 0, $pos);
} else {
$q = 1;
}
if (0 < $q) {
$values[trim($value)] = $q;
}
}
arsort($values);
return array_keys($values);
} | php | public function splitHttpAcceptHeader($header)
{
$values = [];
foreach (array_filter(explode(',', $header)) as $value) {
// Cut off any q-value that might come after a semi-colon
if ($pos = strpos($value, ';')) {
$q = (float) trim(substr($value, strpos($value, '=') + 1));
$value = substr($value, 0, $pos);
} else {
$q = 1;
}
if (0 < $q) {
$values[trim($value)] = $q;
}
}
arsort($values);
return array_keys($values);
} | [
"public",
"function",
"splitHttpAcceptHeader",
"(",
"$",
"header",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_filter",
"(",
"explode",
"(",
"','",
",",
"$",
"header",
")",
")",
"as",
"$",
"value",
")",
"{",
"// Cut off any q-valu... | split http accept header.
@param string $header
@return array | [
"split",
"http",
"accept",
"header",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/LocaleListener.php#L315-L335 |
42,286 | networking/init-cms-bundle | src/Menu/FrontendMenuBuilder.php | FrontendMenuBuilder.createSubnavMenu | public function createSubnavMenu($menuName, $classes = 'nav nav-tabs nav-stacked')
{
$menu = $this->factory->createItem('root');
if ($classes) {
$menu->setChildrenAttribute('class', $classes);
}
/** @var $mainMenu Menu */
$menuIterator = $this->getSubMenu($menuName, 1);
if (!$menuIterator) {
return $menu;
}
$startDepth = 2;
$menu = $this->createMenu($menu, $menuIterator, $startDepth);
$this->showOnlyCurrentChildren($menu);
$this->setRecursiveAttribute($menu, ['class' => 'nav nav-list']);
return $menu;
} | php | public function createSubnavMenu($menuName, $classes = 'nav nav-tabs nav-stacked')
{
$menu = $this->factory->createItem('root');
if ($classes) {
$menu->setChildrenAttribute('class', $classes);
}
/** @var $mainMenu Menu */
$menuIterator = $this->getSubMenu($menuName, 1);
if (!$menuIterator) {
return $menu;
}
$startDepth = 2;
$menu = $this->createMenu($menu, $menuIterator, $startDepth);
$this->showOnlyCurrentChildren($menu);
$this->setRecursiveAttribute($menu, ['class' => 'nav nav-list']);
return $menu;
} | [
"public",
"function",
"createSubnavMenu",
"(",
"$",
"menuName",
",",
"$",
"classes",
"=",
"'nav nav-tabs nav-stacked'",
")",
"{",
"$",
"menu",
"=",
"$",
"this",
"->",
"factory",
"->",
"createItem",
"(",
"'root'",
")",
";",
"if",
"(",
"$",
"classes",
")",
... | Create frontend sub navigation on the left hand side of the screen.
@param string $menuName
@param string $classes
@return bool|\Knp\Menu\ItemInterface | [
"Create",
"frontend",
"sub",
"navigation",
"on",
"the",
"left",
"hand",
"side",
"of",
"the",
"screen",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Menu/FrontendMenuBuilder.php#L60-L82 |
42,287 | networking/init-cms-bundle | src/Menu/FrontendMenuBuilder.php | FrontendMenuBuilder.createFooterMenu | public function createFooterMenu($menuName, $classes = '')
{
$menu = $this->factory->createItem($menuName);
if ($classes) {
$menu->setChildrenAttribute('class', $classes);
}
/** @var $mainMenu Menu */
$menuIterator = $this->getFullMenu($menuName);
if (!$menuIterator) {
return $menu;
}
$startDepth = 1;
$menu = $this->createMenu($menu, $menuIterator, $startDepth);
return $menu;
} | php | public function createFooterMenu($menuName, $classes = '')
{
$menu = $this->factory->createItem($menuName);
if ($classes) {
$menu->setChildrenAttribute('class', $classes);
}
/** @var $mainMenu Menu */
$menuIterator = $this->getFullMenu($menuName);
if (!$menuIterator) {
return $menu;
}
$startDepth = 1;
$menu = $this->createMenu($menu, $menuIterator, $startDepth);
return $menu;
} | [
"public",
"function",
"createFooterMenu",
"(",
"$",
"menuName",
",",
"$",
"classes",
"=",
"''",
")",
"{",
"$",
"menu",
"=",
"$",
"this",
"->",
"factory",
"->",
"createItem",
"(",
"$",
"menuName",
")",
";",
"if",
"(",
"$",
"classes",
")",
"{",
"$",
... | Used to create a simple navigation for the footer.
@param $menuName
@param string $classes
@return \Knp\Menu\ItemInterface | [
"Used",
"to",
"create",
"a",
"simple",
"navigation",
"for",
"the",
"footer",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Menu/FrontendMenuBuilder.php#L122-L140 |
42,288 | networking/init-cms-bundle | src/Menu/FrontendMenuBuilder.php | FrontendMenuBuilder.createDropdownLangMenu | public function createDropdownLangMenu(
\Knp\Menu\ItemInterface &$menu,
array $languages,
$currentLanguage,
$route = 'networking_init_change_language'
) {
$dropdown = $menu->addChild(
$this->translator->trans('Change Language'),
['dropdown' => true, 'icon' => 'caret']
);
foreach ($languages as $language) {
$node = $dropdown->addChild(
$language['label'],
['uri' => $this->router->generate($route, ['oldLocale' => $this->request->getLocale(), 'locale' => $language['locale']])]
);
if ($language['locale'] == $currentLanguage) {
$node->setCurrent(true);
}
$node->setExtra('translation_domain', false);
}
} | php | public function createDropdownLangMenu(
\Knp\Menu\ItemInterface &$menu,
array $languages,
$currentLanguage,
$route = 'networking_init_change_language'
) {
$dropdown = $menu->addChild(
$this->translator->trans('Change Language'),
['dropdown' => true, 'icon' => 'caret']
);
foreach ($languages as $language) {
$node = $dropdown->addChild(
$language['label'],
['uri' => $this->router->generate($route, ['oldLocale' => $this->request->getLocale(), 'locale' => $language['locale']])]
);
if ($language['locale'] == $currentLanguage) {
$node->setCurrent(true);
}
$node->setExtra('translation_domain', false);
}
} | [
"public",
"function",
"createDropdownLangMenu",
"(",
"\\",
"Knp",
"\\",
"Menu",
"\\",
"ItemInterface",
"&",
"$",
"menu",
",",
"array",
"$",
"languages",
",",
"$",
"currentLanguage",
",",
"$",
"route",
"=",
"'networking_init_change_language'",
")",
"{",
"$",
"d... | Used to create nodes for the language navigation in the front- and backend.
@param \Knp\Menu\ItemInterface $menu
@param array $languages
@param $currentLanguage
@param string $route | [
"Used",
"to",
"create",
"nodes",
"for",
"the",
"language",
"navigation",
"in",
"the",
"front",
"-",
"and",
"backend",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Menu/FrontendMenuBuilder.php#L150-L172 |
42,289 | networking/init-cms-bundle | src/Controller/CRUDController.php | CRUDController.configure | public function configure()
{
parent::configure();
/** @var \Symfony\Component\HttpFoundation\Session\Session $session */
$session = $this->get('session');
switch (strtolower($this->container->getParameter('networking_init_cms.db_driver'))) {
case 'monodb':
$lastEditedSubscriber = new ODMLastEditedListener($session);
break;
case 'orm':
$lastEditedSubscriber = new ORMLastEditedListener($session);
break;
default:
$lastEditedSubscriber = false;
break;
}
if ($lastEditedSubscriber) {
$this->dispatcher->addSubscriber($lastEditedSubscriber);
}
} | php | public function configure()
{
parent::configure();
/** @var \Symfony\Component\HttpFoundation\Session\Session $session */
$session = $this->get('session');
switch (strtolower($this->container->getParameter('networking_init_cms.db_driver'))) {
case 'monodb':
$lastEditedSubscriber = new ODMLastEditedListener($session);
break;
case 'orm':
$lastEditedSubscriber = new ORMLastEditedListener($session);
break;
default:
$lastEditedSubscriber = false;
break;
}
if ($lastEditedSubscriber) {
$this->dispatcher->addSubscriber($lastEditedSubscriber);
}
} | [
"public",
"function",
"configure",
"(",
")",
"{",
"parent",
"::",
"configure",
"(",
")",
";",
"/** @var \\Symfony\\Component\\HttpFoundation\\Session\\Session $session */",
"$",
"session",
"=",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
";",
"switch",
"(",
"... | Set up the lasted edited dispatcher. | [
"Set",
"up",
"the",
"lasted",
"edited",
"dispatcher",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/CRUDController.php#L47-L69 |
42,290 | networking/init-cms-bundle | src/Controller/MediaController.php | MediaController.viewImageAction | public function viewImageAction(Request $request, $id, $format = MediaProviderInterface::FORMAT_REFERENCE)
{
$media = $this->getMedia($id);
if (!$media) {
throw new NotFoundHttpException(sprintf('unable to find the media with the id : %s', $id));
}
if (!$this->get('sonata.media.pool')->getDownloadStrategy($media)->isGranted($media, $request)) {
throw new AccessDeniedException();
}
$provider = $this->getProvider($media);
return new RedirectResponse($provider->generatePublicUrl($media, $format));
} | php | public function viewImageAction(Request $request, $id, $format = MediaProviderInterface::FORMAT_REFERENCE)
{
$media = $this->getMedia($id);
if (!$media) {
throw new NotFoundHttpException(sprintf('unable to find the media with the id : %s', $id));
}
if (!$this->get('sonata.media.pool')->getDownloadStrategy($media)->isGranted($media, $request)) {
throw new AccessDeniedException();
}
$provider = $this->getProvider($media);
return new RedirectResponse($provider->generatePublicUrl($media, $format));
} | [
"public",
"function",
"viewImageAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
",",
"$",
"format",
"=",
"MediaProviderInterface",
"::",
"FORMAT_REFERENCE",
")",
"{",
"$",
"media",
"=",
"$",
"this",
"->",
"getMedia",
"(",
"$",
"id",
")",
";",
"i... | output image direct to browser, retrieve from cache if activated.
@param Request $request
@param $id
@param string $format
@return Response | [
"output",
"image",
"direct",
"to",
"browser",
"retrieve",
"from",
"cache",
"if",
"activated",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/MediaController.php#L32-L46 |
42,291 | networking/init-cms-bundle | src/Controller/CmsHelperController.php | CmsHelperController.setAdminPortalWidthAction | public function setAdminPortalWidthAction(Request $request)
{
$size = $request->get('size', 'full');
/** @var \Networking\InitCmsBundle\Model\UserInterface $user */
$user = $this->getUser();
$status = 200;
$message = 'OK';
try {
$user->setLastActivity(new \DateTime());
$user->setAdminSetting('admin_portal_width', $size);
/** @var \FOS\UserBundle\Doctrine\UserManager $userManager */
$userManager = $this->get('fos_user.user_manager');
$userManager->updateUser($user);
} catch (\Exception $e) {
$status = 500;
$message = $e->getMessage();
}
return new JsonResponse(['message' => $message, 'size' => $size, 'admin_portal_width' => $user->getAdminSetting('admin_portal_width')], $status);
} | php | public function setAdminPortalWidthAction(Request $request)
{
$size = $request->get('size', 'full');
/** @var \Networking\InitCmsBundle\Model\UserInterface $user */
$user = $this->getUser();
$status = 200;
$message = 'OK';
try {
$user->setLastActivity(new \DateTime());
$user->setAdminSetting('admin_portal_width', $size);
/** @var \FOS\UserBundle\Doctrine\UserManager $userManager */
$userManager = $this->get('fos_user.user_manager');
$userManager->updateUser($user);
} catch (\Exception $e) {
$status = 500;
$message = $e->getMessage();
}
return new JsonResponse(['message' => $message, 'size' => $size, 'admin_portal_width' => $user->getAdminSetting('admin_portal_width')], $status);
} | [
"public",
"function",
"setAdminPortalWidthAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"size",
"=",
"$",
"request",
"->",
"get",
"(",
"'size'",
",",
"'full'",
")",
";",
"/** @var \\Networking\\InitCmsBundle\\Model\\UserInterface $user */",
"$",
"user",
"=... | Set user Admin preferred width.
@param Request $request
@return JsonResponse | [
"Set",
"user",
"Admin",
"preferred",
"width",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/CmsHelperController.php#L44-L64 |
42,292 | networking/init-cms-bundle | src/EventListener/CacheCleaner.php | CacheCleaner.cleanCache | protected function cleanCache()
{
if ($this->cleanCount < 1) {
++$this->cleanCount;
if (is_object($this->phpCache)) {
$this->phpCache->clean();
}
}
} | php | protected function cleanCache()
{
if ($this->cleanCount < 1) {
++$this->cleanCount;
if (is_object($this->phpCache)) {
$this->phpCache->clean();
}
}
} | [
"protected",
"function",
"cleanCache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cleanCount",
"<",
"1",
")",
"{",
"++",
"$",
"this",
"->",
"cleanCount",
";",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"phpCache",
")",
")",
"{",
"$",
"this"... | remove items from the cache and stop after one item. | [
"remove",
"items",
"from",
"the",
"cache",
"and",
"stop",
"after",
"one",
"item",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/EventListener/CacheCleaner.php#L73-L81 |
42,293 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.indexAction | public function indexAction(Request $request)
{
/** @var \Networking\InitCmsBundle\Lib\PhpCacheInterface $phpCache */
$phpCache = $this->get('networking_init_cms.lib.php_cache');
/** @var PageSnapshotInterface $page */
$page = $request->get('_content');
$template = $request->get('_template');
if ($template instanceof \Sensio\Bundle\FrameworkExtraBundle\Configuration\Template) {
$template = $template->getTemplate();
}
$user = $this->getUser();
if ($phpCache->isCacheable($request, $user) && $page instanceof PageSnapshotInterface) {
if (!$this->isSnapshotActive($page)) {
throw new NotFoundHttpException();
}
if ($this->getSnapshotVisibility($page) != PageInterface::VISIBILITY_PUBLIC) {
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
}
$updatedAt = $phpCache->get(sprintf('page_%s_created_at', $page->getId()));
$cacheKey = $request->getLocale().$request->getPathInfo();
if ($updatedAt != $page->getSnapshotDate()) {
$phpCache->delete($cacheKey);
}
$response = $phpCache->get($request->getLocale().$request->getPathInfo());
if (!$response || !$response instanceof Response) {
$params = $this->getPageParameters($request);
if ($params instanceof RedirectResponse) {
return $params;
}
$html = $this->renderView(
$template,
$params
);
$response = new Response($html);
$phpCache->set($cacheKey, $response);
$phpCache->set(sprintf('page_%s_created_at', $page->getId()), $page->getSnapshotDate());
} else {
$phpCache->touch($cacheKey);
$phpCache->touch(sprintf('page_%s_created_at', $page->getId()));
}
} else {
$params = $this->getPageParameters($request);
if ($params instanceof RedirectResponse) {
return $params;
}
$html = $this->renderView(
$template,
$params
);
$response = new Response($html);
}
if ($this->getPageHelper()->isAllowLocaleCookie() && !$this->getPageHelper()->isSingleLanguage()) {
$response->headers->setCookie(new Cookie('_locale', $request->getLocale()));
}
return $response;
} | php | public function indexAction(Request $request)
{
/** @var \Networking\InitCmsBundle\Lib\PhpCacheInterface $phpCache */
$phpCache = $this->get('networking_init_cms.lib.php_cache');
/** @var PageSnapshotInterface $page */
$page = $request->get('_content');
$template = $request->get('_template');
if ($template instanceof \Sensio\Bundle\FrameworkExtraBundle\Configuration\Template) {
$template = $template->getTemplate();
}
$user = $this->getUser();
if ($phpCache->isCacheable($request, $user) && $page instanceof PageSnapshotInterface) {
if (!$this->isSnapshotActive($page)) {
throw new NotFoundHttpException();
}
if ($this->getSnapshotVisibility($page) != PageInterface::VISIBILITY_PUBLIC) {
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
}
$updatedAt = $phpCache->get(sprintf('page_%s_created_at', $page->getId()));
$cacheKey = $request->getLocale().$request->getPathInfo();
if ($updatedAt != $page->getSnapshotDate()) {
$phpCache->delete($cacheKey);
}
$response = $phpCache->get($request->getLocale().$request->getPathInfo());
if (!$response || !$response instanceof Response) {
$params = $this->getPageParameters($request);
if ($params instanceof RedirectResponse) {
return $params;
}
$html = $this->renderView(
$template,
$params
);
$response = new Response($html);
$phpCache->set($cacheKey, $response);
$phpCache->set(sprintf('page_%s_created_at', $page->getId()), $page->getSnapshotDate());
} else {
$phpCache->touch($cacheKey);
$phpCache->touch(sprintf('page_%s_created_at', $page->getId()));
}
} else {
$params = $this->getPageParameters($request);
if ($params instanceof RedirectResponse) {
return $params;
}
$html = $this->renderView(
$template,
$params
);
$response = new Response($html);
}
if ($this->getPageHelper()->isAllowLocaleCookie() && !$this->getPageHelper()->isSingleLanguage()) {
$response->headers->setCookie(new Cookie('_locale', $request->getLocale()));
}
return $response;
} | [
"public",
"function",
"indexAction",
"(",
"Request",
"$",
"request",
")",
"{",
"/** @var \\Networking\\InitCmsBundle\\Lib\\PhpCacheInterface $phpCache */",
"$",
"phpCache",
"=",
"$",
"this",
"->",
"get",
"(",
"'networking_init_cms.lib.php_cache'",
")",
";",
"/** @var PageSn... | Render the page.
@param Request $request
@return Response | [
"Render",
"the",
"page",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L59-L130 |
42,294 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.getRedirect | public function getRedirect(Request $request, PageInterface $page)
{
if (method_exists($page, 'getAlias') && $page instanceof PageInterface) {
if ($alias = $page->getAlias()) {
$alias->getFullPath();
$baseUrl = $request->getBaseUrl();
$route = ContentRouteManager::generateRoute($alias->getContentRoute(), $alias->getFullPath(), '');
return new RedirectResponse($baseUrl.$route->getPath());
}
}
return false;
} | php | public function getRedirect(Request $request, PageInterface $page)
{
if (method_exists($page, 'getAlias') && $page instanceof PageInterface) {
if ($alias = $page->getAlias()) {
$alias->getFullPath();
$baseUrl = $request->getBaseUrl();
$route = ContentRouteManager::generateRoute($alias->getContentRoute(), $alias->getFullPath(), '');
return new RedirectResponse($baseUrl.$route->getPath());
}
}
return false;
} | [
"public",
"function",
"getRedirect",
"(",
"Request",
"$",
"request",
",",
"PageInterface",
"$",
"page",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"page",
",",
"'getAlias'",
")",
"&&",
"$",
"page",
"instanceof",
"PageInterface",
")",
"{",
"if",
"(",
... | Check if page is an alias for another page.
@param Request $request
@param PageInterface $page
@return bool|RedirectResponse | [
"Check",
"if",
"page",
"is",
"an",
"alias",
"for",
"another",
"page",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L140-L154 |
42,295 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.changeLanguageAction | public function changeLanguageAction(Request $request, $oldLocale, $locale)
{
$params = [];
$translationRoute = $this->getTranslationRoute($request->headers->get('referer'), $oldLocale, $locale);
$request->setLocale($locale);
if (!is_array($translationRoute)) {
$routeName = $translationRoute;
} else {
$routeName = $translationRoute['_route'];
unset($translationRoute['_route']);
foreach ($translationRoute as $key => $var) {
$params[$key] = $var;
}
}
$params['_locale'] = $locale;
$parts = parse_url($request->headers->get('referer'));
if (array_key_exists('query', $parts) && $parts['query']) {
parse_str($parts['query'], $query);
$params = array_merge($query, $params);
}
$newURL = $this->get('router')->generate($routeName, $params);
$response = new RedirectResponse($newURL);
if ($this->getPageHelper()->isAllowLocaleCookie()) {
$response->headers->setCookie(new Cookie('_locale', $locale));
}
return $response;
} | php | public function changeLanguageAction(Request $request, $oldLocale, $locale)
{
$params = [];
$translationRoute = $this->getTranslationRoute($request->headers->get('referer'), $oldLocale, $locale);
$request->setLocale($locale);
if (!is_array($translationRoute)) {
$routeName = $translationRoute;
} else {
$routeName = $translationRoute['_route'];
unset($translationRoute['_route']);
foreach ($translationRoute as $key => $var) {
$params[$key] = $var;
}
}
$params['_locale'] = $locale;
$parts = parse_url($request->headers->get('referer'));
if (array_key_exists('query', $parts) && $parts['query']) {
parse_str($parts['query'], $query);
$params = array_merge($query, $params);
}
$newURL = $this->get('router')->generate($routeName, $params);
$response = new RedirectResponse($newURL);
if ($this->getPageHelper()->isAllowLocaleCookie()) {
$response->headers->setCookie(new Cookie('_locale', $locale));
}
return $response;
} | [
"public",
"function",
"changeLanguageAction",
"(",
"Request",
"$",
"request",
",",
"$",
"oldLocale",
",",
"$",
"locale",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"translationRoute",
"=",
"$",
"this",
"->",
"getTranslationRoute",
"(",
"$",
"request... | Change language in the front end area.
@param Request $request
@param $oldLocale
@param $locale
@return RedirectResponse | [
"Change",
"language",
"in",
"the",
"front",
"end",
"area",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L282-L319 |
42,296 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.viewDraftAction | public function viewDraftAction(Request $request, $locale, $path = null)
{
$request->setLocale($locale);
return $this->changeViewMode($request, PageInterface::STATUS_DRAFT, $path);
} | php | public function viewDraftAction(Request $request, $locale, $path = null)
{
$request->setLocale($locale);
return $this->changeViewMode($request, PageInterface::STATUS_DRAFT, $path);
} | [
"public",
"function",
"viewDraftAction",
"(",
"Request",
"$",
"request",
",",
"$",
"locale",
",",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"request",
"->",
"setLocale",
"(",
"$",
"locale",
")",
";",
"return",
"$",
"this",
"->",
"changeViewMode",
"(",
"... | View the website in Draft mode.
@param Request $request
@param string $locale
@param string /null $path
@return RedirectResponse | [
"View",
"the",
"website",
"in",
"Draft",
"mode",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L330-L335 |
42,297 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.viewLiveAction | public function viewLiveAction(Request $request, $locale, $path = null)
{
$request->setLocale($locale);
return $this->changeViewMode($request, PageInterface::STATUS_PUBLISHED, $path);
} | php | public function viewLiveAction(Request $request, $locale, $path = null)
{
$request->setLocale($locale);
return $this->changeViewMode($request, PageInterface::STATUS_PUBLISHED, $path);
} | [
"public",
"function",
"viewLiveAction",
"(",
"Request",
"$",
"request",
",",
"$",
"locale",
",",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"request",
"->",
"setLocale",
"(",
"$",
"locale",
")",
";",
"return",
"$",
"this",
"->",
"changeViewMode",
"(",
"$... | View the website in Live mode.
@param Request $request
@param string $locale
@param string /null $path
@return RedirectResponse | [
"View",
"the",
"website",
"in",
"Live",
"mode",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L346-L351 |
42,298 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.changeViewMode | protected function changeViewMode(Request $request, $status, $path)
{
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_SONATA_ADMIN')) {
$message = 'Please login to carry out this action';
throw new AccessDeniedException($message);
}
$request->getSession()->set('_viewStatus', $status);
if ($path) {
$url = base64_decode($path);
} else {
$url = $this->get('router')->generate('networking_init_cms_default');
}
return $this->redirect($url);
} | php | protected function changeViewMode(Request $request, $status, $path)
{
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_SONATA_ADMIN')) {
$message = 'Please login to carry out this action';
throw new AccessDeniedException($message);
}
$request->getSession()->set('_viewStatus', $status);
if ($path) {
$url = base64_decode($path);
} else {
$url = $this->get('router')->generate('networking_init_cms_default');
}
return $this->redirect($url);
} | [
"protected",
"function",
"changeViewMode",
"(",
"Request",
"$",
"request",
",",
"$",
"status",
",",
"$",
"path",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"get",
"(",
"'security.authorization_checker'",
")",
"->",
"isGranted",
"(",
"'ROLE_SONAT... | Change the page viewing mode to live or draft.
@param Request $request
@param $status
@param $path
@return RedirectResponse
@throws AccessDeniedException | [
"Change",
"the",
"page",
"viewing",
"mode",
"to",
"live",
"or",
"draft",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L364-L380 |
42,299 | networking/init-cms-bundle | src/Controller/FrontendPageController.php | FrontendPageController.getTranslationRoute | protected function getTranslationRoute($referrer, $oldLocale, $locale)
{
/** @var $languageSwitcherHelper LanguageSwitcherHelper */
$languageSwitcherHelper = $this->get('networking_init_cms.page.helper.language_switcher');
$oldURL = $languageSwitcherHelper->getPathInfo($referrer);
return $languageSwitcherHelper->getTranslationRoute($oldURL, $oldLocale, $locale);
} | php | protected function getTranslationRoute($referrer, $oldLocale, $locale)
{
/** @var $languageSwitcherHelper LanguageSwitcherHelper */
$languageSwitcherHelper = $this->get('networking_init_cms.page.helper.language_switcher');
$oldURL = $languageSwitcherHelper->getPathInfo($referrer);
return $languageSwitcherHelper->getTranslationRoute($oldURL, $oldLocale, $locale);
} | [
"protected",
"function",
"getTranslationRoute",
"(",
"$",
"referrer",
",",
"$",
"oldLocale",
",",
"$",
"locale",
")",
"{",
"/** @var $languageSwitcherHelper LanguageSwitcherHelper */",
"$",
"languageSwitcherHelper",
"=",
"$",
"this",
"->",
"get",
"(",
"'networking_init_... | get the route for the translation of a given page, the referrer page.
@param $referrer
@param $oldLocale
@param $locale
@return array|RouteObjectInterface | [
"get",
"the",
"route",
"for",
"the",
"translation",
"of",
"a",
"given",
"page",
"the",
"referrer",
"page",
"."
] | 9c6e0f09de216e19795caac5840c197f46fde03d | https://github.com/networking/init-cms-bundle/blob/9c6e0f09de216e19795caac5840c197f46fde03d/src/Controller/FrontendPageController.php#L391-L399 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.