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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,400 | appstract/lush-http | src/Request/RequestGetters.php | RequestGetters.getParameter | public function getParameter($parameter)
{
return isset($this->getParameters()[$parameter]) ? $this->getParameters()[$parameter] : null;
} | php | public function getParameter($parameter)
{
return isset($this->getParameters()[$parameter]) ? $this->getParameters()[$parameter] : null;
} | [
"public",
"function",
"getParameter",
"(",
"$",
"parameter",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"getParameters",
"(",
")",
"[",
"$",
"parameter",
"]",
")",
"?",
"$",
"this",
"->",
"getParameters",
"(",
")",
"[",
"$",
"parameter",
"]",... | Get a specific parameter.
@param $parameter
@return mixed | [
"Get",
"a",
"specific",
"parameter",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/RequestGetters.php#L44-L47 |
34,401 | appstract/lush-http | src/Request/Adapter/CurlMock.php | CurlMock.setOptions | public function setOptions(array $curlOptions, array $lushOptions = null)
{
$this->curlOptions = $curlOptions;
$this->lushOptions = $lushOptions;
} | php | public function setOptions(array $curlOptions, array $lushOptions = null)
{
$this->curlOptions = $curlOptions;
$this->lushOptions = $lushOptions;
} | [
"public",
"function",
"setOptions",
"(",
"array",
"$",
"curlOptions",
",",
"array",
"$",
"lushOptions",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"curlOptions",
"=",
"$",
"curlOptions",
";",
"$",
"this",
"->",
"lushOptions",
"=",
"$",
"lushOptions",
";",
... | Set options array.
@param array $curlOptions
@param array $lushOptions | [
"Set",
"options",
"array",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/Adapter/CurlMock.php#L73-L77 |
34,402 | appstract/lush-http | src/Request/Adapter/CurlMock.php | CurlMock.createResponse | protected function createResponse($statusCode, $contentType)
{
switch ($statusCode) {
case 200:
case 201:
return $this->createContent($contentType);
default:
// fail on error
if ($this->curlOptions[45]) {
... | php | protected function createResponse($statusCode, $contentType)
{
switch ($statusCode) {
case 200:
case 201:
return $this->createContent($contentType);
default:
// fail on error
if ($this->curlOptions[45]) {
... | [
"protected",
"function",
"createResponse",
"(",
"$",
"statusCode",
",",
"$",
"contentType",
")",
"{",
"switch",
"(",
"$",
"statusCode",
")",
"{",
"case",
"200",
":",
"case",
"201",
":",
"return",
"$",
"this",
"->",
"createContent",
"(",
"$",
"contentType",... | Create a example response based on statuscode.
@param $statusCode
@param $contentType
@return string | [
"Create",
"a",
"example",
"response",
"based",
"on",
"statuscode",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/Adapter/CurlMock.php#L163-L177 |
34,403 | appstract/lush-http | src/Request/Adapter/CurlMock.php | CurlMock.createContent | protected function createContent($type)
{
if ($type == 'json') {
$this->headers['content_type'] = 'application/json; charset=UTF-8';
return json_encode(['url' => $this->ch, 'status' => 'ok']);
} elseif ($type == 'xml') {
$this->headers['content_type'] = 'text/xml... | php | protected function createContent($type)
{
if ($type == 'json') {
$this->headers['content_type'] = 'application/json; charset=UTF-8';
return json_encode(['url' => $this->ch, 'status' => 'ok']);
} elseif ($type == 'xml') {
$this->headers['content_type'] = 'text/xml... | [
"protected",
"function",
"createContent",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"'json'",
")",
"{",
"$",
"this",
"->",
"headers",
"[",
"'content_type'",
"]",
"=",
"'application/json; charset=UTF-8'",
";",
"return",
"json_encode",
"(",
"["... | Create sample content for response.
@param $type
@return string | [
"Create",
"sample",
"content",
"for",
"response",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/Adapter/CurlMock.php#L186-L199 |
34,404 | appstract/lush-http | src/Response/ResponseGetters.php | ResponseGetters.getResult | public function getResult()
{
if ($this->autoFormat && ! empty($this->object)) {
return $this->object;
}
return $this->content;
} | php | public function getResult()
{
if ($this->autoFormat && ! empty($this->object)) {
return $this->object;
}
return $this->content;
} | [
"public",
"function",
"getResult",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autoFormat",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"object",
")",
")",
"{",
"return",
"$",
"this",
"->",
"object",
";",
"}",
"return",
"$",
"this",
"->",
"conten... | Get the content of the result.
@return mixed | [
"Get",
"the",
"content",
"of",
"the",
"result",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Response/ResponseGetters.php#L14-L21 |
34,405 | appstract/lush-http | src/Response/LushResponse.php | LushResponse.isJson | public function isJson()
{
if (isset($this->isJson)) {
return $this->isJson;
}
// check based on content header
if (strpos($this->getHeader('content_type'), 'application/json') !== false) {
$this->isJson = true;
} else {
// check based on ... | php | public function isJson()
{
if (isset($this->isJson)) {
return $this->isJson;
}
// check based on content header
if (strpos($this->getHeader('content_type'), 'application/json') !== false) {
$this->isJson = true;
} else {
// check based on ... | [
"public",
"function",
"isJson",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"isJson",
")",
")",
"{",
"return",
"$",
"this",
"->",
"isJson",
";",
"}",
"// check based on content header",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->",
"getHe... | Check if content is json.
@return null | [
"Check",
"if",
"content",
"is",
"json",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Response/LushResponse.php#L57-L73 |
34,406 | appstract/lush-http | src/Response/LushResponse.php | LushResponse.formatContent | protected function formatContent($content)
{
if ($this->request->method == 'HEAD') {
return (object) $this->headers;
}
if ($this->isXml()) {
return json_decode($this->parseXml($content));
}
if ($this->isJson()) {
return json_decode($conte... | php | protected function formatContent($content)
{
if ($this->request->method == 'HEAD') {
return (object) $this->headers;
}
if ($this->isXml()) {
return json_decode($this->parseXml($content));
}
if ($this->isJson()) {
return json_decode($conte... | [
"protected",
"function",
"formatContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"method",
"==",
"'HEAD'",
")",
"{",
"return",
"(",
"object",
")",
"$",
"this",
"->",
"headers",
";",
"}",
"if",
"(",
"$",
"this",
... | format content.
@param $content
@return mixed | [
"format",
"content",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Response/LushResponse.php#L100-L113 |
34,407 | appstract/lush-http | src/Response/LushResponse.php | LushResponse.& | public function &__get($property)
{
$return = null;
// check if the property is present in the content object
if (isset($this->object->{ $property })) {
$return = $this->object->{ $property };
}
return $return;
} | php | public function &__get($property)
{
$return = null;
// check if the property is present in the content object
if (isset($this->object->{ $property })) {
$return = $this->object->{ $property };
}
return $return;
} | [
"public",
"function",
"&",
"__get",
"(",
"$",
"property",
")",
"{",
"$",
"return",
"=",
"null",
";",
"// check if the property is present in the content object",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"object",
"->",
"{",
"$",
"property",
"}",
")",
")",... | Magic getter for content properties.
@param $property
@return mixed | [
"Magic",
"getter",
"for",
"content",
"properties",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Response/LushResponse.php#L136-L146 |
34,408 | appstract/lush-http | src/Lush.php | Lush.url | public function url($url, $parameters = [])
{
$this->url = $url;
$this->parameters = $parameters;
return $this;
} | php | public function url($url, $parameters = [])
{
$this->url = $url;
$this->parameters = $parameters;
return $this;
} | [
"public",
"function",
"url",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"url",
";",
"$",
"this",
"->",
"parameters",
"=",
"$",
"parameters",
";",
"return",
"$",
"this",
";",
"}"
] | Set the url with parameters.
@param $url
@param array|object $parameters
@return $this | [
"Set",
"the",
"url",
"with",
"parameters",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Lush.php#L49-L55 |
34,409 | appstract/lush-http | src/Lush.php | Lush.reset | public function reset()
{
$this->url = '';
$this->parameters = [];
$this->headers = [];
$this->options = [];
return $this;
} | php | public function reset()
{
$this->url = '';
$this->parameters = [];
$this->headers = [];
$this->options = [];
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"''",
";",
"$",
"this",
"->",
"parameters",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"headers",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"options",
"=",
"[",
"]",
";",
"... | Reset all request options.
@return $this | [
"Reset",
"all",
"request",
"options",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Lush.php#L90-L98 |
34,410 | appstract/lush-http | src/Lush.php | Lush.addOption | protected function addOption($name, $value)
{
$this->baseload['options'] = array_merge($this->baseload['options'], [$name => $value]);
} | php | protected function addOption($name, $value)
{
$this->baseload['options'] = array_merge($this->baseload['options'], [$name => $value]);
} | [
"protected",
"function",
"addOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"baseload",
"[",
"'options'",
"]",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"baseload",
"[",
"'options'",
"]",
",",
"[",
"$",
"name",
"=>",
"$"... | Add option.
@param $name
@param $value | [
"Add",
"option",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Lush.php#L182-L185 |
34,411 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.formatUrl | protected function formatUrl()
{
// append trailing slash to the
// baseUrl if it is missing
if (! empty($this->payload['base_url']) && substr($this->payload['base_url'], -1) !== '/') {
$this->payload['base_url'] = $this->payload['base_url'].'/';
}
// append the ... | php | protected function formatUrl()
{
// append trailing slash to the
// baseUrl if it is missing
if (! empty($this->payload['base_url']) && substr($this->payload['base_url'], -1) !== '/') {
$this->payload['base_url'] = $this->payload['base_url'].'/';
}
// append the ... | [
"protected",
"function",
"formatUrl",
"(",
")",
"{",
"// append trailing slash to the",
"// baseUrl if it is missing",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"payload",
"[",
"'base_url'",
"]",
")",
"&&",
"substr",
"(",
"$",
"this",
"->",
"payload",
"... | Format url. | [
"Format",
"url",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L51-L61 |
34,412 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.validateInput | protected function validateInput()
{
if (! filter_var($this->payload['url'], FILTER_VALIDATE_URL)) {
throw new LushException('URL is invalid', 100);
}
if (! in_array($this->method, $this->allowedMethods)) {
throw new LushException(sprintf("Method '%s' is not supporte... | php | protected function validateInput()
{
if (! filter_var($this->payload['url'], FILTER_VALIDATE_URL)) {
throw new LushException('URL is invalid', 100);
}
if (! in_array($this->method, $this->allowedMethods)) {
throw new LushException(sprintf("Method '%s' is not supporte... | [
"protected",
"function",
"validateInput",
"(",
")",
"{",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"this",
"->",
"payload",
"[",
"'url'",
"]",
",",
"FILTER_VALIDATE_URL",
")",
")",
"{",
"throw",
"new",
"LushException",
"(",
"'URL is invalid'",
",",
"100",
")... | Validate given options. | [
"Validate",
"given",
"options",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L66-L75 |
34,413 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.addHeaders | protected function addHeaders()
{
$userHeaders = array_map(function ($key, $value) {
// format header like this 'x-header: value'
return sprintf('%s: %s', $key, $value);
}, array_keys($this->payload['headers']), $this->payload['headers']);
$headers = array_merge($thi... | php | protected function addHeaders()
{
$userHeaders = array_map(function ($key, $value) {
// format header like this 'x-header: value'
return sprintf('%s: %s', $key, $value);
}, array_keys($this->payload['headers']), $this->payload['headers']);
$headers = array_merge($thi... | [
"protected",
"function",
"addHeaders",
"(",
")",
"{",
"$",
"userHeaders",
"=",
"array_map",
"(",
"function",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"// format header like this 'x-header: value'",
"return",
"sprintf",
"(",
"'%s: %s'",
",",
"$",
"key",
",... | Add request headers. | [
"Add",
"request",
"headers",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L80-L90 |
34,414 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.addRequestBody | protected function addRequestBody()
{
if (! empty($this->payload['parameters'])) {
if (in_array($this->method, ['DELETE', 'PATCH', 'POST', 'PUT'])) {
$this->addCurlOption(CURLOPT_POSTFIELDS, $this->formattedRequestBody());
} elseif (is_array($this->payload['parameters... | php | protected function addRequestBody()
{
if (! empty($this->payload['parameters'])) {
if (in_array($this->method, ['DELETE', 'PATCH', 'POST', 'PUT'])) {
$this->addCurlOption(CURLOPT_POSTFIELDS, $this->formattedRequestBody());
} elseif (is_array($this->payload['parameters... | [
"protected",
"function",
"addRequestBody",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"payload",
"[",
"'parameters'",
"]",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"method",
",",
"[",
"'DELETE'",
",",
"'PATCH... | Add request body. | [
"Add",
"request",
"body",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L95-L105 |
34,415 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.formattedRequestBody | protected function formattedRequestBody()
{
if (isset($this->payload['options']['body_format']) && $this->payload['options']['body_format'] == 'json') {
return json_encode($this->payload['parameters']);
}
return http_build_query($this->payload['parameters']);
} | php | protected function formattedRequestBody()
{
if (isset($this->payload['options']['body_format']) && $this->payload['options']['body_format'] == 'json') {
return json_encode($this->payload['parameters']);
}
return http_build_query($this->payload['parameters']);
} | [
"protected",
"function",
"formattedRequestBody",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"payload",
"[",
"'options'",
"]",
"[",
"'body_format'",
"]",
")",
"&&",
"$",
"this",
"->",
"payload",
"[",
"'options'",
"]",
"[",
"'body_format'",
... | Get formatted request body based on body_format.
@return null|string | [
"Get",
"formatted",
"request",
"body",
"based",
"on",
"body_format",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L112-L119 |
34,416 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.initOptions | protected function initOptions()
{
// Set method
if ($this->method == 'POST') {
$this->addCurlOption(CURLOPT_POST, true);
} elseif (in_array($this->method, ['DELETE', 'HEAD', 'PATCH', 'PUT'])) {
if ($this->method == 'HEAD') {
$this->addCurlOption(CURLO... | php | protected function initOptions()
{
// Set method
if ($this->method == 'POST') {
$this->addCurlOption(CURLOPT_POST, true);
} elseif (in_array($this->method, ['DELETE', 'HEAD', 'PATCH', 'PUT'])) {
if ($this->method == 'HEAD') {
$this->addCurlOption(CURLO... | [
"protected",
"function",
"initOptions",
"(",
")",
"{",
"// Set method",
"if",
"(",
"$",
"this",
"->",
"method",
"==",
"'POST'",
")",
"{",
"$",
"this",
"->",
"addCurlOption",
"(",
"CURLOPT_POST",
",",
"true",
")",
";",
"}",
"elseif",
"(",
"in_array",
"(",... | Set request options. | [
"Set",
"request",
"options",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L146-L174 |
34,417 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.handleAuthentication | protected function handleAuthentication()
{
if (isset($this->payload['options']['username'], $this->payload['options']['password'])) {
$this->addCurlOption(CURLOPT_USERPWD, sprintf('%s:%s', $this->payload['options']['username'], $this->payload['options']['password']));
}
} | php | protected function handleAuthentication()
{
if (isset($this->payload['options']['username'], $this->payload['options']['password'])) {
$this->addCurlOption(CURLOPT_USERPWD, sprintf('%s:%s', $this->payload['options']['username'], $this->payload['options']['password']));
}
} | [
"protected",
"function",
"handleAuthentication",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"payload",
"[",
"'options'",
"]",
"[",
"'username'",
"]",
",",
"$",
"this",
"->",
"payload",
"[",
"'options'",
"]",
"[",
"'password'",
"]",
")",
... | Handle authentication. | [
"Handle",
"authentication",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L179-L184 |
34,418 | appstract/lush-http | src/Request/LushRequest.php | LushRequest.handleUserOptions | protected function handleUserOptions()
{
foreach ($this->payload['options'] as $option => $value) {
$resolvedOption = RequestOptions::resolve($option);
if ($resolvedOption['type'] == 'curl_option') {
$this->addCurlOption($resolvedOption['option'], $value);
... | php | protected function handleUserOptions()
{
foreach ($this->payload['options'] as $option => $value) {
$resolvedOption = RequestOptions::resolve($option);
if ($resolvedOption['type'] == 'curl_option') {
$this->addCurlOption($resolvedOption['option'], $value);
... | [
"protected",
"function",
"handleUserOptions",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"payload",
"[",
"'options'",
"]",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"$",
"resolvedOption",
"=",
"RequestOptions",
"::",
"resolve",
"(",
"$",
... | Handle user options. | [
"Handle",
"user",
"options",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/LushRequest.php#L189-L200 |
34,419 | appstract/lush-http | src/Request/CurlRequest.php | CurlRequest.makeRequest | protected function makeRequest()
{
// init Curl
$this->client->init($this->payload['url']);
$this->client->setOptions($this->curlOptions, $this->options);
// get results
$content = $this->client->execute();
$headers = $this->client->getInfo();
$response = ne... | php | protected function makeRequest()
{
// init Curl
$this->client->init($this->payload['url']);
$this->client->setOptions($this->curlOptions, $this->options);
// get results
$content = $this->client->execute();
$headers = $this->client->getInfo();
$response = ne... | [
"protected",
"function",
"makeRequest",
"(",
")",
"{",
"// init Curl",
"$",
"this",
"->",
"client",
"->",
"init",
"(",
"$",
"this",
"->",
"payload",
"[",
"'url'",
"]",
")",
";",
"$",
"this",
"->",
"client",
"->",
"setOptions",
"(",
"$",
"this",
"->",
... | Sends the Curl requests and returns result array.
@return \Appstract\LushHttp\Response\LushResponse | [
"Sends",
"the",
"Curl",
"requests",
"and",
"returns",
"result",
"array",
"."
] | 771c501e1ea6a16b6c33917f595a04e5e37ad9b7 | https://github.com/appstract/lush-http/blob/771c501e1ea6a16b6c33917f595a04e5e37ad9b7/src/Request/CurlRequest.php#L63-L91 |
34,420 | nails/module-cdn | cdn/controllers/Serve.php | Serve.serveBadSrc | protected function serveBadSrc(array $params)
{
$error = $params['error'];
$oInput = Factory::service('Input');
header('Cache-Control: no-cache, must-revalidate', true);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT', true);
header('Content-Type: application/json', true);
... | php | protected function serveBadSrc(array $params)
{
$error = $params['error'];
$oInput = Factory::service('Input');
header('Cache-Control: no-cache, must-revalidate', true);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT', true);
header('Content-Type: application/json', true);
... | [
"protected",
"function",
"serveBadSrc",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"error",
"=",
"$",
"params",
"[",
"'error'",
"]",
";",
"$",
"oInput",
"=",
"Factory",
"::",
"service",
"(",
"'Input'",
")",
";",
"header",
"(",
"'Cache-Control: no-cache, m... | Serves a response for bad requests
@param array $params
@internal param string $error The error which occurred | [
"Serves",
"a",
"response",
"for",
"bad",
"requests"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/cdn/controllers/Serve.php#L260-L291 |
34,421 | jon48/webtrees-lib | src/Webtrees/Family.php | Family.getIntance | public static function getIntance($xref, Tree $tree, $gedcom = null){
$dfam = null;
$fam = fw\Family::getInstance($xref, $tree, $gedcom);
if($fam){
$dfam = new Family($fam);
}
return $dfam;
} | php | public static function getIntance($xref, Tree $tree, $gedcom = null){
$dfam = null;
$fam = fw\Family::getInstance($xref, $tree, $gedcom);
if($fam){
$dfam = new Family($fam);
}
return $dfam;
} | [
"public",
"static",
"function",
"getIntance",
"(",
"$",
"xref",
",",
"Tree",
"$",
"tree",
",",
"$",
"gedcom",
"=",
"null",
")",
"{",
"$",
"dfam",
"=",
"null",
";",
"$",
"fam",
"=",
"fw",
"\\",
"Family",
"::",
"getInstance",
"(",
"$",
"xref",
",",
... | Extend \Fisharebest\Webtrees\Family getInstance, in order to retrieve directly a \MyArtJaub\Webtrees\Family object
@param string $xref
@param Tree $tree
@param string $gedcom
@return NULL|\MyArtJaub\Webtrees\Family | [
"Extend",
"\\",
"Fisharebest",
"\\",
"Webtrees",
"\\",
"Family",
"getInstance",
"in",
"order",
"to",
"retrieve",
"directly",
"a",
"\\",
"MyArtJaub",
"\\",
"Webtrees",
"\\",
"Family",
"object"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Family.php#L33-L40 |
34,422 | jon48/webtrees-lib | src/Webtrees/Family.php | Family.isMarriageSourced | function isMarriageSourced(){
if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced;
$this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
return $this->is_marriage_sourced;
} | php | function isMarriageSourced(){
if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced;
$this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
return $this->is_marriage_sourced;
} | [
"function",
"isMarriageSourced",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_marriage_sourced",
"!==",
"null",
")",
"return",
"$",
"this",
"->",
"is_marriage_sourced",
";",
"$",
"this",
"->",
"is_marriage_sourced",
"=",
"$",
"this",
"->",
"isFactSourced",... | Check if this family's marriages are sourced
@return int Level of sources | [
"Check",
"if",
"this",
"family",
"s",
"marriages",
"are",
"sourced"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Family.php#L47-L51 |
34,423 | jon48/webtrees-lib | src/Webtrees/Family.php | Family.getSpouseById | public function getSpouseById(\Fisharebest\Webtrees\Individual $person) {
if ($this->gedcomrecord->getWife() &&
$person->getXref() === $this->gedcomrecord->getWife()->getXref()) {
return $this->gedcomrecord->getHusband();
} else {
return $this->gedcomrecord->getWife();
}
} | php | public function getSpouseById(\Fisharebest\Webtrees\Individual $person) {
if ($this->gedcomrecord->getWife() &&
$person->getXref() === $this->gedcomrecord->getWife()->getXref()) {
return $this->gedcomrecord->getHusband();
} else {
return $this->gedcomrecord->getWife();
}
} | [
"public",
"function",
"getSpouseById",
"(",
"\\",
"Fisharebest",
"\\",
"Webtrees",
"\\",
"Individual",
"$",
"person",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"gedcomrecord",
"->",
"getWife",
"(",
")",
"&&",
"$",
"person",
"->",
"getXref",
"(",
")",
"==="... | Find the spouse of a person, using the Xref comparison.
@param Individual $person
@return Individual|null | [
"Find",
"the",
"spouse",
"of",
"a",
"person",
"using",
"the",
"Xref",
"comparison",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Family.php#L60-L67 |
34,424 | kadet1090/KeyLighter | Language/GreedyLanguage.php | GreedyLanguage.parse | public function parse($tokens = null, $additional = [], $embedded = false)
{
if (is_string($tokens)) {
$tokens = $this->tokenize($tokens, $additional, $embedded);
} elseif (!$tokens instanceof TokenIterator) {
// Todo: Own Exceptions
throw new \InvalidArgumentExce... | php | public function parse($tokens = null, $additional = [], $embedded = false)
{
if (is_string($tokens)) {
$tokens = $this->tokenize($tokens, $additional, $embedded);
} elseif (!$tokens instanceof TokenIterator) {
// Todo: Own Exceptions
throw new \InvalidArgumentExce... | [
"public",
"function",
"parse",
"(",
"$",
"tokens",
"=",
"null",
",",
"$",
"additional",
"=",
"[",
"]",
",",
"$",
"embedded",
"=",
"false",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"tokens",
")",
")",
"{",
"$",
"tokens",
"=",
"$",
"this",
"->",... | Parses source and removes wrong tokens.
@param TokenIterator|string $tokens
@param array $additional
@param bool $embedded
@return Tokens
@throws \InvalidArgumentException | [
"Parses",
"source",
"and",
"removes",
"wrong",
"tokens",
"."
] | 6aac402b7fe0170edf3c5afbae652009951068af | https://github.com/kadet1090/KeyLighter/blob/6aac402b7fe0170edf3c5afbae652009951068af/Language/GreedyLanguage.php#L84-L94 |
34,425 | GrupaZero/cms | src/Gzero/Cms/Policies/ContentPolicy.php | ContentPolicy.viewOnFrontend | public function viewOnFrontend(User $user, Content $content)
{
if ($content->canBeShown()) {
return true;
}
return ($content->author->id === $user->id);
} | php | public function viewOnFrontend(User $user, Content $content)
{
if ($content->canBeShown()) {
return true;
}
return ($content->author->id === $user->id);
} | [
"public",
"function",
"viewOnFrontend",
"(",
"User",
"$",
"user",
",",
"Content",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"content",
"->",
"canBeShown",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"(",
"$",
"content",
"->",
"author",
... | Policy for viewing single unpublished element
@param User $user User trying to do it
@param Content $content Content that we're trying to update
@return boolean | [
"Policy",
"for",
"viewing",
"single",
"unpublished",
"element"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Policies/ContentPolicy.php#L84-L90 |
34,426 | Rareloop/primer-core | src/Primer/Renderable/Pattern.php | Pattern.render | public function render($showChrome = true)
{
$html = $this->template->render($this->data);
// Tidy the HTML
$parser = new Parser();
$html = $parser->indent($html);
if ($showChrome) {
return View::render('pattern', [
'title' => $this->title,
... | php | public function render($showChrome = true)
{
$html = $this->template->render($this->data);
// Tidy the HTML
$parser = new Parser();
$html = $parser->indent($html);
if ($showChrome) {
return View::render('pattern', [
'title' => $this->title,
... | [
"public",
"function",
"render",
"(",
"$",
"showChrome",
"=",
"true",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"template",
"->",
"render",
"(",
"$",
"this",
"->",
"data",
")",
";",
"// Tidy the HTML",
"$",
"parser",
"=",
"new",
"Parser",
"(",
")... | Renders the pattern
@param boolean $showChrome Whether or not the item should render descriptive chrome
@return String HTML text | [
"Renders",
"the",
"pattern"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Renderable/Pattern.php#L132-L152 |
34,427 | Rareloop/primer-core | src/Primer/Renderable/Pattern.php | Pattern.loadPatternsInPath | public static function loadPatternsInPath($path)
{
$patterns = array();
if ($handle = opendir($path)) {
while (false !== ($entry = readdir($handle))) {
$fullPath = $path . '/' . $entry;
if ($entry != '..' && $entry != '.' && is_dir($fullPath)) {
... | php | public static function loadPatternsInPath($path)
{
$patterns = array();
if ($handle = opendir($path)) {
while (false !== ($entry = readdir($handle))) {
$fullPath = $path . '/' . $entry;
if ($entry != '..' && $entry != '.' && is_dir($fullPath)) {
... | [
"public",
"static",
"function",
"loadPatternsInPath",
"(",
"$",
"path",
")",
"{",
"$",
"patterns",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"handle",
"=",
"opendir",
"(",
"$",
"path",
")",
")",
"{",
"while",
"(",
"false",
"!==",
"(",
"$",
"entr... | Helper function to load all patterns in a folder
@param String $path The path of the directory to load from
@return Array Array of all patterns loaded | [
"Helper",
"function",
"to",
"load",
"all",
"patterns",
"in",
"a",
"folder"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Renderable/Pattern.php#L162-L182 |
34,428 | locomotivemtl/charcoal-user | src/Charcoal/User/Authenticator.php | Authenticator.authenticate | public function authenticate()
{
$u = $this->authenticateBySession();
if ($u) {
return $u;
}
$u = $this->authenticateByToken();
if ($u) {
return $u;
}
return null;
} | php | public function authenticate()
{
$u = $this->authenticateBySession();
if ($u) {
return $u;
}
$u = $this->authenticateByToken();
if ($u) {
return $u;
}
return null;
} | [
"public",
"function",
"authenticate",
"(",
")",
"{",
"$",
"u",
"=",
"$",
"this",
"->",
"authenticateBySession",
"(",
")",
";",
"if",
"(",
"$",
"u",
")",
"{",
"return",
"$",
"u",
";",
"}",
"$",
"u",
"=",
"$",
"this",
"->",
"authenticateByToken",
"("... | Determine if the current user is authenticated.
The user is authenticated via _session ID_ or _auth token_.
@return \Charcoal\User\UserInterface|null Returns the authenticated user object
or NULL if not authenticated. | [
"Determine",
"if",
"the",
"current",
"user",
"is",
"authenticated",
"."
] | 86405a592379ebc2b77a7a9a7f68a85f2afe85f0 | https://github.com/locomotivemtl/charcoal-user/blob/86405a592379ebc2b77a7a9a7f68a85f2afe85f0/src/Charcoal/User/Authenticator.php#L81-L94 |
34,429 | locomotivemtl/charcoal-user | src/Charcoal/User/Authenticator.php | Authenticator.authenticateBySession | private function authenticateBySession()
{
$u = $this->userFactory()->create($this->userType());
// Call static method on user
$u = call_user_func([get_class($u), 'getAuthenticated'], $this->userFactory());
if ($u && $u->id()) {
$u->saveToSession();
return $... | php | private function authenticateBySession()
{
$u = $this->userFactory()->create($this->userType());
// Call static method on user
$u = call_user_func([get_class($u), 'getAuthenticated'], $this->userFactory());
if ($u && $u->id()) {
$u->saveToSession();
return $... | [
"private",
"function",
"authenticateBySession",
"(",
")",
"{",
"$",
"u",
"=",
"$",
"this",
"->",
"userFactory",
"(",
")",
"->",
"create",
"(",
"$",
"this",
"->",
"userType",
"(",
")",
")",
";",
"// Call static method on user",
"$",
"u",
"=",
"call_user_fun... | Attempt to authenticate a user using their session ID.
@return \Charcoal\User\UserInterface|null Returns the authenticated user object
or NULL if not authenticated. | [
"Attempt",
"to",
"authenticate",
"a",
"user",
"using",
"their",
"session",
"ID",
"."
] | 86405a592379ebc2b77a7a9a7f68a85f2afe85f0 | https://github.com/locomotivemtl/charcoal-user/blob/86405a592379ebc2b77a7a9a7f68a85f2afe85f0/src/Charcoal/User/Authenticator.php#L269-L282 |
34,430 | locomotivemtl/charcoal-user | src/Charcoal/User/Authenticator.php | Authenticator.authenticateByToken | private function authenticateByToken()
{
$tokenType = $this->tokenType();
$authToken = $this->tokenFactory()->create($tokenType);
if ($authToken->metadata()->enabled() !== true) {
return null;
}
$tokenData = $authToken->getTokenDataFromCookie();
if (!$to... | php | private function authenticateByToken()
{
$tokenType = $this->tokenType();
$authToken = $this->tokenFactory()->create($tokenType);
if ($authToken->metadata()->enabled() !== true) {
return null;
}
$tokenData = $authToken->getTokenDataFromCookie();
if (!$to... | [
"private",
"function",
"authenticateByToken",
"(",
")",
"{",
"$",
"tokenType",
"=",
"$",
"this",
"->",
"tokenType",
"(",
")",
";",
"$",
"authToken",
"=",
"$",
"this",
"->",
"tokenFactory",
"(",
")",
"->",
"create",
"(",
"$",
"tokenType",
")",
";",
"if"... | Attempt to authenticate a user using their auth token.
@return \Charcoal\User\UserInterface|null Returns the authenticated user object
or NULL if not authenticated. | [
"Attempt",
"to",
"authenticate",
"a",
"user",
"using",
"their",
"auth",
"token",
"."
] | 86405a592379ebc2b77a7a9a7f68a85f2afe85f0 | https://github.com/locomotivemtl/charcoal-user/blob/86405a592379ebc2b77a7a9a7f68a85f2afe85f0/src/Charcoal/User/Authenticator.php#L290-L317 |
34,431 | GrupaZero/cms | src/Gzero/Cms/Models/Block.php | Block.files | public function files($active = true)
{
$query = $this->morphToMany(File::class, 'uploadable')
->with('translations')
->withPivot('weight')
->orderBy('weight', 'ASC')
->withTimestamps();
if ($active) {
$query->where('is_active', '=', 1);
}
... | php | public function files($active = true)
{
$query = $this->morphToMany(File::class, 'uploadable')
->with('translations')
->withPivot('weight')
->orderBy('weight', 'ASC')
->withTimestamps();
if ($active) {
$query->where('is_active', '=', 1);
}
... | [
"public",
"function",
"files",
"(",
"$",
"active",
"=",
"true",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"morphToMany",
"(",
"File",
"::",
"class",
",",
"'uploadable'",
")",
"->",
"with",
"(",
"'translations'",
")",
"->",
"withPivot",
"(",
"'wei... | Get all of the files for the content.
@param bool $active Only active file
@return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\morphToMany | [
"Get",
"all",
"of",
"the",
"files",
"for",
"the",
"content",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Block.php#L85-L98 |
34,432 | GrupaZero/cms | src/Gzero/Cms/Models/Block.php | Block.getActiveTranslation | public function getActiveTranslation($languageCode)
{
return $this->translations->first(function ($translation) use ($languageCode) {
return $translation->is_active === true && $translation->language_code === $languageCode;
});
} | php | public function getActiveTranslation($languageCode)
{
return $this->translations->first(function ($translation) use ($languageCode) {
return $translation->is_active === true && $translation->language_code === $languageCode;
});
} | [
"public",
"function",
"getActiveTranslation",
"(",
"$",
"languageCode",
")",
"{",
"return",
"$",
"this",
"->",
"translations",
"->",
"first",
"(",
"function",
"(",
"$",
"translation",
")",
"use",
"(",
"$",
"languageCode",
")",
"{",
"return",
"$",
"translatio... | Returns active translation in specific language
@param string $languageCode Language code
@return mixed | [
"Returns",
"active",
"translation",
"in",
"specific",
"language"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Block.php#L150-L155 |
34,433 | GrupaZero/cms | src/Gzero/Cms/Models/Block.php | Block.setFilterAttribute | public function setFilterAttribute($value)
{
return ($value) ? $this->attributes['filter'] = json_encode($value) : $this->attributes['filter'] = null;
} | php | public function setFilterAttribute($value)
{
return ($value) ? $this->attributes['filter'] = json_encode($value) : $this->attributes['filter'] = null;
} | [
"public",
"function",
"setFilterAttribute",
"(",
"$",
"value",
")",
"{",
"return",
"(",
"$",
"value",
")",
"?",
"$",
"this",
"->",
"attributes",
"[",
"'filter'",
"]",
"=",
"json_encode",
"(",
"$",
"value",
")",
":",
"$",
"this",
"->",
"attributes",
"["... | Set the filter value
@param string $value filter value
@return string | [
"Set",
"the",
"filter",
"value"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Block.php#L174-L177 |
34,434 | GrupaZero/cms | src/Gzero/Cms/Models/Block.php | Block.setOptionsAttribute | public function setOptionsAttribute($value)
{
return ($value) ? $this->attributes['options'] = json_encode($value) : $this->attributes['options'] = null;
} | php | public function setOptionsAttribute($value)
{
return ($value) ? $this->attributes['options'] = json_encode($value) : $this->attributes['options'] = null;
} | [
"public",
"function",
"setOptionsAttribute",
"(",
"$",
"value",
")",
"{",
"return",
"(",
"$",
"value",
")",
"?",
"$",
"this",
"->",
"attributes",
"[",
"'options'",
"]",
"=",
"json_encode",
"(",
"$",
"value",
")",
":",
"$",
"this",
"->",
"attributes",
"... | Set the options value
@param string $value filter value
@return string | [
"Set",
"the",
"options",
"value"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Block.php#L198-L201 |
34,435 | jon48/webtrees-lib | src/Webtrees/Mvc/View/ViewBag.php | ViewBag.set | public function set($key, $value, $override = true) {
if(is_null($key)) return;
if(!$override && array_key_exists($key, $this->data)) return;
$this->data[$key] = $value;
} | php | public function set($key, $value, $override = true) {
if(is_null($key)) return;
if(!$override && array_key_exists($key, $this->data)) return;
$this->data[$key] = $value;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"override",
"=",
"true",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"return",
";",
"if",
"(",
"!",
"$",
"override",
"&&",
"array_key_exists",
"(",
"$",
"ke... | Set the value for the specified key.
Can define whether to override an existing value;
@param string $key
@param mixed $value
@param bool $override | [
"Set",
"the",
"value",
"for",
"the",
"specified",
"key",
".",
"Can",
"define",
"whether",
"to",
"override",
"an",
"existing",
"value",
";"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Mvc/View/ViewBag.php#L75-L79 |
34,436 | GrupaZero/cms | src/Gzero/Cms/BlockFinder.php | BlockFinder.getBlocksIds | public function getBlocksIds($routable, $onlyActive = false)
{
return $this->findBlocksForPath($routable, $this->getFilterArray($onlyActive));
} | php | public function getBlocksIds($routable, $onlyActive = false)
{
return $this->findBlocksForPath($routable, $this->getFilterArray($onlyActive));
} | [
"public",
"function",
"getBlocksIds",
"(",
"$",
"routable",
",",
"$",
"onlyActive",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"findBlocksForPath",
"(",
"$",
"routable",
",",
"$",
"this",
"->",
"getFilterArray",
"(",
"$",
"onlyActive",
")",
")",
... | It returns blocks ids that should be displayed on specified content
@param string|Routable $routable Routable
@param bool $onlyActive Trigger to display only active blocks
@return array | [
"It",
"returns",
"blocks",
"ids",
"that",
"should",
"be",
"displayed",
"on",
"specified",
"content"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/BlockFinder.php#L41-L44 |
34,437 | GrupaZero/cms | src/Gzero/Cms/BlockFinder.php | BlockFinder.findBlocksForPath | protected function findBlocksForPath($routable, $filter)
{
if (is_string($routable)) { // static page like "home", "contact" etc.
return $this->handleStaticPageCase($routable, $filter);
}
$ids = $routable->getTreePath();
$idsCount = count($ids);
$blockIds = [... | php | protected function findBlocksForPath($routable, $filter)
{
if (is_string($routable)) { // static page like "home", "contact" etc.
return $this->handleStaticPageCase($routable, $filter);
}
$ids = $routable->getTreePath();
$idsCount = count($ids);
$blockIds = [... | [
"protected",
"function",
"findBlocksForPath",
"(",
"$",
"routable",
",",
"$",
"filter",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"routable",
")",
")",
"{",
"// static page like \"home\", \"contact\" etc.",
"return",
"$",
"this",
"->",
"handleStaticPageCase",
"(... | Find all blocks ids that should be displayed on specific path
@param string|Routable $routable Routable path or static page named route
@param array $filter Array with all filters
@return array | [
"Find",
"all",
"blocks",
"ids",
"that",
"should",
"be",
"displayed",
"on",
"specific",
"path"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/BlockFinder.php#L54-L85 |
34,438 | GrupaZero/cms | src/Gzero/Cms/BlockFinder.php | BlockFinder.getFilterArray | protected function getFilterArray($onlyActive)
{
$cacheKey = ($onlyActive) ? 'public' : 'admin';
if ($this->cache->tags(['blocks'])->has('blocks:filter:' . $cacheKey)) {
return $this->cache->tags(['blocks'])->get('blocks:filter:' . $cacheKey);
} else {
$blocks = $this... | php | protected function getFilterArray($onlyActive)
{
$cacheKey = ($onlyActive) ? 'public' : 'admin';
if ($this->cache->tags(['blocks'])->has('blocks:filter:' . $cacheKey)) {
return $this->cache->tags(['blocks'])->get('blocks:filter:' . $cacheKey);
} else {
$blocks = $this... | [
"protected",
"function",
"getFilterArray",
"(",
"$",
"onlyActive",
")",
"{",
"$",
"cacheKey",
"=",
"(",
"$",
"onlyActive",
")",
"?",
"'public'",
":",
"'admin'",
";",
"if",
"(",
"$",
"this",
"->",
"cache",
"->",
"tags",
"(",
"[",
"'blocks'",
"]",
")",
... | It builds filter array with all blocks
@param bool $onlyActive Filter only public blocks
@return array | [
"It",
"builds",
"filter",
"array",
"with",
"all",
"blocks"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/BlockFinder.php#L94-L105 |
34,439 | GrupaZero/cms | src/Gzero/Cms/BlockFinder.php | BlockFinder.buildFilterArray | protected function buildFilterArray($blocks)
{
$filter = [];
$excluded = [];
foreach ($blocks as $block) {
$this->extractFilter($block, $filter, $excluded);
}
return ['paths' => $filter, 'excluded' => $excluded];
} | php | protected function buildFilterArray($blocks)
{
$filter = [];
$excluded = [];
foreach ($blocks as $block) {
$this->extractFilter($block, $filter, $excluded);
}
return ['paths' => $filter, 'excluded' => $excluded];
} | [
"protected",
"function",
"buildFilterArray",
"(",
"$",
"blocks",
")",
"{",
"$",
"filter",
"=",
"[",
"]",
";",
"$",
"excluded",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"blocks",
"as",
"$",
"block",
")",
"{",
"$",
"this",
"->",
"extractFilter",
"(",
... | It extracts all filters from blocks & build filter array
@param array|Collection $blocks Blocks
@return array | [
"It",
"extracts",
"all",
"filters",
"from",
"blocks",
"&",
"build",
"filter",
"array"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/BlockFinder.php#L114-L122 |
34,440 | GrupaZero/cms | src/Gzero/Cms/BlockFinder.php | BlockFinder.handleStaticPageCase | protected function handleStaticPageCase($path, $filter)
{
if (isset($filter['paths'][$path])) {
return array_keys($filter['paths'][$path] + $filter['excluded'], true, true);
}
return array_keys($filter['excluded'], true, true);
} | php | protected function handleStaticPageCase($path, $filter)
{
if (isset($filter['paths'][$path])) {
return array_keys($filter['paths'][$path] + $filter['excluded'], true, true);
}
return array_keys($filter['excluded'], true, true);
} | [
"protected",
"function",
"handleStaticPageCase",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"filter",
"[",
"'paths'",
"]",
"[",
"$",
"path",
"]",
")",
")",
"{",
"return",
"array_keys",
"(",
"$",
"filter",
"[",
"'pat... | It checks which blocks should be displayed for specific static page
@param string $path Static page named route
@param array $filter Array with all filters
@return array | [
"It",
"checks",
"which",
"blocks",
"should",
"be",
"displayed",
"for",
"specific",
"static",
"page"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/BlockFinder.php#L144-L150 |
34,441 | GrupaZero/cms | src/Gzero/Cms/BlockFinder.php | BlockFinder.extractFilter | protected function extractFilter(Block $block, array &$filter, array &$excluded)
{
if (isset($block->filter['+'])) {
foreach ($block->filter['+'] as $filterValue) {
if (isset($filter[$filterValue])) {
$filter[$filterValue][$block->id] = true;
}... | php | protected function extractFilter(Block $block, array &$filter, array &$excluded)
{
if (isset($block->filter['+'])) {
foreach ($block->filter['+'] as $filterValue) {
if (isset($filter[$filterValue])) {
$filter[$filterValue][$block->id] = true;
}... | [
"protected",
"function",
"extractFilter",
"(",
"Block",
"$",
"block",
",",
"array",
"&",
"$",
"filter",
",",
"array",
"&",
"$",
"excluded",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"block",
"->",
"filter",
"[",
"'+'",
"]",
")",
")",
"{",
"foreach",
... | It extracts filter property from single block
@param Block $block Block instance
@param array $filter Filter array
@param array $excluded Excluded array
@return void | [
"It",
"extracts",
"filter",
"property",
"from",
"single",
"block"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/BlockFinder.php#L161-L183 |
34,442 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.getResizedImageSize | static public function getResizedImageSize($file, $target=25){
list($width, $height, , ) = getimagesize($file);
$max = max($width, $height);
$rapp = $target / $max;
$width = intval($rapp * $width);
$height = intval($rapp * $height);
return array($width, $height);
} | php | static public function getResizedImageSize($file, $target=25){
list($width, $height, , ) = getimagesize($file);
$max = max($width, $height);
$rapp = $target / $max;
$width = intval($rapp * $width);
$height = intval($rapp * $height);
return array($width, $height);
} | [
"static",
"public",
"function",
"getResizedImageSize",
"(",
"$",
"file",
",",
"$",
"target",
"=",
"25",
")",
"{",
"list",
"(",
"$",
"width",
",",
"$",
"height",
",",
",",
")",
"=",
"getimagesize",
"(",
"$",
"file",
")",
";",
"$",
"max",
"=",
"max",... | Get width and heigth of an image resized in order fit a target size.
@param string $file The image to resize
@param int $target The final max width/height
@return array array of ($width, $height). One of them must be $target | [
"Get",
"width",
"and",
"heigth",
"of",
"an",
"image",
"resized",
"in",
"order",
"fit",
"a",
"target",
"size",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L75-L82 |
34,443 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.doesTableExist | public static function doesTableExist($table) {
try {
fw\Database::prepare("SELECT 1 FROM {$table}")->fetchOne();
return true;
} catch (\PDOException $ex) {
return false;
}
} | php | public static function doesTableExist($table) {
try {
fw\Database::prepare("SELECT 1 FROM {$table}")->fetchOne();
return true;
} catch (\PDOException $ex) {
return false;
}
} | [
"public",
"static",
"function",
"doesTableExist",
"(",
"$",
"table",
")",
"{",
"try",
"{",
"fw",
"\\",
"Database",
"::",
"prepare",
"(",
"\"SELECT 1 FROM {$table}\"",
")",
"->",
"fetchOne",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"\\",
"... | Checks if a table exist in the DB schema
@param string $table Name of the table to look for
@return boolean Does the table exist | [
"Checks",
"if",
"a",
"table",
"exist",
"in",
"the",
"DB",
"schema"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L91-L98 |
34,444 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.generateRandomToken | public static function generateRandomToken($length=32) {
$chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
$len_chars = count($chars);
$token = '';
for ($i = 0; $i < $length; $i++)
$token .= $chars[ mt_rand(0, $len_chars - 1) ];
# Number of 32 char chunks
$chunks ... | php | public static function generateRandomToken($length=32) {
$chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
$len_chars = count($chars);
$token = '';
for ($i = 0; $i < $length; $i++)
$token .= $chars[ mt_rand(0, $len_chars - 1) ];
# Number of 32 char chunks
$chunks ... | [
"public",
"static",
"function",
"generateRandomToken",
"(",
"$",
"length",
"=",
"32",
")",
"{",
"$",
"chars",
"=",
"str_split",
"(",
"'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'",
")",
";",
"$",
"len_chars",
"=",
"count",
"(",
"$",
"chars",
")"... | Returns a randomy generated token of a given size
@param int $length Length of the token, default to 32
@return string Random token | [
"Returns",
"a",
"randomy",
"generated",
"token",
"of",
"a",
"given",
"size"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L106-L124 |
34,445 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.getBase64EncryptionKey | protected static function getBase64EncryptionKey() {
$key = 'STANDARDKEYIFNOSERVER';
if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
return $key;
} | php | protected static function getBase64EncryptionKey() {
$key = 'STANDARDKEYIFNOSERVER';
if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
return $key;
} | [
"protected",
"static",
"function",
"getBase64EncryptionKey",
"(",
")",
"{",
"$",
"key",
"=",
"'STANDARDKEYIFNOSERVER'",
";",
"if",
"(",
"!",
"empty",
"(",
"Filter",
"::",
"server",
"(",
"'SERVER_NAME'",
")",
")",
"&&",
"!",
"empty",
"(",
"Filter",
"::",
"s... | Generate the key used by the encryption to safe base64 functions.
@return string Encryption key | [
"Generate",
"the",
"key",
"used",
"by",
"the",
"encryption",
"to",
"safe",
"base64",
"functions",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L131-L137 |
34,446 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.decryptFromSafeBase64 | public static function decryptFromSafeBase64($encrypted){
$encrypted = str_replace('-', '+', $encrypted);
$encrypted = str_replace('_', '/', $encrypted);
$encrypted = str_replace('*', '=', $encrypted);
$encrypted = base64_decode($encrypted);
if($encrypted === false)
throw new \InvalidArgumentException('The... | php | public static function decryptFromSafeBase64($encrypted){
$encrypted = str_replace('-', '+', $encrypted);
$encrypted = str_replace('_', '/', $encrypted);
$encrypted = str_replace('*', '=', $encrypted);
$encrypted = base64_decode($encrypted);
if($encrypted === false)
throw new \InvalidArgumentException('The... | [
"public",
"static",
"function",
"decryptFromSafeBase64",
"(",
"$",
"encrypted",
")",
"{",
"$",
"encrypted",
"=",
"str_replace",
"(",
"'-'",
",",
"'+'",
",",
"$",
"encrypted",
")",
";",
"$",
"encrypted",
"=",
"str_replace",
"(",
"'_'",
",",
"'/'",
",",
"$... | Decode and encrypt a text from base64 compatible with URL use
@param string $encrypted Text to decrypt
@return string Decrypted text | [
"Decode",
"and",
"encrypt",
"a",
"text",
"from",
"base64",
"compatible",
"with",
"URL",
"use"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L166-L189 |
34,447 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.isValidPath | public static function isValidPath($filename, $acceptfolder = FALSE) {
if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
return false;
} | php | public static function isValidPath($filename, $acceptfolder = FALSE) {
if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
return false;
} | [
"public",
"static",
"function",
"isValidPath",
"(",
"$",
"filename",
",",
"$",
"acceptfolder",
"=",
"FALSE",
")",
"{",
"if",
"(",
"strpbrk",
"(",
"$",
"filename",
",",
"$",
"acceptfolder",
"?",
"'?%*:|\"<>'",
":",
"'\\\\/?%*:|\"<>'",
")",
"===",
"FALSE",
"... | Check whether a path is under a valid form.
@param string $filename Filename path to check
@param boolean $acceptfolder Should folders be accepted?
@return boolean True if path valid | [
"Check",
"whether",
"a",
"path",
"is",
"under",
"a",
"valid",
"form",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L224-L227 |
34,448 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.getCalendarShortMonths | public static function getCalendarShortMonths($calendarId = 0) {
if(!isset(self::$calendarShortMonths[$calendarId])) {
$calendar_info = cal_info($calendarId);
self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths'];
}
return self::$calendarShortMonths[$calendarId];
} | php | public static function getCalendarShortMonths($calendarId = 0) {
if(!isset(self::$calendarShortMonths[$calendarId])) {
$calendar_info = cal_info($calendarId);
self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths'];
}
return self::$calendarShortMonths[$calendarId];
} | [
"public",
"static",
"function",
"getCalendarShortMonths",
"(",
"$",
"calendarId",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"calendarShortMonths",
"[",
"$",
"calendarId",
"]",
")",
")",
"{",
"$",
"calendar_info",
"=",
"cal_info",... | Return short names for the months of the specific calendar.
@see \cal_info()
@param integer $calendarId Calendar ID (according to PHP cal_info)
@return array Array of month short names | [
"Return",
"short",
"names",
"for",
"the",
"months",
"of",
"the",
"specific",
"calendar",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L236-L242 |
34,449 | jon48/webtrees-lib | src/Webtrees/Functions/Functions.php | Functions.isImageTypeSupported | public static function isImageTypeSupported($reqtype) {
$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
$reqtype = strtolower($reqtype);
if (empty($supportByGD[$reqtype])) {
return false;
}
$type = $supportByGD[$reqtype];
if (function_exists(... | php | public static function isImageTypeSupported($reqtype) {
$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
$reqtype = strtolower($reqtype);
if (empty($supportByGD[$reqtype])) {
return false;
}
$type = $supportByGD[$reqtype];
if (function_exists(... | [
"public",
"static",
"function",
"isImageTypeSupported",
"(",
"$",
"reqtype",
")",
"{",
"$",
"supportByGD",
"=",
"array",
"(",
"'jpg'",
"=>",
"'jpeg'",
",",
"'jpeg'",
"=>",
"'jpeg'",
",",
"'gif'",
"=>",
"'gif'",
",",
"'png'",
"=>",
"'png'",
")",
";",
"$",... | Returns whether the image type is supported by the system, and if so, return the standardised type
@param string $reqtype Extension to test
@return boolean|string Is supported? | [
"Returns",
"whether",
"the",
"image",
"type",
"is",
"supported",
"by",
"the",
"system",
"and",
"if",
"so",
"return",
"the",
"standardised",
"type"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/Functions.php#L263-L278 |
34,450 | GrupaZero/cms | src/Gzero/Cms/Http/Resources/Content.php | Content.buildPath | private function buildPath($path)
{
$result = [];
foreach (explode('/', $path) as $value) {
if (!empty($value)) {
$result[] = (int) $value;
}
}
return $result;
} | php | private function buildPath($path)
{
$result = [];
foreach (explode('/', $path) as $value) {
if (!empty($value)) {
$result[] = (int) $value;
}
}
return $result;
} | [
"private",
"function",
"buildPath",
"(",
"$",
"path",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
")",... | Returns array of path ids as integers
@param Content $path path to explode
@return array extracted path | [
"Returns",
"array",
"of",
"path",
"ids",
"as",
"integers"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Http/Resources/Content.php#L151-L160 |
34,451 | jon48/webtrees-lib | src/Webtrees/Module/AdminTasks/Model/AbstractTask.php | AbstractTask.setParameters | public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
$this->is_enabled = $is_enabled;
$this->last_updated = $last_updated;
$this->last_result = $last_result;
$this->frequency = $frequency;
$this->nb_occurrences = $... | php | public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
$this->is_enabled = $is_enabled;
$this->last_updated = $last_updated;
$this->last_result = $last_result;
$this->frequency = $frequency;
$this->nb_occurrences = $... | [
"public",
"function",
"setParameters",
"(",
"$",
"is_enabled",
",",
"\\",
"DateTime",
"$",
"last_updated",
",",
"$",
"last_result",
",",
"$",
"frequency",
",",
"$",
"nb_occur",
",",
"$",
"is_running",
")",
"{",
"$",
"this",
"->",
"is_enabled",
"=",
"$",
... | Set parameters of the Task
@param bool $is_enabled Status of the task
@param \DateTime $lastupdated Time of the last task run
@param bool $last_result Result of the last run, true for success, false for failure
@param int $frequency Frequency of execution in minutes
@param int $nb_occur Number of remaining occurrences... | [
"Set",
"parameters",
"of",
"the",
"Task"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/AdminTasks/Model/AbstractTask.php#L118-L125 |
34,452 | jon48/webtrees-lib | src/Webtrees/Module/AdminTasks/Model/AbstractTask.php | AbstractTask.execute | public function execute(){
if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
$this->is_running = false;
if(!$this->is_running){
$this->last_result = false;
$this->is_running = true;
$this->save();
... | php | public function execute(){
if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
$this->is_running = false;
if(!$this->is_running){
$this->last_result = false;
$this->is_running = true;
$this->save();
... | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"last_updated",
"->",
"add",
"(",
"new",
"\\",
"DateInterval",
"(",
"'PT'",
".",
"self",
"::",
"TASK_TIME_OUT",
".",
"'S'",
")",
")",
"<",
"new",
"\\",
"DateTime",
"(",
")"... | Execute the task, default skeleton | [
"Execute",
"the",
"task",
"default",
"skeleton"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/AdminTasks/Model/AbstractTask.php#L246-L269 |
34,453 | Rareloop/primer-core | src/Primer/Primer.php | Primer.start | public static function start($options)
{
ErrorHandler::register();
ExceptionHandler::register();
// Default params
$defaultTemplateClass = 'Rareloop\Primer\TemplateEngine\Handlebars\Template';
// Work out what we were passed as an argument
if (is_string($options)) {... | php | public static function start($options)
{
ErrorHandler::register();
ExceptionHandler::register();
// Default params
$defaultTemplateClass = 'Rareloop\Primer\TemplateEngine\Handlebars\Template';
// Work out what we were passed as an argument
if (is_string($options)) {... | [
"public",
"static",
"function",
"start",
"(",
"$",
"options",
")",
"{",
"ErrorHandler",
"::",
"register",
"(",
")",
";",
"ExceptionHandler",
"::",
"register",
"(",
")",
";",
"// Default params",
"$",
"defaultTemplateClass",
"=",
"'Rareloop\\Primer\\TemplateEngine\\H... | Bootstrap the Primer singleton
For backwards compatibility the first param is either a string to the BASE_PATH
or it can be an assoc array
array(
'basePath' => '',
'patternPath' => '', // Defaults to PRIMER::$BASE_PATH . '/pattern'
'cachePath' => '', // Defaults to PRIMER::$BASE_PATH . '/cache'
'templateEng... | [
"Bootstrap",
"the",
"Primer",
"singleton"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Primer.php#L100-L144 |
34,454 | Rareloop/primer-core | src/Primer/Primer.php | Primer.getTemplate | public function getTemplate($id)
{
// Default system wide template wrapping config
$wrapTemplate = Primer::$WRAP_TEMPLATES;
$id = Primer::cleanId($id);
// Create the template
$template = new Pattern('templates/' . $id);
$templateData = new ViewData([
"p... | php | public function getTemplate($id)
{
// Default system wide template wrapping config
$wrapTemplate = Primer::$WRAP_TEMPLATES;
$id = Primer::cleanId($id);
// Create the template
$template = new Pattern('templates/' . $id);
$templateData = new ViewData([
"p... | [
"public",
"function",
"getTemplate",
"(",
"$",
"id",
")",
"{",
"// Default system wide template wrapping config",
"$",
"wrapTemplate",
"=",
"Primer",
"::",
"$",
"WRAP_TEMPLATES",
";",
"$",
"id",
"=",
"Primer",
"::",
"cleanId",
"(",
"$",
"id",
")",
";",
"// Cre... | Get a specific page template
@param String $id The template id
@return String | [
"Get",
"a",
"specific",
"page",
"template"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Primer.php#L169-L216 |
34,455 | Rareloop/primer-core | src/Primer/Primer.php | Primer.getPatterns | public function getPatterns($ids, $showChrome = true)
{
$renderList = new RenderList();
foreach ($ids as $id) {
$id = Primer::cleanId($id);
// Check if the Id is for a pattern or a group
$parts = explode('/', $id);
if (count($parts) > 2) {
... | php | public function getPatterns($ids, $showChrome = true)
{
$renderList = new RenderList();
foreach ($ids as $id) {
$id = Primer::cleanId($id);
// Check if the Id is for a pattern or a group
$parts = explode('/', $id);
if (count($parts) > 2) {
... | [
"public",
"function",
"getPatterns",
"(",
"$",
"ids",
",",
"$",
"showChrome",
"=",
"true",
")",
"{",
"$",
"renderList",
"=",
"new",
"RenderList",
"(",
")",
";",
"foreach",
"(",
"$",
"ids",
"as",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"Primer",
"::",
... | Get a selection of patterns
@param Array $ids An array of pattern/group/section ids
@param boolean $showChrome Should we show the chrome
@return String | [
"Get",
"a",
"selection",
"of",
"patterns"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Primer.php#L256-L278 |
34,456 | Rareloop/primer-core | src/Primer/Primer.php | Primer.getTemplates | public function getTemplates()
{
$templates = array();
if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {
while (false !== ($entry = readdir($handle))) {
if (substr($entry, 0, 1) !== '.') {
$templates[] = array(
'id... | php | public function getTemplates()
{
$templates = array();
if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {
while (false !== ($entry = readdir($handle))) {
if (substr($entry, 0, 1) !== '.') {
$templates[] = array(
'id... | [
"public",
"function",
"getTemplates",
"(",
")",
"{",
"$",
"templates",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"handle",
"=",
"opendir",
"(",
"Primer",
"::",
"$",
"PATTERN_PATH",
".",
"'/templates'",
")",
")",
"{",
"while",
"(",
"false",
"!==",
... | Get the list of templates available. Returns an array of associative arrays
e.g.
array(
array(
'id' => 'home',
'title' => 'Home',
),
array(
'id' => 'about-us',
'title' => 'About Us'
)
);
@return array | [
"Get",
"the",
"list",
"of",
"templates",
"available",
".",
"Returns",
"an",
"array",
"of",
"associative",
"arrays"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Primer.php#L336-L354 |
34,457 | jon48/webtrees-lib | src/Webtrees/Mvc/View/ViewFactory.php | ViewFactory.makeView | public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data)
{
if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined');
if(!$ctrl) throw new \Exception('Base Controller not defined');
if(!$view_name) throw new \Exception('View not defined');
... | php | public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data)
{
if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined');
if(!$ctrl) throw new \Exception('Base Controller not defined');
if(!$view_name) throw new \Exception('View not defined');
... | [
"public",
"function",
"makeView",
"(",
"$",
"view_name",
",",
"MvcController",
"$",
"mvc_ctrl",
",",
"BaseController",
"$",
"ctrl",
",",
"ViewBag",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"mvc_ctrl",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"'Mvc... | Return the view specified by the controller and view name, using data from the ViewBag
@param string $view_name
@param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
@param \Fisharebest\Webtrees\Controller\BaseController $ctrl
@param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
@return \MyArtJaub\We... | [
"Return",
"the",
"view",
"specified",
"by",
"the",
"controller",
"and",
"view",
"name",
"using",
"data",
"from",
"the",
"ViewBag"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Mvc/View/ViewFactory.php#L54-L65 |
34,458 | jon48/webtrees-lib | src/Webtrees/Mvc/View/ViewFactory.php | ViewFactory.make | public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data)
{
return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data);
} | php | public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data)
{
return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data);
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"view_name",
",",
"MvcController",
"$",
"mvc_ctrl",
",",
"BaseController",
"$",
"ctrl",
",",
"ViewBag",
"$",
"data",
")",
"{",
"return",
"self",
"::",
"getInstance",
"(",
")",
"->",
"makeView",
"(",
"$",
... | Static invocation of the makeView method
@param string $view_name
@param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
@param \Fisharebest\Webtrees\Controller\BaseController $ctrl
@param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
@return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
@see \MyArtJ... | [
"Static",
"invocation",
"of",
"the",
"makeView",
"method"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Mvc/View/ViewFactory.php#L77-L80 |
34,459 | alexislefebvre/AsyncTweetsBundle | src/Entity/Tweet.php | Tweet.addMedia | public function addMedia(Media $media)
{
$this->medias->add($media);
$media->addTweet($this);
return $this;
} | php | public function addMedia(Media $media)
{
$this->medias->add($media);
$media->addTweet($this);
return $this;
} | [
"public",
"function",
"addMedia",
"(",
"Media",
"$",
"media",
")",
"{",
"$",
"this",
"->",
"medias",
"->",
"add",
"(",
"$",
"media",
")",
";",
"$",
"media",
"->",
"addTweet",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a media.
@param Media $media
@return Tweet | [
"Add",
"a",
"media",
"."
] | 76266fae7de978963e05dadb14c81f8398bb00a6 | https://github.com/alexislefebvre/AsyncTweetsBundle/blob/76266fae7de978963e05dadb14c81f8398bb00a6/src/Entity/Tweet.php#L288-L294 |
34,460 | alexislefebvre/AsyncTweetsBundle | src/Entity/Tweet.php | Tweet.removeMedia | public function removeMedia(Media $media)
{
$this->medias->removeElement($media);
$media->removeTweet($this);
return $this;
} | php | public function removeMedia(Media $media)
{
$this->medias->removeElement($media);
$media->removeTweet($this);
return $this;
} | [
"public",
"function",
"removeMedia",
"(",
"Media",
"$",
"media",
")",
"{",
"$",
"this",
"->",
"medias",
"->",
"removeElement",
"(",
"$",
"media",
")",
";",
"$",
"media",
"->",
"removeTweet",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
";",
"}"... | Remove a media.
@param Media $media
@return Tweet | [
"Remove",
"a",
"media",
"."
] | 76266fae7de978963e05dadb14c81f8398bb00a6 | https://github.com/alexislefebvre/AsyncTweetsBundle/blob/76266fae7de978963e05dadb14c81f8398bb00a6/src/Entity/Tweet.php#L303-L309 |
34,461 | alexislefebvre/AsyncTweetsBundle | src/Entity/Tweet.php | Tweet.mustBeKept | public function mustBeKept($tweetId)
{
if (count($this->getRetweetingStatuses()) == 0) {
// This tweet has not been retweeted
return false;
}
// Check that this tweet has not been retweeted after $tweetId
foreach ($this->getRetweetingStatuses() as $retweeting... | php | public function mustBeKept($tweetId)
{
if (count($this->getRetweetingStatuses()) == 0) {
// This tweet has not been retweeted
return false;
}
// Check that this tweet has not been retweeted after $tweetId
foreach ($this->getRetweetingStatuses() as $retweeting... | [
"public",
"function",
"mustBeKept",
"(",
"$",
"tweetId",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getRetweetingStatuses",
"(",
")",
")",
"==",
"0",
")",
"{",
"// This tweet has not been retweeted",
"return",
"false",
";",
"}",
"// Check that this... | Check that tweet can be deleted.
@param int $tweetId
@return bool | [
"Check",
"that",
"tweet",
"can",
"be",
"deleted",
"."
] | 76266fae7de978963e05dadb14c81f8398bb00a6 | https://github.com/alexislefebvre/AsyncTweetsBundle/blob/76266fae7de978963e05dadb14c81f8398bb00a6/src/Entity/Tweet.php#L346-L362 |
34,462 | GrupaZero/cms | src/Gzero/Cms/CMSSeeder.php | CMSSeeder.run | public function run()
{
config()->set('gzero-core.db_transactions', false);
$languages = Language::all()->keyBy('code');
$users = $this->seedUsers();
$contents = $this->seedContent($languages, $users);
$this->seedBlock(BlockType::all(), $languages, $users, $contents);
... | php | public function run()
{
config()->set('gzero-core.db_transactions', false);
$languages = Language::all()->keyBy('code');
$users = $this->seedUsers();
$contents = $this->seedContent($languages, $users);
$this->seedBlock(BlockType::all(), $languages, $users, $contents);
... | [
"public",
"function",
"run",
"(",
")",
"{",
"config",
"(",
")",
"->",
"set",
"(",
"'gzero-core.db_transactions'",
",",
"false",
")",
";",
"$",
"languages",
"=",
"Language",
"::",
"all",
"(",
")",
"->",
"keyBy",
"(",
"'code'",
")",
";",
"$",
"users",
... | This function run all seeds
@return void | [
"This",
"function",
"run",
"all",
"seeds"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/CMSSeeder.php#L47-L57 |
34,463 | GrupaZero/cms | src/Gzero/Cms/CMSSeeder.php | CMSSeeder.seedRandomContent | private function seedRandomContent(string $type, $parent, $languages, $users)
{
$user = $users->random();
$en = $languages['en'];
$pl = $languages['pl'];
$faker = Factory::create($en->i18n);
$title = $faker->realText(38, 1);
$content = dispatch_now(CreateConte... | php | private function seedRandomContent(string $type, $parent, $languages, $users)
{
$user = $users->random();
$en = $languages['en'];
$pl = $languages['pl'];
$faker = Factory::create($en->i18n);
$title = $faker->realText(38, 1);
$content = dispatch_now(CreateConte... | [
"private",
"function",
"seedRandomContent",
"(",
"string",
"$",
"type",
",",
"$",
"parent",
",",
"$",
"languages",
",",
"$",
"users",
")",
"{",
"$",
"user",
"=",
"$",
"users",
"->",
"random",
"(",
")",
";",
"$",
"en",
"=",
"$",
"languages",
"[",
"'... | Seed single content
@param string $type Content type
@param Content|Null $parent Parent element
@param array $languages Array with languages
@param array $users Array with users
@return bool | [
"Seed",
"single",
"content"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/CMSSeeder.php#L118-L147 |
34,464 | GrupaZero/cms | src/Gzero/Cms/CMSSeeder.php | CMSSeeder.seedRandomBlock | private function seedRandomBlock(BlockType $type, $languages, $users, $contents)
{
$language = $languages->random();
$faker = Factory::create($language->i18n);
$isActive = (bool) rand(0, 1);
$isCacheable = (bool) rand(0, 1);
$filter = (rand(0, 1)) ? [
... | php | private function seedRandomBlock(BlockType $type, $languages, $users, $contents)
{
$language = $languages->random();
$faker = Factory::create($language->i18n);
$isActive = (bool) rand(0, 1);
$isCacheable = (bool) rand(0, 1);
$filter = (rand(0, 1)) ? [
... | [
"private",
"function",
"seedRandomBlock",
"(",
"BlockType",
"$",
"type",
",",
"$",
"languages",
",",
"$",
"users",
",",
"$",
"contents",
")",
"{",
"$",
"language",
"=",
"$",
"languages",
"->",
"random",
"(",
")",
";",
"$",
"faker",
"=",
"Factory",
"::"... | Seed single block
@param BlockType $type Block type
@param array $languages Array with languages
@param array $users Array with users
@param array $contents Array with contents
@return Block | [
"Seed",
"single",
"block"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/CMSSeeder.php#L246-L272 |
34,465 | GrupaZero/cms | src/Gzero/Cms/CMSSeeder.php | CMSSeeder.generateBodyHTML | private function generateBodyHTML(Generator $faker)
{
$html = [];
$imageCategories = [
'abstract',
'animals',
'business',
'cats',
'city',
'food',
'nightlife',
'fashion',
'... | php | private function generateBodyHTML(Generator $faker)
{
$html = [];
$imageCategories = [
'abstract',
'animals',
'business',
'cats',
'city',
'food',
'nightlife',
'fashion',
'... | [
"private",
"function",
"generateBodyHTML",
"(",
"Generator",
"$",
"faker",
")",
"{",
"$",
"html",
"=",
"[",
"]",
";",
"$",
"imageCategories",
"=",
"[",
"'abstract'",
",",
"'animals'",
",",
"'business'",
",",
"'cats'",
",",
"'city'",
",",
"'food'",
",",
"... | Function generates translation body HTML
@param Generator $faker Faker factory
@return string generated HTML | [
"Function",
"generates",
"translation",
"body",
"HTML"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/CMSSeeder.php#L417-L452 |
34,466 | GrupaZero/cms | src/Gzero/Cms/CMSSeeder.php | CMSSeeder.getRandomBlockFilter | private function getRandomBlockFilter($contents)
{
return rand(0, 1) ? $contents[array_rand($contents)]->path . '*' : $contents[array_rand($contents)]->path;
} | php | private function getRandomBlockFilter($contents)
{
return rand(0, 1) ? $contents[array_rand($contents)]->path . '*' : $contents[array_rand($contents)]->path;
} | [
"private",
"function",
"getRandomBlockFilter",
"(",
"$",
"contents",
")",
"{",
"return",
"rand",
"(",
"0",
",",
"1",
")",
"?",
"$",
"contents",
"[",
"array_rand",
"(",
"$",
"contents",
")",
"]",
"->",
"path",
".",
"'*'",
":",
"$",
"contents",
"[",
"a... | Function generates block filter path
@param array $contents Array with contents
@return string | [
"Function",
"generates",
"block",
"filter",
"path"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/CMSSeeder.php#L461-L464 |
34,467 | GrupaZero/cms | src/Gzero/Cms/Repositories/ContentReadRepository.php | ContentReadRepository.getByPath | public function getByPath(string $path, string $languageCode, bool $onlyActive = false)
{
return Content::query()
->with(self::$loadRelations)
->join('routes', function ($join) use ($languageCode, $path, $onlyActive) {
$join->on('contents.id', '=', 'routes.routable_id... | php | public function getByPath(string $path, string $languageCode, bool $onlyActive = false)
{
return Content::query()
->with(self::$loadRelations)
->join('routes', function ($join) use ($languageCode, $path, $onlyActive) {
$join->on('contents.id', '=', 'routes.routable_id... | [
"public",
"function",
"getByPath",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"languageCode",
",",
"bool",
"$",
"onlyActive",
"=",
"false",
")",
"{",
"return",
"Content",
"::",
"query",
"(",
")",
"->",
"with",
"(",
"self",
"::",
"$",
"loadRelations"... | Retrieve a content by given path
@param string $path URI path
@param string $languageCode Language code
@param bool $onlyActive Trigger
@return Content|mixed | [
"Retrieve",
"a",
"content",
"by",
"given",
"path"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Repositories/ContentReadRepository.php#L103-L117 |
34,468 | GrupaZero/cms | src/Gzero/Cms/Repositories/ContentReadRepository.php | ContentReadRepository.getAncestorsTitlesAndPaths | public function getAncestorsTitlesAndPaths(Content $content, Language $language, $onlyActive = true)
{
$ancestorIds = array_filter(explode('/', $content->path));
return \DB::table('contents as c')
->join('routes as r', function ($join) use ($language, $onlyActive) {
$join... | php | public function getAncestorsTitlesAndPaths(Content $content, Language $language, $onlyActive = true)
{
$ancestorIds = array_filter(explode('/', $content->path));
return \DB::table('contents as c')
->join('routes as r', function ($join) use ($language, $onlyActive) {
$join... | [
"public",
"function",
"getAncestorsTitlesAndPaths",
"(",
"Content",
"$",
"content",
",",
"Language",
"$",
"language",
",",
"$",
"onlyActive",
"=",
"true",
")",
"{",
"$",
"ancestorIds",
"=",
"array_filter",
"(",
"explode",
"(",
"'/'",
",",
"$",
"content",
"->... | Returns titles & url paths from ancestors
@param Content $content Content
@param Language $language Language
@param bool $onlyActive isActive trigger
@return \Illuminate\Support\Collection | [
"Returns",
"titles",
"&",
"url",
"paths",
"from",
"ancestors"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Repositories/ContentReadRepository.php#L128-L150 |
34,469 | GrupaZero/cms | src/Gzero/Cms/Repositories/ContentReadRepository.php | ContentReadRepository.getChildren | public function getChildren(Content $content, Language $language)
{
return $content->children()
->with(self::$loadRelations)
->where('published_at', '<=', Carbon::now())
->whereHas('routes', function ($query) use ($language) {
$query->where('routes.is_acti... | php | public function getChildren(Content $content, Language $language)
{
return $content->children()
->with(self::$loadRelations)
->where('published_at', '<=', Carbon::now())
->whereHas('routes', function ($query) use ($language) {
$query->where('routes.is_acti... | [
"public",
"function",
"getChildren",
"(",
"Content",
"$",
"content",
",",
"Language",
"$",
"language",
")",
"{",
"return",
"$",
"content",
"->",
"children",
"(",
")",
"->",
"with",
"(",
"self",
"::",
"$",
"loadRelations",
")",
"->",
"where",
"(",
"'publi... | Get all children specific content
@param Content $content parent
@param Language $language Current language
@return mixed | [
"Get",
"all",
"children",
"specific",
"content"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Repositories/ContentReadRepository.php#L237-L251 |
34,470 | jon48/webtrees-lib | src/Webtrees/Mvc/View/AbstractView.php | AbstractView.render | public function render() {
global $controller;
if(!$this->ctrl) throw new \Exception('Controller not initialised');
$controller = $this->ctrl;
$this->ctrl->pageHeader();
echo $this->renderContent();
} | php | public function render() {
global $controller;
if(!$this->ctrl) throw new \Exception('Controller not initialised');
$controller = $this->ctrl;
$this->ctrl->pageHeader();
echo $this->renderContent();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"global",
"$",
"controller",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"ctrl",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"'Controller not initialised'",
")",
";",
"$",
"controller",
"=",
"$",
"this",
"->",
... | Render the view to the page, including header.
@throws \Exception | [
"Render",
"the",
"view",
"to",
"the",
"page",
"including",
"header",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Mvc/View/AbstractView.php#L45-L54 |
34,471 | jon48/webtrees-lib | src/Webtrees/Mvc/View/AbstractView.php | AbstractView.getHtmlPartial | public function getHtmlPartial() {
ob_start();
$html_render = $this->renderContent();
$html_buffer = ob_get_clean();
return empty($html_render) ? $html_buffer : $html_render;
} | php | public function getHtmlPartial() {
ob_start();
$html_render = $this->renderContent();
$html_buffer = ob_get_clean();
return empty($html_render) ? $html_buffer : $html_render;
} | [
"public",
"function",
"getHtmlPartial",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"html_render",
"=",
"$",
"this",
"->",
"renderContent",
"(",
")",
";",
"$",
"html_buffer",
"=",
"ob_get_clean",
"(",
")",
";",
"return",
"empty",
"(",
"$",
"html_rende... | Return the HTML code generated by the view, without any header | [
"Return",
"the",
"HTML",
"code",
"generated",
"by",
"the",
"view",
"without",
"any",
"header"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Mvc/View/AbstractView.php#L66-L72 |
34,472 | pckg/database | src/Pckg/Database/Repository/RepositoryFactory.php | RepositoryFactory.getRepositoryByConfig | protected static function getRepositoryByConfig($config, $name)
{
if (!is_array($config)) {
if (class_exists($config)) {
return new $config;
}
throw new Exception('Cannot create repository from string');
} elseif ($config['driver'] == 'faker') {
... | php | protected static function getRepositoryByConfig($config, $name)
{
if (!is_array($config)) {
if (class_exists($config)) {
return new $config;
}
throw new Exception('Cannot create repository from string');
} elseif ($config['driver'] == 'faker') {
... | [
"protected",
"static",
"function",
"getRepositoryByConfig",
"(",
"$",
"config",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"config",
")",
")",
"{",
"return",
"new",
... | Instantiate connection for defined driver.
@param $config
@param $name
@return Faker|RepositoryPDO
@throws Exception | [
"Instantiate",
"connection",
"for",
"defined",
"driver",
"."
] | 99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3 | https://github.com/pckg/database/blob/99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3/src/Pckg/Database/Repository/RepositoryFactory.php#L212-L229 |
34,473 | voslartomas/WebCMS2 | install/Form.php | Form.signalReceived | public function signalReceived($signal)
{
if ($signal === 'submit') {
if (!$this->getPresenter()->getRequest()->hasFlag(Nette\Application\Request::RESTORED)) {
$this->fireEvents();
}
} else {
$class = get_class($this);
throw new BadSign... | php | public function signalReceived($signal)
{
if ($signal === 'submit') {
if (!$this->getPresenter()->getRequest()->hasFlag(Nette\Application\Request::RESTORED)) {
$this->fireEvents();
}
} else {
$class = get_class($this);
throw new BadSign... | [
"public",
"function",
"signalReceived",
"(",
"$",
"signal",
")",
"{",
"if",
"(",
"$",
"signal",
"===",
"'submit'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getPresenter",
"(",
")",
"->",
"getRequest",
"(",
")",
"->",
"hasFlag",
"(",
"Nette",
"\\... | This method is called by presenter.
@param string
@return void | [
"This",
"method",
"is",
"called",
"by",
"presenter",
"."
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/install/Form.php#L121-L131 |
34,474 | c4studio/chronos | src/Chronos/Scaffolding/database/migrations/2016_10_17_300000_alter_users_table.php | AlterUsersTable.up | public function up()
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'name'))
$table->dropColumn('name');
$table->integer('role_id')->unsigned()->nullable();
$table->foreign('role_id')->references('id')->on('roles')->o... | php | public function up()
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'name'))
$table->dropColumn('name');
$table->integer('role_id')->unsigned()->nullable();
$table->foreign('role_id')->references('id')->on('roles')->o... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"table",
"(",
"'users'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"if",
"(",
"Schema",
"::",
"hasColumn",
"(",
"'users'",
",",
"'name'",
")",
")",
"$",
"table",
"->",
"dropC... | Run the database.
@return void | [
"Run",
"the",
"database",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Scaffolding/database/migrations/2016_10_17_300000_alter_users_table.php#L14-L25 |
34,475 | c4studio/chronos | src/Chronos/Scaffolding/database/migrations/2016_10_17_300000_alter_users_table.php | AlterUsersTable.down | public function down()
{
Schema::table('users', function ($table) {
$table->string('name')->after('id');
$table->dropColumn('picture');
$table->dropColumn('lastname');
$table->dropColumn('firstname');
$table->dropForeign('users_role_id_foreign');
... | php | public function down()
{
Schema::table('users', function ($table) {
$table->string('name')->after('id');
$table->dropColumn('picture');
$table->dropColumn('lastname');
$table->dropColumn('firstname');
$table->dropForeign('users_role_id_foreign');
... | [
"public",
"function",
"down",
"(",
")",
"{",
"Schema",
"::",
"table",
"(",
"'users'",
",",
"function",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"string",
"(",
"'name'",
")",
"->",
"after",
"(",
"'id'",
")",
";",
"$",
"table",
"->",
"dropCol... | Reverse the database.
@return void | [
"Reverse",
"the",
"database",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Scaffolding/database/migrations/2016_10_17_300000_alter_users_table.php#L32-L42 |
34,476 | GrupaZero/cms | src/Gzero/Cms/Listeners/BlockLoad.php | BlockLoad.handle | public function handle($event)
{
if ($event instanceof RouteMatched) {
$this->handleLaravelRoute($event);
}
if ($event instanceof GzeroRouteMatched) {
$this->handleRoute($event);
}
} | php | public function handle($event)
{
if ($event instanceof RouteMatched) {
$this->handleLaravelRoute($event);
}
if ($event instanceof GzeroRouteMatched) {
$this->handleRoute($event);
}
} | [
"public",
"function",
"handle",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"instanceof",
"RouteMatched",
")",
"{",
"$",
"this",
"->",
"handleLaravelRoute",
"(",
"$",
"event",
")",
";",
"}",
"if",
"(",
"$",
"event",
"instanceof",
"GzeroRouteMat... | Handle the event. It loads block for matched routes.
@param mixed $event Matched route or content
@return void | [
"Handle",
"the",
"event",
".",
"It",
"loads",
"block",
"for",
"matched",
"routes",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Listeners/BlockLoad.php#L49-L58 |
34,477 | GrupaZero/cms | src/Gzero/Cms/Listeners/BlockLoad.php | BlockLoad.handleLaravelRoute | public function handleLaravelRoute(RouteMatched $event)
{
if ($this->isValidFrontendRoute($event)) {
ViewComposer::addCallback(function () use ($event) {
$blockIds = $this->blockFinder->getBlocksIds($event->route->getName(), true);
$blocks = $this->blockReposito... | php | public function handleLaravelRoute(RouteMatched $event)
{
if ($this->isValidFrontendRoute($event)) {
ViewComposer::addCallback(function () use ($event) {
$blockIds = $this->blockFinder->getBlocksIds($event->route->getName(), true);
$blocks = $this->blockReposito... | [
"public",
"function",
"handleLaravelRoute",
"(",
"RouteMatched",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValidFrontendRoute",
"(",
"$",
"event",
")",
")",
"{",
"ViewComposer",
"::",
"addCallback",
"(",
"function",
"(",
")",
"use",
"(",
"$"... | Handle the event. It loads block for static named routes.
@param RouteMatched $event dispatched event
@return void | [
"Handle",
"the",
"event",
".",
"It",
"loads",
"block",
"for",
"static",
"named",
"routes",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Listeners/BlockLoad.php#L67-L78 |
34,478 | GrupaZero/cms | src/Gzero/Cms/Listeners/BlockLoad.php | BlockLoad.handleRoute | public function handleRoute(GzeroRouteMatched $event)
{
$blockIds = $this->blockFinder->getBlocksIds($event->route->getRoutable(), true);
$blocks = $this->blockRepository->getVisibleBlocks($blockIds, $this->languageService->getCurrent(), true);
$this->handleBlockRendering($blocks);
... | php | public function handleRoute(GzeroRouteMatched $event)
{
$blockIds = $this->blockFinder->getBlocksIds($event->route->getRoutable(), true);
$blocks = $this->blockRepository->getVisibleBlocks($blockIds, $this->languageService->getCurrent(), true);
$this->handleBlockRendering($blocks);
... | [
"public",
"function",
"handleRoute",
"(",
"GzeroRouteMatched",
"$",
"event",
")",
"{",
"$",
"blockIds",
"=",
"$",
"this",
"->",
"blockFinder",
"->",
"getBlocksIds",
"(",
"$",
"event",
"->",
"route",
"->",
"getRoutable",
"(",
")",
",",
"true",
")",
";",
"... | Handle the event. It loads block for dynamic router.
@param GzeroRouteMatched $event dispatched event
@return void | [
"Handle",
"the",
"event",
".",
"It",
"loads",
"block",
"for",
"dynamic",
"router",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Listeners/BlockLoad.php#L87-L94 |
34,479 | GrupaZero/cms | src/Gzero/Cms/Listeners/BlockLoad.php | BlockLoad.handleBlockRendering | protected function handleBlockRendering($blocks)
{
foreach ($blocks as &$block) {
$type = resolve($block->type->handler);
$block->view = $type->handle($block, $this->languageService->getCurrent());
}
} | php | protected function handleBlockRendering($blocks)
{
foreach ($blocks as &$block) {
$type = resolve($block->type->handler);
$block->view = $type->handle($block, $this->languageService->getCurrent());
}
} | [
"protected",
"function",
"handleBlockRendering",
"(",
"$",
"blocks",
")",
"{",
"foreach",
"(",
"$",
"blocks",
"as",
"&",
"$",
"block",
")",
"{",
"$",
"type",
"=",
"resolve",
"(",
"$",
"block",
"->",
"type",
"->",
"handler",
")",
";",
"$",
"block",
"-... | It renders blocks
@param Collection $blocks List of blocks to render
@return void | [
"It",
"renders",
"blocks"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Listeners/BlockLoad.php#L103-L109 |
34,480 | pckg/database | src/Pckg/Database/Query/Helper/With.php | With.fillRecordWithRelations | public function fillRecordWithRelations(Record $record)
{
foreach ($this->getWith() as $relation) {
$relation->fillRecord($record);
}
return $record;
} | php | public function fillRecordWithRelations(Record $record)
{
foreach ($this->getWith() as $relation) {
$relation->fillRecord($record);
}
return $record;
} | [
"public",
"function",
"fillRecordWithRelations",
"(",
"Record",
"$",
"record",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getWith",
"(",
")",
"as",
"$",
"relation",
")",
"{",
"$",
"relation",
"->",
"fillRecord",
"(",
"$",
"record",
")",
";",
"}",
"r... | Fill record with all it's relations.
@param Record $record
@return Record | [
"Fill",
"record",
"with",
"all",
"it",
"s",
"relations",
"."
] | 99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3 | https://github.com/pckg/database/blob/99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3/src/Pckg/Database/Query/Helper/With.php#L155-L162 |
34,481 | pckg/database | src/Pckg/Database/Query/Helper/With.php | With.fillCollectionWithRelations | public function fillCollectionWithRelations(CollectionInterface $collection)
{
if (!$collection->count()) {
return $collection;
}
foreach ($this->getWith() as $relation) {
$relation->fillCollection($collection);
}
return $collection;
} | php | public function fillCollectionWithRelations(CollectionInterface $collection)
{
if (!$collection->count()) {
return $collection;
}
foreach ($this->getWith() as $relation) {
$relation->fillCollection($collection);
}
return $collection;
} | [
"public",
"function",
"fillCollectionWithRelations",
"(",
"CollectionInterface",
"$",
"collection",
")",
"{",
"if",
"(",
"!",
"$",
"collection",
"->",
"count",
"(",
")",
")",
"{",
"return",
"$",
"collection",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"g... | Fill collection of records with all of their relations.
@param CollectionInterface $collection
@return CollectionInterface | [
"Fill",
"collection",
"of",
"records",
"with",
"all",
"of",
"their",
"relations",
"."
] | 99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3 | https://github.com/pckg/database/blob/99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3/src/Pckg/Database/Query/Helper/With.php#L179-L190 |
34,482 | jon48/webtrees-lib | src/Webtrees/Module/GeoDispersion/AdminConfigController.php | AdminConfigController.renderEdit | protected function renderEdit(GeoAnalysis $ga = null) {
$wt_tree = Globals::getTree();
Theme::theme(new AdministrationTheme)->init($wt_tree);
$controller = new PageController();
$controller
->restrictAccess(Auth::isManager($wt_tree))
->addInlineJavascript(... | php | protected function renderEdit(GeoAnalysis $ga = null) {
$wt_tree = Globals::getTree();
Theme::theme(new AdministrationTheme)->init($wt_tree);
$controller = new PageController();
$controller
->restrictAccess(Auth::isManager($wt_tree))
->addInlineJavascript(... | [
"protected",
"function",
"renderEdit",
"(",
"GeoAnalysis",
"$",
"ga",
"=",
"null",
")",
"{",
"$",
"wt_tree",
"=",
"Globals",
"::",
"getTree",
"(",
")",
";",
"Theme",
"::",
"theme",
"(",
"new",
"AdministrationTheme",
")",
"->",
"init",
"(",
"$",
"wt_tree"... | Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one.
@param (GeoAnalysis!null) $ga GeoAnalysis to edit | [
"Renders",
"the",
"edit",
"form",
"whether",
"it",
"is",
"an",
"edition",
"of",
"an",
"existing",
"GeoAnalysis",
"or",
"the",
"addition",
"of",
"a",
"new",
"one",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/GeoDispersion/AdminConfigController.php#L394-L442 |
34,483 | GrupaZero/cms | src/Gzero/Cms/Jobs/CreateBlock.php | CreateBlock.slider | public static function slider(string $title, Language $language, User $author, array $attributes = [])
{
return new self($title, $language, $author, array_merge($attributes, ['type' => 'slider']));
} | php | public static function slider(string $title, Language $language, User $author, array $attributes = [])
{
return new self($title, $language, $author, array_merge($attributes, ['type' => 'slider']));
} | [
"public",
"static",
"function",
"slider",
"(",
"string",
"$",
"title",
",",
"Language",
"$",
"language",
",",
"User",
"$",
"author",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"title",
",",
"$",
"lang... | It creates job to create block
@param string $title Translation title
@param Language $language Language
@param User $author User model
@param array $attributes Array of optional attributes
@return CreateBlock | [
"It",
"creates",
"job",
"to",
"create",
"block"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Jobs/CreateBlock.php#L113-L116 |
34,484 | jon48/webtrees-lib | src/Webtrees/Hook/Hook.php | Hook.subscribe | public function subscribe($hsubscriber){
if(HookProvider::getInstance()->isModuleOperational()){
Database::prepare(
"INSERT IGNORE INTO `##maj_hooks` (majh_hook_function, majh_hook_context, majh_module_name)".
" VALUES (?, ?, ?)"
)->execute(array($this->hook_function, $this->hook_context, $hsubscriber... | php | public function subscribe($hsubscriber){
if(HookProvider::getInstance()->isModuleOperational()){
Database::prepare(
"INSERT IGNORE INTO `##maj_hooks` (majh_hook_function, majh_hook_context, majh_module_name)".
" VALUES (?, ?, ?)"
)->execute(array($this->hook_function, $this->hook_context, $hsubscriber... | [
"public",
"function",
"subscribe",
"(",
"$",
"hsubscriber",
")",
"{",
"if",
"(",
"HookProvider",
"::",
"getInstance",
"(",
")",
"->",
"isModuleOperational",
"(",
")",
")",
"{",
"Database",
"::",
"prepare",
"(",
"\"INSERT IGNORE INTO `##maj_hooks` (majh_hook_function... | Subscribe a class implementing HookSubscriberInterface to the Hook
The Hook is by default enabled.
@param string $hsubscriber Name of the subscriber module | [
"Subscribe",
"a",
"class",
"implementing",
"HookSubscriberInterface",
"to",
"the",
"Hook",
"The",
"Hook",
"is",
"by",
"default",
"enabled",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Hook/Hook.php#L50-L57 |
34,485 | jon48/webtrees-lib | src/Webtrees/Hook/Hook.php | Hook.setPriority | public function setPriority($hsubscriber, $priority){
if(HookProvider::getInstance()->isModuleOperational()){
Database::prepare(
"UPDATE `##maj_hooks`".
" SET majh_module_priority=?".
" WHERE majh_hook_function=?".
" AND majh_hook_context=?".
" AND majh_module_name=?"
)->execute(array($priority... | php | public function setPriority($hsubscriber, $priority){
if(HookProvider::getInstance()->isModuleOperational()){
Database::prepare(
"UPDATE `##maj_hooks`".
" SET majh_module_priority=?".
" WHERE majh_hook_function=?".
" AND majh_hook_context=?".
" AND majh_module_name=?"
)->execute(array($priority... | [
"public",
"function",
"setPriority",
"(",
"$",
"hsubscriber",
",",
"$",
"priority",
")",
"{",
"if",
"(",
"HookProvider",
"::",
"getInstance",
"(",
")",
"->",
"isModuleOperational",
"(",
")",
")",
"{",
"Database",
"::",
"prepare",
"(",
"\"UPDATE `##maj_hooks`\"... | Define the priority for execution of the Hook for the specific HookSubscriberInterface
@param string $hsubscriber Name of the subscriber module
@param int $priority Priority of execution | [
"Define",
"the",
"priority",
"for",
"execution",
"of",
"the",
"Hook",
"for",
"the",
"specific",
"HookSubscriberInterface"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Hook/Hook.php#L65-L75 |
34,486 | jon48/webtrees-lib | src/Webtrees/Hook/Hook.php | Hook.executeOnlyFor | public function executeOnlyFor(array $module_names) {
$result = array();
if(HookProvider::getInstance()->isModuleOperational()){
$params = func_get_args();
array_shift($params);
foreach ($module_names as $module_name) {
if($module = Module::getModuleByName($module_name)) ... | php | public function executeOnlyFor(array $module_names) {
$result = array();
if(HookProvider::getInstance()->isModuleOperational()){
$params = func_get_args();
array_shift($params);
foreach ($module_names as $module_name) {
if($module = Module::getModuleByName($module_name)) ... | [
"public",
"function",
"executeOnlyFor",
"(",
"array",
"$",
"module_names",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"HookProvider",
"::",
"getInstance",
"(",
")",
"->",
"isModuleOperational",
"(",
")",
")",
"{",
"$",
"params",
"="... | Return the resuls of the execution of the hook function for a defined list of modules, only for those enabled.
@param string[] $module_names List of Modules to execute
@return array Results of the hook executions | [
"Return",
"the",
"resuls",
"of",
"the",
"execution",
"of",
"the",
"hook",
"function",
"for",
"a",
"defined",
"list",
"of",
"modules",
"only",
"for",
"those",
"enabled",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Hook/Hook.php#L139-L151 |
34,487 | jon48/webtrees-lib | src/Webtrees/Hook/Hook.php | Hook.execute | public function execute(){
$result = array();
if(HookProvider::getInstance()->isModuleOperational()){
$params = func_get_args();
$sqlquery = '';
$sqlparams = array($this->hook_function);
if($this->hook_context != 'all') {
$sqlparams = array($this->hook_function, $this->hook_context);
$sqlquery =... | php | public function execute(){
$result = array();
if(HookProvider::getInstance()->isModuleOperational()){
$params = func_get_args();
$sqlquery = '';
$sqlparams = array($this->hook_function);
if($this->hook_context != 'all') {
$sqlparams = array($this->hook_function, $this->hook_context);
$sqlquery =... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"HookProvider",
"::",
"getInstance",
"(",
")",
"->",
"isModuleOperational",
"(",
")",
")",
"{",
"$",
"params",
"=",
"func_get_args",
"(",
")",
";",
... | Return the results of the execution of the hook function for all subscribed and enabled modules, in the order defined by their priority.
Parameters can be passed if the hook requires them.
@return array Results of the hook executions | [
"Return",
"the",
"results",
"of",
"the",
"execution",
"of",
"the",
"hook",
"function",
"for",
"all",
"subscribed",
"and",
"enabled",
"modules",
"in",
"the",
"order",
"defined",
"by",
"their",
"priority",
".",
"Parameters",
"can",
"be",
"passed",
"if",
"the",... | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Hook/Hook.php#L159-L179 |
34,488 | jon48/webtrees-lib | src/Webtrees/Hook/Hook.php | Hook.getNumberActiveModules | public function getNumberActiveModules(){
if(HookProvider::getInstance()->isModuleOperational()){
$sqlquery = '';
$sqlparams = array($this->hook_function);
if($this->hook_context != 'all') {
$sqlparams = array($this->hook_function, $this->hook_context);
$sqlquery = " OR majh_hook_context=?";
}
... | php | public function getNumberActiveModules(){
if(HookProvider::getInstance()->isModuleOperational()){
$sqlquery = '';
$sqlparams = array($this->hook_function);
if($this->hook_context != 'all') {
$sqlparams = array($this->hook_function, $this->hook_context);
$sqlquery = " OR majh_hook_context=?";
}
... | [
"public",
"function",
"getNumberActiveModules",
"(",
")",
"{",
"if",
"(",
"HookProvider",
"::",
"getInstance",
"(",
")",
"->",
"isModuleOperational",
"(",
")",
")",
"{",
"$",
"sqlquery",
"=",
"''",
";",
"$",
"sqlparams",
"=",
"array",
"(",
"$",
"this",
"... | Returns the number of active modules linked to a hook
@return int Number of active modules | [
"Returns",
"the",
"number",
"of",
"active",
"modules",
"linked",
"to",
"a",
"hook"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Hook/Hook.php#L186-L201 |
34,489 | jon48/webtrees-lib | src/Webtrees/Module/CertificatesModule.php | CertificatesModule.getProvider | public function getProvider() {
if(!$this->provider) {
$root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/');
$this->provider = new CertificateFileProvider($root_path, Globals::getTree());
}
return $this->provider;
} | php | public function getProvider() {
if(!$this->provider) {
$root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/');
$this->provider = new CertificateFileProvider($root_path, Globals::getTree());
}
return $this->provider;
} | [
"public",
"function",
"getProvider",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"provider",
")",
"{",
"$",
"root_path",
"=",
"$",
"this",
"->",
"getSetting",
"(",
"'MAJ_CERT_ROOTDIR'",
",",
"'certificates/'",
")",
";",
"$",
"this",
"->",
"provider... | Returns the default Certificate File Provider, as configured in the module
@return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface | [
"Returns",
"the",
"default",
"Certificate",
"File",
"Provider",
"as",
"configured",
"in",
"the",
"module"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/CertificatesModule.php#L241-L247 |
34,490 | jon48/webtrees-lib | src/Webtrees/Module/CertificatesModule.php | CertificatesModule.getDisplay_ACT | protected function getDisplay_ACT(Certificate $certificate, $sid = null){
$html = '';
if($certificate){
$certificate->setSource($sid);
$html = $certificate->displayImage('icon');
}
return $html;
} | php | protected function getDisplay_ACT(Certificate $certificate, $sid = null){
$html = '';
if($certificate){
$certificate->setSource($sid);
$html = $certificate->displayImage('icon');
}
return $html;
} | [
"protected",
"function",
"getDisplay_ACT",
"(",
"Certificate",
"$",
"certificate",
",",
"$",
"sid",
"=",
"null",
")",
"{",
"$",
"html",
"=",
"''",
";",
"if",
"(",
"$",
"certificate",
")",
"{",
"$",
"certificate",
"->",
"setSource",
"(",
"$",
"sid",
")"... | Return the HTML code for custom simple tag _ACT
@param Certificate $certificatePath Certificate (as per the GEDCOM)
@param string|null $sid Linked Source ID, if it exists | [
"Return",
"the",
"HTML",
"code",
"for",
"custom",
"simple",
"tag",
"_ACT"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/CertificatesModule.php#L256-L263 |
34,491 | g4code/log | src/Debug.php | Debug.handlerShutdown | public static function handlerShutdown()
{
$error = error_get_last();
if($error !== NULL) {
self::handlerError($error['type'], '[SHUTDOWN] ' . $error['message'], $error['file'], $error['line']);
}
} | php | public static function handlerShutdown()
{
$error = error_get_last();
if($error !== NULL) {
self::handlerError($error['type'], '[SHUTDOWN] ' . $error['message'], $error['file'], $error['line']);
}
} | [
"public",
"static",
"function",
"handlerShutdown",
"(",
")",
"{",
"$",
"error",
"=",
"error_get_last",
"(",
")",
";",
"if",
"(",
"$",
"error",
"!==",
"NULL",
")",
"{",
"self",
"::",
"handlerError",
"(",
"$",
"error",
"[",
"'type'",
"]",
",",
"'[SHUTDOW... | Error handler for fatal errors
@return void | [
"Error",
"handler",
"for",
"fatal",
"errors"
] | 909d06503abbb21ac6c79a61d1b2b1bd89eb26d7 | https://github.com/g4code/log/blob/909d06503abbb21ac6c79a61d1b2b1bd89eb26d7/src/Debug.php#L171-L177 |
34,492 | g4code/log | src/Debug.php | Debug._writeLog | private static function _writeLog($filename, $msg, $addTime = true)
{
// preppend details
if($addTime) {
$msg = self::formatHeaderWithTime() . $msg;
}
if(DI::has('BufferOptions')) {
$options = DI::get('BufferConnectionOptions');
$callback = func... | php | private static function _writeLog($filename, $msg, $addTime = true)
{
// preppend details
if($addTime) {
$msg = self::formatHeaderWithTime() . $msg;
}
if(DI::has('BufferOptions')) {
$options = DI::get('BufferConnectionOptions');
$callback = func... | [
"private",
"static",
"function",
"_writeLog",
"(",
"$",
"filename",
",",
"$",
"msg",
",",
"$",
"addTime",
"=",
"true",
")",
"{",
"// preppend details",
"if",
"(",
"$",
"addTime",
")",
"{",
"$",
"msg",
"=",
"self",
"::",
"formatHeaderWithTime",
"(",
")",
... | Write log with buffer support
@param string $filename
@param string $msg
@return void | [
"Write",
"log",
"with",
"buffer",
"support"
] | 909d06503abbb21ac6c79a61d1b2b1bd89eb26d7 | https://github.com/g4code/log/blob/909d06503abbb21ac6c79a61d1b2b1bd89eb26d7/src/Debug.php#L185-L213 |
34,493 | g4code/log | src/Debug.php | Debug._parseException | private static function _parseException(\Exception $e, $plain_text = false)
{
$exMsg = $e->getMessage();
$exCode = $e->getCode();
$exLine = $e->getLine();
$exFile = basename($e->getFile());
$exTrace = $e->getTrace();
$trace = '';
foreach ($exTrace as $ke... | php | private static function _parseException(\Exception $e, $plain_text = false)
{
$exMsg = $e->getMessage();
$exCode = $e->getCode();
$exLine = $e->getLine();
$exFile = basename($e->getFile());
$exTrace = $e->getTrace();
$trace = '';
foreach ($exTrace as $ke... | [
"private",
"static",
"function",
"_parseException",
"(",
"\\",
"Exception",
"$",
"e",
",",
"$",
"plain_text",
"=",
"false",
")",
"{",
"$",
"exMsg",
"=",
"$",
"e",
"->",
"getMessage",
"(",
")",
";",
"$",
"exCode",
"=",
"$",
"e",
"->",
"getCode",
"(",
... | Parses exceptions into human readable format + html styling
@param Exception $e Exception object that's being parsed
@param bool $plain_text flag to return formated exception, or plain text
@todo: finish plain text implemntation
@return string | [
"Parses",
"exceptions",
"into",
"human",
"readable",
"format",
"+",
"html",
"styling"
] | 909d06503abbb21ac6c79a61d1b2b1bd89eb26d7 | https://github.com/g4code/log/blob/909d06503abbb21ac6c79a61d1b2b1bd89eb26d7/src/Debug.php#L225-L258 |
34,494 | g4code/log | src/Debug.php | Debug.formatRequestData | public static function formatRequestData($asString = true)
{
$fromServer = array(
'REQUEST_URI',
'REQUEST_METHOD',
'HTTP_REFERER',
'QUERY_STRING',
'HTTP_USER_AGENT',
'REMOTE_ADDR',
);
if($asString) {
$s = "\... | php | public static function formatRequestData($asString = true)
{
$fromServer = array(
'REQUEST_URI',
'REQUEST_METHOD',
'HTTP_REFERER',
'QUERY_STRING',
'HTTP_USER_AGENT',
'REMOTE_ADDR',
);
if($asString) {
$s = "\... | [
"public",
"static",
"function",
"formatRequestData",
"(",
"$",
"asString",
"=",
"true",
")",
"{",
"$",
"fromServer",
"=",
"array",
"(",
"'REQUEST_URI'",
",",
"'REQUEST_METHOD'",
",",
"'HTTP_REFERER'",
",",
"'QUERY_STRING'",
",",
"'HTTP_USER_AGENT'",
",",
"'REMOTE_... | Returns all request data formated into string
@return string | [
"Returns",
"all",
"request",
"data",
"formated",
"into",
"string"
] | 909d06503abbb21ac6c79a61d1b2b1bd89eb26d7 | https://github.com/g4code/log/blob/909d06503abbb21ac6c79a61d1b2b1bd89eb26d7/src/Debug.php#L264-L289 |
34,495 | g4code/log | src/Debug.php | Debug._skipFormating | private static function _skipFormating()
{
return false;
if(null !== self::$_isAjaxOrCli) {
return self::$_isAjaxOrCli;
}
self::$_isAjaxOrCli =
(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
||... | php | private static function _skipFormating()
{
return false;
if(null !== self::$_isAjaxOrCli) {
return self::$_isAjaxOrCli;
}
self::$_isAjaxOrCli =
(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
||... | [
"private",
"static",
"function",
"_skipFormating",
"(",
")",
"{",
"return",
"false",
";",
"if",
"(",
"null",
"!==",
"self",
"::",
"$",
"_isAjaxOrCli",
")",
"{",
"return",
"self",
"::",
"$",
"_isAjaxOrCli",
";",
"}",
"self",
"::",
"$",
"_isAjaxOrCli",
"="... | Check if request is ajax or cli and skip formating
@return bool | [
"Check",
"if",
"request",
"is",
"ajax",
"or",
"cli",
"and",
"skip",
"formating"
] | 909d06503abbb21ac6c79a61d1b2b1bd89eb26d7 | https://github.com/g4code/log/blob/909d06503abbb21ac6c79a61d1b2b1bd89eb26d7/src/Debug.php#L306-L319 |
34,496 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getRootIndi | public function getRootIndi() {
$root_indi_id = $this->getRootIndiId();
if(!empty($root_indi_id)) {
return Individual::getInstance($root_indi_id, $this->tree);
}
return null;
} | php | public function getRootIndi() {
$root_indi_id = $this->getRootIndiId();
if(!empty($root_indi_id)) {
return Individual::getInstance($root_indi_id, $this->tree);
}
return null;
} | [
"public",
"function",
"getRootIndi",
"(",
")",
"{",
"$",
"root_indi_id",
"=",
"$",
"this",
"->",
"getRootIndiId",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"root_indi_id",
")",
")",
"{",
"return",
"Individual",
"::",
"getInstance",
"(",
"$",
"r... | Return the root individual for the reference tree and user.
@return Individual Individual | [
"Return",
"the",
"root",
"individual",
"for",
"the",
"reference",
"tree",
"and",
"user",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L128-L134 |
34,497 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.deleteAll | public function deleteAll() {
if(!$this->is_setup) return;
Database::prepare(
'DELETE FROM `##maj_sosa`'.
' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
->execute(array(
'tree_id' => $this->tree->getTreeId(),
'user_id'... | php | public function deleteAll() {
if(!$this->is_setup) return;
Database::prepare(
'DELETE FROM `##maj_sosa`'.
' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
->execute(array(
'tree_id' => $this->tree->getTreeId(),
'user_id'... | [
"public",
"function",
"deleteAll",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
";",
"Database",
"::",
"prepare",
"(",
"'DELETE FROM `##maj_sosa`'",
".",
"' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id '",
")",
"->",
"ex... | Remove all Sosa entries related to the gedcom file and user | [
"Remove",
"all",
"Sosa",
"entries",
"related",
"to",
"the",
"gedcom",
"file",
"and",
"user"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L143-L152 |
34,498 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.deleteAncestors | public function deleteAncestors($sosa) {
if(!$this->is_setup) return;
$gen = Functions::getGeneration($sosa);
Database::prepare(
'DELETE FROM `##maj_sosa`'.
' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' .
' AND majs_gen >= :gen' .
' ... | php | public function deleteAncestors($sosa) {
if(!$this->is_setup) return;
$gen = Functions::getGeneration($sosa);
Database::prepare(
'DELETE FROM `##maj_sosa`'.
' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' .
' AND majs_gen >= :gen' .
' ... | [
"public",
"function",
"deleteAncestors",
"(",
"$",
"sosa",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
";",
"$",
"gen",
"=",
"Functions",
"::",
"getGeneration",
"(",
"$",
"sosa",
")",
";",
"Database",
"::",
"prepare",
"(",
... | Remove all ancestors of a sosa number
@param int $sosa | [
"Remove",
"all",
"ancestors",
"of",
"a",
"sosa",
"number"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L159-L173 |
34,499 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getAllSosaWithGenerations | public function getAllSosaWithGenerations(){
if(!$this->is_setup) return array();
return Database::prepare(
'SELECT majs_i_id AS indi,' .
' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' .
' FROM `##maj_sosa`' .
' WHERE... | php | public function getAllSosaWithGenerations(){
if(!$this->is_setup) return array();
return Database::prepare(
'SELECT majs_i_id AS indi,' .
' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' .
' FROM `##maj_sosa`' .
' WHERE... | [
"public",
"function",
"getAllSosaWithGenerations",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"array",
"(",
")",
";",
"return",
"Database",
"::",
"prepare",
"(",
"'SELECT majs_i_id AS indi,'",
".",
"' GROUP_CONCAT(DISTINCT majs_ge... | Return the list of all sosas, with the generations it belongs to
@return array Associative array of Sosa ancestors, with their generation, comma separated | [
"Return",
"the",
"list",
"of",
"all",
"sosas",
"with",
"the",
"generations",
"it",
"belongs",
"to"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L263-L275 |
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.