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
sequence | docstring
stringlengths 3
47.2k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 91
247
|
---|---|---|---|---|---|---|---|---|---|---|---|
11,700 | BapCat/Persist | src/Driver.php | Driver.getDirectory | public function getDirectory(string $path): Directory {
if($this->isFile($path)) {
throw new NotADirectoryException($path);
}
return $this->instantiateDir($path);
} | php | public function getDirectory(string $path): Directory {
if($this->isFile($path)) {
throw new NotADirectoryException($path);
}
return $this->instantiateDir($path);
} | [
"public",
"function",
"getDirectory",
"(",
"string",
"$",
"path",
")",
":",
"Directory",
"{",
"if",
"(",
"$",
"this",
"->",
"isFile",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"NotADirectoryException",
"(",
"$",
"path",
")",
";",
"}",
"return",
"$",
"this",
"->",
"instantiateDir",
"(",
"$",
"path",
")",
";",
"}"
] | Gets a directory from the storage medium
@param string $path The path of the directory
@return Directory A directory object
@throws NotADirectoryException if <tt>$path</tt> is not a directory | [
"Gets",
"a",
"directory",
"from",
"the",
"storage",
"medium"
] | 0bc53dc50d0c40ecb519c88e33d77889619dbc20 | https://github.com/BapCat/Persist/blob/0bc53dc50d0c40ecb519c88e33d77889619dbc20/src/Driver.php#L34-L40 |
11,701 | Innmind/RestBundle | Client/LoaderFactory.php | LoaderFactory.make | public function make($host)
{
$host = $this->resolver->resolve($host, '/');
$hash = md5($host);
if (isset($this->instances[$hash])) {
return $this->instances[$hash];
}
$dir = sprintf(
'%s/%s',
rtrim($this->cacheDir, '/'),
$hash
);
$instance = new Loader(
new FileCache(sprintf(
'%s/definitions.php',
$dir
)),
$this->resolver,
$this->builder,
$this->http,
$this->validator
);
$this->instances[$hash] = $instance;
return $instance;
} | php | public function make($host)
{
$host = $this->resolver->resolve($host, '/');
$hash = md5($host);
if (isset($this->instances[$hash])) {
return $this->instances[$hash];
}
$dir = sprintf(
'%s/%s',
rtrim($this->cacheDir, '/'),
$hash
);
$instance = new Loader(
new FileCache(sprintf(
'%s/definitions.php',
$dir
)),
$this->resolver,
$this->builder,
$this->http,
$this->validator
);
$this->instances[$hash] = $instance;
return $instance;
} | [
"public",
"function",
"make",
"(",
"$",
"host",
")",
"{",
"$",
"host",
"=",
"$",
"this",
"->",
"resolver",
"->",
"resolve",
"(",
"$",
"host",
",",
"'/'",
")",
";",
"$",
"hash",
"=",
"md5",
"(",
"$",
"host",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"$",
"hash",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"instances",
"[",
"$",
"hash",
"]",
";",
"}",
"$",
"dir",
"=",
"sprintf",
"(",
"'%s/%s'",
",",
"rtrim",
"(",
"$",
"this",
"->",
"cacheDir",
",",
"'/'",
")",
",",
"$",
"hash",
")",
";",
"$",
"instance",
"=",
"new",
"Loader",
"(",
"new",
"FileCache",
"(",
"sprintf",
"(",
"'%s/definitions.php'",
",",
"$",
"dir",
")",
")",
",",
"$",
"this",
"->",
"resolver",
",",
"$",
"this",
"->",
"builder",
",",
"$",
"this",
"->",
"http",
",",
"$",
"this",
"->",
"validator",
")",
";",
"$",
"this",
"->",
"instances",
"[",
"$",
"hash",
"]",
"=",
"$",
"instance",
";",
"return",
"$",
"instance",
";",
"}"
] | Create a loader for a given host
@param string $host
@return Loader | [
"Create",
"a",
"loader",
"for",
"a",
"given",
"host"
] | 46de57d9b45dfbfcf98867be3c601fba57f2edc2 | https://github.com/Innmind/RestBundle/blob/46de57d9b45dfbfcf98867be3c601fba57f2edc2/Client/LoaderFactory.php#L41-L68 |
11,702 | harvestcloud/CoreBundle | Repository/SellerWindowRepository.php | SellerWindowRepository.findOneForHubIdAndStartTime | public function findOneForHubIdAndStartTime($hub_id, $start_time)
{
$qb = $this->getEntityManager()->createQueryBuilder()
->from('HarvestCloudCoreBundle:SellerWindow', 'pw')
->select('pw')
->where('pw.start_time = :start_time')
->andWhere('pw.start_time > :now')
->setParameter('start_time', date('Y-m-d H:i:s', $start_time))
->setParameter('now', date('Y-m-d H:i:s'))
;
$q = $qb->getQuery();
return $q->getOneOrNullResult();
} | php | public function findOneForHubIdAndStartTime($hub_id, $start_time)
{
$qb = $this->getEntityManager()->createQueryBuilder()
->from('HarvestCloudCoreBundle:SellerWindow', 'pw')
->select('pw')
->where('pw.start_time = :start_time')
->andWhere('pw.start_time > :now')
->setParameter('start_time', date('Y-m-d H:i:s', $start_time))
->setParameter('now', date('Y-m-d H:i:s'))
;
$q = $qb->getQuery();
return $q->getOneOrNullResult();
} | [
"public",
"function",
"findOneForHubIdAndStartTime",
"(",
"$",
"hub_id",
",",
"$",
"start_time",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"createQueryBuilder",
"(",
")",
"->",
"from",
"(",
"'HarvestCloudCoreBundle:SellerWindow'",
",",
"'pw'",
")",
"->",
"select",
"(",
"'pw'",
")",
"->",
"where",
"(",
"'pw.start_time = :start_time'",
")",
"->",
"andWhere",
"(",
"'pw.start_time > :now'",
")",
"->",
"setParameter",
"(",
"'start_time'",
",",
"date",
"(",
"'Y-m-d H:i:s'",
",",
"$",
"start_time",
")",
")",
"->",
"setParameter",
"(",
"'now'",
",",
"date",
"(",
"'Y-m-d H:i:s'",
")",
")",
";",
"$",
"q",
"=",
"$",
"qb",
"->",
"getQuery",
"(",
")",
";",
"return",
"$",
"q",
"->",
"getOneOrNullResult",
"(",
")",
";",
"}"
] | Find for hub_id and datetime
@author Tom Haskins-Vaughan <[email protected]>
@since 2012-05-19
@param int $hub_id
@param string $start_time | [
"Find",
"for",
"hub_id",
"and",
"datetime"
] | f33e079c4a6191cf674aa2678f2fb2e6f0dd89cc | https://github.com/harvestcloud/CoreBundle/blob/f33e079c4a6191cf674aa2678f2fb2e6f0dd89cc/Repository/SellerWindowRepository.php#L26-L40 |
11,703 | harvestcloud/CoreBundle | Repository/SellerWindowRepository.php | SellerWindowRepository.findUpcomingForSeller | public function findUpcomingForSeller(Profile $seller)
{
$em = $this->getEntityManager();
$q = $em->createQuery('
SELECT w
FROM HarvestCloudCoreBundle:SellerWindow w
LEFT JOIN w.sellerHubRef shr
LEFT JOIN shr.hub h
WHERE shr.seller = :seller
AND w.end_time >= :now
')
->setParameter('seller', $seller)
->setParameter('now', date('Y-m-d H:i:s'))
;
return $q->getResult();
} | php | public function findUpcomingForSeller(Profile $seller)
{
$em = $this->getEntityManager();
$q = $em->createQuery('
SELECT w
FROM HarvestCloudCoreBundle:SellerWindow w
LEFT JOIN w.sellerHubRef shr
LEFT JOIN shr.hub h
WHERE shr.seller = :seller
AND w.end_time >= :now
')
->setParameter('seller', $seller)
->setParameter('now', date('Y-m-d H:i:s'))
;
return $q->getResult();
} | [
"public",
"function",
"findUpcomingForSeller",
"(",
"Profile",
"$",
"seller",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"q",
"=",
"$",
"em",
"->",
"createQuery",
"(",
"'\n SELECT w\n FROM HarvestCloudCoreBundle:SellerWindow w\n LEFT JOIN w.sellerHubRef shr\n LEFT JOIN shr.hub h\n WHERE shr.seller = :seller\n AND w.end_time >= :now\n '",
")",
"->",
"setParameter",
"(",
"'seller'",
",",
"$",
"seller",
")",
"->",
"setParameter",
"(",
"'now'",
",",
"date",
"(",
"'Y-m-d H:i:s'",
")",
")",
";",
"return",
"$",
"q",
"->",
"getResult",
"(",
")",
";",
"}"
] | Find upcoming for a given Seller
@author Tom Haskins-Vaughan <[email protected]>
@since 2012-10-10
@param Profile $seller | [
"Find",
"upcoming",
"for",
"a",
"given",
"Seller"
] | f33e079c4a6191cf674aa2678f2fb2e6f0dd89cc | https://github.com/harvestcloud/CoreBundle/blob/f33e079c4a6191cf674aa2678f2fb2e6f0dd89cc/Repository/SellerWindowRepository.php#L50-L67 |
11,704 | flavorzyb/wechat | src/Sdk/JsApiTicket.php | JsApiTicket.saveTicket | private function saveTicket($ticket, $expire)
{
$data = ['ticket' => $ticket, 'expire' => intval($expire), 'time' => time()];
return ($this->getFileSystem()->put($this->getTicketFilePath(), serialize($data), true) > 0);
} | php | private function saveTicket($ticket, $expire)
{
$data = ['ticket' => $ticket, 'expire' => intval($expire), 'time' => time()];
return ($this->getFileSystem()->put($this->getTicketFilePath(), serialize($data), true) > 0);
} | [
"private",
"function",
"saveTicket",
"(",
"$",
"ticket",
",",
"$",
"expire",
")",
"{",
"$",
"data",
"=",
"[",
"'ticket'",
"=>",
"$",
"ticket",
",",
"'expire'",
"=>",
"intval",
"(",
"$",
"expire",
")",
",",
"'time'",
"=>",
"time",
"(",
")",
"]",
";",
"return",
"(",
"$",
"this",
"->",
"getFileSystem",
"(",
")",
"->",
"put",
"(",
"$",
"this",
"->",
"getTicketFilePath",
"(",
")",
",",
"serialize",
"(",
"$",
"data",
")",
",",
"true",
")",
">",
"0",
")",
";",
"}"
] | save js api ticket to file
@param string $ticket
@param int $expire
@return bool | [
"save",
"js",
"api",
"ticket",
"to",
"file"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Sdk/JsApiTicket.php#L104-L108 |
11,705 | flavorzyb/wechat | src/Sdk/JsApiTicket.php | JsApiTicket.readTicket | private function readTicket()
{
if (!$this->getFileSystem()->isFile($this->getTicketFilePath())) {
return '';
}
$content = trim($this->getFileSystem()->get($this->getTicketFilePath()));
$result = unserialize($content);
if (isset($result['ticket']) && isset($result['expire']) && isset($result['time'])) {
$expireTime = $result['time'] + $result['expire'] - self::EXPIRE_SUB_TIME;
if ($expireTime > time()) {
return $result['ticket'];
}
}
return '';
} | php | private function readTicket()
{
if (!$this->getFileSystem()->isFile($this->getTicketFilePath())) {
return '';
}
$content = trim($this->getFileSystem()->get($this->getTicketFilePath()));
$result = unserialize($content);
if (isset($result['ticket']) && isset($result['expire']) && isset($result['time'])) {
$expireTime = $result['time'] + $result['expire'] - self::EXPIRE_SUB_TIME;
if ($expireTime > time()) {
return $result['ticket'];
}
}
return '';
} | [
"private",
"function",
"readTicket",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getFileSystem",
"(",
")",
"->",
"isFile",
"(",
"$",
"this",
"->",
"getTicketFilePath",
"(",
")",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"content",
"=",
"trim",
"(",
"$",
"this",
"->",
"getFileSystem",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"getTicketFilePath",
"(",
")",
")",
")",
";",
"$",
"result",
"=",
"unserialize",
"(",
"$",
"content",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'ticket'",
"]",
")",
"&&",
"isset",
"(",
"$",
"result",
"[",
"'expire'",
"]",
")",
"&&",
"isset",
"(",
"$",
"result",
"[",
"'time'",
"]",
")",
")",
"{",
"$",
"expireTime",
"=",
"$",
"result",
"[",
"'time'",
"]",
"+",
"$",
"result",
"[",
"'expire'",
"]",
"-",
"self",
"::",
"EXPIRE_SUB_TIME",
";",
"if",
"(",
"$",
"expireTime",
">",
"time",
"(",
")",
")",
"{",
"return",
"$",
"result",
"[",
"'ticket'",
"]",
";",
"}",
"}",
"return",
"''",
";",
"}"
] | read js api ticket from file
@return string
@throws \Simple\Filesystem\FileNotFoundException | [
"read",
"js",
"api",
"ticket",
"from",
"file"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Sdk/JsApiTicket.php#L116-L133 |
11,706 | 20steps/autotables-bundle | Model/AbstractColumnDescriptor.php | AbstractColumnDescriptor.validate | public function validate() {
if ($this->initializer) {
Ensure::isFalse($this->initializer->getRepository() && $this->initializer->getValue(), 'It makes no sense to define initializer repository and value simultaneously for column [%s]', $this->name);
}
} | php | public function validate() {
if ($this->initializer) {
Ensure::isFalse($this->initializer->getRepository() && $this->initializer->getValue(), 'It makes no sense to define initializer repository and value simultaneously for column [%s]', $this->name);
}
} | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initializer",
")",
"{",
"Ensure",
"::",
"isFalse",
"(",
"$",
"this",
"->",
"initializer",
"->",
"getRepository",
"(",
")",
"&&",
"$",
"this",
"->",
"initializer",
"->",
"getValue",
"(",
")",
",",
"'It makes no sense to define initializer repository and value simultaneously for column [%s]'",
",",
"$",
"this",
"->",
"name",
")",
";",
"}",
"}"
] | Throws an exception if the settings are inconsistent. | [
"Throws",
"an",
"exception",
"if",
"the",
"settings",
"are",
"inconsistent",
"."
] | 12c52f485079766154d0ac784df4b421ce2e1b85 | https://github.com/20steps/autotables-bundle/blob/12c52f485079766154d0ac784df4b421ce2e1b85/Model/AbstractColumnDescriptor.php#L142-L146 |
11,707 | 20steps/autotables-bundle | Model/AbstractColumnDescriptor.php | AbstractColumnDescriptor.getEditableDataString | public function getEditableDataString() {
$valuePairs = array();
if ($this->values) {
foreach ($this->values as $value) {
$valuePairs[] = '\''.$value['label'].'\':\''.$value['value'].'\'';
}
}
return '{'.join(', ',$valuePairs).'}';
} | php | public function getEditableDataString() {
$valuePairs = array();
if ($this->values) {
foreach ($this->values as $value) {
$valuePairs[] = '\''.$value['label'].'\':\''.$value['value'].'\'';
}
}
return '{'.join(', ',$valuePairs).'}';
} | [
"public",
"function",
"getEditableDataString",
"(",
")",
"{",
"$",
"valuePairs",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"values",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"value",
")",
"{",
"$",
"valuePairs",
"[",
"]",
"=",
"'\\''",
".",
"$",
"value",
"[",
"'label'",
"]",
".",
"'\\':\\''",
".",
"$",
"value",
"[",
"'value'",
"]",
".",
"'\\''",
";",
"}",
"}",
"return",
"'{'",
".",
"join",
"(",
"', '",
",",
"$",
"valuePairs",
")",
".",
"'}'",
";",
"}"
] | Returns the viewType specific data string for the editable plugin. | [
"Returns",
"the",
"viewType",
"specific",
"data",
"string",
"for",
"the",
"editable",
"plugin",
"."
] | 12c52f485079766154d0ac784df4b421ce2e1b85 | https://github.com/20steps/autotables-bundle/blob/12c52f485079766154d0ac784df4b421ce2e1b85/Model/AbstractColumnDescriptor.php#L222-L230 |
11,708 | perseids-project/perseids-clients-manager | src/Entity/ClientRepository.php | ClientRepository.update | public function update(Client $client)
{
$this->getEntityManager()->persist($client);
$this->getEntityManager()->flush();
} | php | public function update(Client $client)
{
$this->getEntityManager()->persist($client);
$this->getEntityManager()->flush();
} | [
"public",
"function",
"update",
"(",
"Client",
"$",
"client",
")",
"{",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"persist",
"(",
"$",
"client",
")",
";",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"flush",
"(",
")",
";",
"}"
] | Update a client in the DB
@param Client $client [description]
@return - | [
"Update",
"a",
"client",
"in",
"the",
"DB"
] | e0f4c9e9b5522001052cf6cfc7b2543a4a1cc378 | https://github.com/perseids-project/perseids-clients-manager/blob/e0f4c9e9b5522001052cf6cfc7b2543a4a1cc378/src/Entity/ClientRepository.php#L46-L50 |
11,709 | perseids-project/perseids-clients-manager | src/Entity/ClientRepository.php | ClientRepository.delete | public function delete(Client $client)
{
$this->getEntityManager()->remove($client);
$this->getEntityManager()->flush();
} | php | public function delete(Client $client)
{
$this->getEntityManager()->remove($client);
$this->getEntityManager()->flush();
} | [
"public",
"function",
"delete",
"(",
"Client",
"$",
"client",
")",
"{",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"remove",
"(",
"$",
"client",
")",
";",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"flush",
"(",
")",
";",
"}"
] | Remove a client from the databasee
@param Client $client A Client instance
@return [type] [description] | [
"Remove",
"a",
"client",
"from",
"the",
"databasee"
] | e0f4c9e9b5522001052cf6cfc7b2543a4a1cc378 | https://github.com/perseids-project/perseids-clients-manager/blob/e0f4c9e9b5522001052cf6cfc7b2543a4a1cc378/src/Entity/ClientRepository.php#L69-L73 |
11,710 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.setDisabledDates | public function setDisabledDates($dates)
{
if (!is_array($dates)) {
$dates = (array) $dates;
}
$this->option_disabled_dates = $dates;
$this->set_options['disabled_dates'] = 'disabledDates';
return $this;
} | php | public function setDisabledDates($dates)
{
if (!is_array($dates)) {
$dates = (array) $dates;
}
$this->option_disabled_dates = $dates;
$this->set_options['disabled_dates'] = 'disabledDates';
return $this;
} | [
"public",
"function",
"setDisabledDates",
"(",
"$",
"dates",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"dates",
")",
")",
"{",
"$",
"dates",
"=",
"(",
"array",
")",
"$",
"dates",
";",
"}",
"$",
"this",
"->",
"option_disabled_dates",
"=",
"$",
"dates",
";",
"$",
"this",
"->",
"set_options",
"[",
"'disabled_dates'",
"]",
"=",
"'disabledDates'",
";",
"return",
"$",
"this",
";",
"}"
] | Sets disabled dates.
Accepts a single date or a list of dates in an array.
@param string|array $dates
@return \Core\Html\Controls\DateTimePicker | [
"Sets",
"disabled",
"dates",
".",
"Accepts",
"a",
"single",
"date",
"or",
"a",
"list",
"of",
"dates",
"in",
"an",
"array",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L203-L213 |
11,711 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.setEnabledDates | public function setEnabledDates($dates)
{
if (!is_array($dates)) {
$dates = (array) $dates;
}
$this->option_enabled_dates = $dates;
$this->set_options['enablede_dates'] = 'enabledDates';
return $this;
} | php | public function setEnabledDates($dates)
{
if (!is_array($dates)) {
$dates = (array) $dates;
}
$this->option_enabled_dates = $dates;
$this->set_options['enablede_dates'] = 'enabledDates';
return $this;
} | [
"public",
"function",
"setEnabledDates",
"(",
"$",
"dates",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"dates",
")",
")",
"{",
"$",
"dates",
"=",
"(",
"array",
")",
"$",
"dates",
";",
"}",
"$",
"this",
"->",
"option_enabled_dates",
"=",
"$",
"dates",
";",
"$",
"this",
"->",
"set_options",
"[",
"'enablede_dates'",
"]",
"=",
"'enabledDates'",
";",
"return",
"$",
"this",
";",
"}"
] | Sets enabled dates.
Accepts a single date or a list of dates in an array.
@param string|array $dates
@return \Core\Html\Controls\DateTimePicker | [
"Sets",
"enabled",
"dates",
".",
"Accepts",
"a",
"single",
"date",
"or",
"a",
"list",
"of",
"dates",
"in",
"an",
"array",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L233-L243 |
11,712 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.showToday | public function showToday($bool = null)
{
if (isset($bool)) {
$this->option_show_today = is_bool($bool) ? $bool : false;
$this->set_options['show_today'] = 'showToday';
return $this;
}
else {
return $this->option_show_today;
}
} | php | public function showToday($bool = null)
{
if (isset($bool)) {
$this->option_show_today = is_bool($bool) ? $bool : false;
$this->set_options['show_today'] = 'showToday';
return $this;
}
else {
return $this->option_show_today;
}
} | [
"public",
"function",
"showToday",
"(",
"$",
"bool",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"bool",
")",
")",
"{",
"$",
"this",
"->",
"option_show_today",
"=",
"is_bool",
"(",
"$",
"bool",
")",
"?",
"$",
"bool",
":",
"false",
";",
"$",
"this",
"->",
"set_options",
"[",
"'show_today'",
"]",
"=",
"'showToday'",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"option_show_today",
";",
"}",
"}"
] | Set flag to use or not use the show today button.
This option is "true" by default.
Calling this method without parameter returns the currently set value.
@param boolean $bool
@return boolean, @return \Core\Html\Controls\DateTimePicker | [
"Set",
"flag",
"to",
"use",
"or",
"not",
"use",
"the",
"show",
"today",
"button",
".",
"This",
"option",
"is",
"true",
"by",
"default",
".",
"Calling",
"this",
"method",
"without",
"parameter",
"returns",
"the",
"currently",
"set",
"value",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L254-L267 |
11,713 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.useCurrent | public function useCurrent($bool = null)
{
if (isset($bool)) {
$this->option_use_current = is_bool($bool) ? $bool : false;
$this->set_options['use_current'] = 'useCurrent';
return $this;
}
else {
return $this->option_show_today;
}
} | php | public function useCurrent($bool = null)
{
if (isset($bool)) {
$this->option_use_current = is_bool($bool) ? $bool : false;
$this->set_options['use_current'] = 'useCurrent';
return $this;
}
else {
return $this->option_show_today;
}
} | [
"public",
"function",
"useCurrent",
"(",
"$",
"bool",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"bool",
")",
")",
"{",
"$",
"this",
"->",
"option_use_current",
"=",
"is_bool",
"(",
"$",
"bool",
")",
"?",
"$",
"bool",
":",
"false",
";",
"$",
"this",
"->",
"set_options",
"[",
"'use_current'",
"]",
"=",
"'useCurrent'",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"option_show_today",
";",
"}",
"}"
] | Set flag to use or not use the current button.
This option is "true" by default.
Calling this method without parameter returns the currently set value.
@param boolean $bool
@return boolean, @return \Core\Html\Controls\DateTimePicker | [
"Set",
"flag",
"to",
"use",
"or",
"not",
"use",
"the",
"current",
"button",
".",
"This",
"option",
"is",
"true",
"by",
"default",
".",
"Calling",
"this",
"method",
"without",
"parameter",
"returns",
"the",
"currently",
"set",
"value",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L278-L291 |
11,714 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.usePickDate | public function usePickDate($bool = null)
{
if (isset($bool)) {
$this->option_pick_date = (bool) $bool;
$this->set_options['pick_date'] = 'pickDate';
return $this;
}
else {
return $this->option_pick_date;
}
} | php | public function usePickDate($bool = null)
{
if (isset($bool)) {
$this->option_pick_date = (bool) $bool;
$this->set_options['pick_date'] = 'pickDate';
return $this;
}
else {
return $this->option_pick_date;
}
} | [
"public",
"function",
"usePickDate",
"(",
"$",
"bool",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"bool",
")",
")",
"{",
"$",
"this",
"->",
"option_pick_date",
"=",
"(",
"bool",
")",
"$",
"bool",
";",
"$",
"this",
"->",
"set_options",
"[",
"'pick_date'",
"]",
"=",
"'pickDate'",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"option_pick_date",
";",
"}",
"}"
] | Set flag for using datepicker.
This option is "true" by default.
Calling this method without parameter returns the currently set value.
@param boolean $bool
@return boolean, \Core\Html\Controls\DateTimePicker | [
"Set",
"flag",
"for",
"using",
"datepicker",
".",
"This",
"option",
"is",
"true",
"by",
"default",
".",
"Calling",
"this",
"method",
"without",
"parameter",
"returns",
"the",
"currently",
"set",
"value",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L412-L425 |
11,715 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.usePickTime | public function usePickTime($bool = null)
{
if (isset($bool)) {
$this->option_pick_time = (bool) $bool;
$this->set_options['pick_time'] = 'pickTime';
return $this;
}
else {
return $this->option_pick_time;
}
} | php | public function usePickTime($bool = null)
{
if (isset($bool)) {
$this->option_pick_time = (bool) $bool;
$this->set_options['pick_time'] = 'pickTime';
return $this;
}
else {
return $this->option_pick_time;
}
} | [
"public",
"function",
"usePickTime",
"(",
"$",
"bool",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"bool",
")",
")",
"{",
"$",
"this",
"->",
"option_pick_time",
"=",
"(",
"bool",
")",
"$",
"bool",
";",
"$",
"this",
"->",
"set_options",
"[",
"'pick_time'",
"]",
"=",
"'pickTime'",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"option_pick_time",
";",
"}",
"}"
] | Set flag for using timepicker.
This option is "true" by default.
Calling this method without parameter returns the currently set value.
@param boolean $bool
@return boolean, \Core\Html\Controls\DateTimePicker | [
"Set",
"flag",
"for",
"using",
"timepicker",
".",
"This",
"option",
"is",
"true",
"by",
"default",
".",
"Calling",
"this",
"method",
"without",
"parameter",
"returns",
"the",
"currently",
"set",
"value",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L436-L449 |
11,716 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.useMinutes | public function useMinutes($bool = null)
{
if (isset($bool)) {
$this->option_use_minutes = (bool) $bool;
$this->set_options['use_minutes'] = 'useMinutes';
return $this;
}
else {
return $this->option_use_minutes;
}
} | php | public function useMinutes($bool = null)
{
if (isset($bool)) {
$this->option_use_minutes = (bool) $bool;
$this->set_options['use_minutes'] = 'useMinutes';
return $this;
}
else {
return $this->option_use_minutes;
}
} | [
"public",
"function",
"useMinutes",
"(",
"$",
"bool",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"bool",
")",
")",
"{",
"$",
"this",
"->",
"option_use_minutes",
"=",
"(",
"bool",
")",
"$",
"bool",
";",
"$",
"this",
"->",
"set_options",
"[",
"'use_minutes'",
"]",
"=",
"'useMinutes'",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"option_use_minutes",
";",
"}",
"}"
] | Set flag to use or not use minutes in timepicker.
This option is "true" by default.
Calling this method without parameter returns the currently set value.
@param boolean $bool
@return boolean, \Core\Html\Controls\DateTimePicker | [
"Set",
"flag",
"to",
"use",
"or",
"not",
"use",
"minutes",
"in",
"timepicker",
".",
"This",
"option",
"is",
"true",
"by",
"default",
".",
"Calling",
"this",
"method",
"without",
"parameter",
"returns",
"the",
"currently",
"set",
"value",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L459-L472 |
11,717 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.useSeconds | public function useSeconds($bool = null)
{
if (isset($bool)) {
$this->option_use_seconds = (bool) $bool;
$this->set_options['use_seconds'] = 'useSeconds';
return $this;
}
else {
return $this->option_use_seconds;
}
} | php | public function useSeconds($bool = null)
{
if (isset($bool)) {
$this->option_use_seconds = (bool) $bool;
$this->set_options['use_seconds'] = 'useSeconds';
return $this;
}
else {
return $this->option_use_seconds;
}
} | [
"public",
"function",
"useSeconds",
"(",
"$",
"bool",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"bool",
")",
")",
"{",
"$",
"this",
"->",
"option_use_seconds",
"=",
"(",
"bool",
")",
"$",
"bool",
";",
"$",
"this",
"->",
"set_options",
"[",
"'use_seconds'",
"]",
"=",
"'useSeconds'",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"option_use_seconds",
";",
"}",
"}"
] | Set flag to use or not use saeconds int timepicker.
This option is "true" by default.
Calling this method without parameter returns the currently set value.
@param boolean $bool
@return boolean, \Core\Html\Controls\DateTimePicker | [
"Set",
"flag",
"to",
"use",
"or",
"not",
"use",
"saeconds",
"int",
"timepicker",
".",
"This",
"option",
"is",
"true",
"by",
"default",
".",
"Calling",
"this",
"method",
"without",
"parameter",
"returns",
"the",
"currently",
"set",
"value",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L483-L496 |
11,718 | tekkla/core-html | Core/Html/Controls/DateTimePicker.php | DateTimePicker.setLocale | public function setLocale(string $locale): DateTimePicker
{
$this->option_locale = $locale;
$this->set_options['locale'] = 'locale';
return $this;
} | php | public function setLocale(string $locale): DateTimePicker
{
$this->option_locale = $locale;
$this->set_options['locale'] = 'locale';
return $this;
} | [
"public",
"function",
"setLocale",
"(",
"string",
"$",
"locale",
")",
":",
"DateTimePicker",
"{",
"$",
"this",
"->",
"option_locale",
"=",
"$",
"locale",
";",
"$",
"this",
"->",
"set_options",
"[",
"'locale'",
"]",
"=",
"'locale'",
";",
"return",
"$",
"this",
";",
"}"
] | Sets locale to use
@param string $locale
@return DateTimePicker | [
"Sets",
"locale",
"to",
"use"
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/DateTimePicker.php#L505-L511 |
11,719 | hermajan/lib | src/net/Net.php | Net.pageURL | public static function pageURL() {
$URL = "http";
if(!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
$URL .= "s";
}
$URL .= "://".$_SERVER["SERVER_NAME"];
if($_SERVER["SERVER_PORT"] != "80") {
$URL .= ":".$_SERVER["SERVER_PORT"];
}
$URL .= $_SERVER["REQUEST_URI"];
return $URL;
} | php | public static function pageURL() {
$URL = "http";
if(!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
$URL .= "s";
}
$URL .= "://".$_SERVER["SERVER_NAME"];
if($_SERVER["SERVER_PORT"] != "80") {
$URL .= ":".$_SERVER["SERVER_PORT"];
}
$URL .= $_SERVER["REQUEST_URI"];
return $URL;
} | [
"public",
"static",
"function",
"pageURL",
"(",
")",
"{",
"$",
"URL",
"=",
"\"http\"",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"\"HTTPS\"",
"]",
")",
"&&",
"$",
"_SERVER",
"[",
"\"HTTPS\"",
"]",
"==",
"\"on\"",
")",
"{",
"$",
"URL",
".=",
"\"s\"",
";",
"}",
"$",
"URL",
".=",
"\"://\"",
".",
"$",
"_SERVER",
"[",
"\"SERVER_NAME\"",
"]",
";",
"if",
"(",
"$",
"_SERVER",
"[",
"\"SERVER_PORT\"",
"]",
"!=",
"\"80\"",
")",
"{",
"$",
"URL",
".=",
"\":\"",
".",
"$",
"_SERVER",
"[",
"\"SERVER_PORT\"",
"]",
";",
"}",
"$",
"URL",
".=",
"$",
"_SERVER",
"[",
"\"REQUEST_URI\"",
"]",
";",
"return",
"$",
"URL",
";",
"}"
] | Returns URL of page, where function is called.
@return string URL of page | [
"Returns",
"URL",
"of",
"page",
"where",
"function",
"is",
"called",
"."
] | 7d666260f5bcee041f130a3c3100f520b5e4bbd2 | https://github.com/hermajan/lib/blob/7d666260f5bcee041f130a3c3100f520b5e4bbd2/src/net/Net.php#L20-L31 |
11,720 | OWeb/OWeb-Framework | OWeb/defaults/controllers/OWeb/widgets/jquery/CodeGenerator.php | CodeGenerator.addOption | public function addOption($name, $defaultValue, $necessary=false){
$this->defValues[$name] = $defaultValue;
if($necessary)
$this->necessary[$name] = true;
} | php | public function addOption($name, $defaultValue, $necessary=false){
$this->defValues[$name] = $defaultValue;
if($necessary)
$this->necessary[$name] = true;
} | [
"public",
"function",
"addOption",
"(",
"$",
"name",
",",
"$",
"defaultValue",
",",
"$",
"necessary",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"defValues",
"[",
"$",
"name",
"]",
"=",
"$",
"defaultValue",
";",
"if",
"(",
"$",
"necessary",
")",
"$",
"this",
"->",
"necessary",
"[",
"$",
"name",
"]",
"=",
"true",
";",
"}"
] | Add an option that this code might have or must have
@param String $name The name of the option
@param String/int $defaultValue The default value this function has
@param Boolean Does the code requires this option to work? | [
"Add",
"an",
"option",
"that",
"this",
"code",
"might",
"have",
"or",
"must",
"have"
] | fb441f51afb16860b0c946a55c36c789fbb125fa | https://github.com/OWeb/OWeb-Framework/blob/fb441f51afb16860b0c946a55c36c789fbb125fa/OWeb/defaults/controllers/OWeb/widgets/jquery/CodeGenerator.php#L57-L61 |
11,721 | OWeb/OWeb-Framework | OWeb/defaults/controllers/OWeb/widgets/jquery/CodeGenerator.php | CodeGenerator.generateJqueryCode | protected function generateJqueryCode($selector, $function){
$code = '$( "'.$selector.'" ).'.$function.'(';
$optionsShown = false;
foreach($this->necessary as $pname => $v){
$pvalue = $this->getParam($pname);
if($pvalue == null)
$pvalue = $this->defValues[$pname];
if(!empty($pvalue) && $pvalue != ""){
if(!$optionsShown){
$code .= '{';
$optionsShown = true;
}else
$code .=',';
$code .= "\n $pname : \"$pvalue\"";
}
}
foreach($this->getParams() as $pname => $pvalue){
if((!isset($this->necessary[$pname]) && isset($this->defValues[$pname]))
|| (isset($this->defValues[$pname]) && strtoupper($this->defValues[$pname]) != strtoupper($pvalue) )){
if(!empty($pvalue) && $pvalue != ""){
if(!$optionsShown){
$code .= '{';
$optionsShown = true;
}else
$code .=',';
unset($necessary[$pname]);
$code .= "\n $pname : $pvalue";
}
}
}
if($optionsShown)
$code .= "\n}";
$code .= ');';
return $code;
} | php | protected function generateJqueryCode($selector, $function){
$code = '$( "'.$selector.'" ).'.$function.'(';
$optionsShown = false;
foreach($this->necessary as $pname => $v){
$pvalue = $this->getParam($pname);
if($pvalue == null)
$pvalue = $this->defValues[$pname];
if(!empty($pvalue) && $pvalue != ""){
if(!$optionsShown){
$code .= '{';
$optionsShown = true;
}else
$code .=',';
$code .= "\n $pname : \"$pvalue\"";
}
}
foreach($this->getParams() as $pname => $pvalue){
if((!isset($this->necessary[$pname]) && isset($this->defValues[$pname]))
|| (isset($this->defValues[$pname]) && strtoupper($this->defValues[$pname]) != strtoupper($pvalue) )){
if(!empty($pvalue) && $pvalue != ""){
if(!$optionsShown){
$code .= '{';
$optionsShown = true;
}else
$code .=',';
unset($necessary[$pname]);
$code .= "\n $pname : $pvalue";
}
}
}
if($optionsShown)
$code .= "\n}";
$code .= ');';
return $code;
} | [
"protected",
"function",
"generateJqueryCode",
"(",
"$",
"selector",
",",
"$",
"function",
")",
"{",
"$",
"code",
"=",
"'$( \"'",
".",
"$",
"selector",
".",
"'\" ).'",
".",
"$",
"function",
".",
"'('",
";",
"$",
"optionsShown",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"necessary",
"as",
"$",
"pname",
"=>",
"$",
"v",
")",
"{",
"$",
"pvalue",
"=",
"$",
"this",
"->",
"getParam",
"(",
"$",
"pname",
")",
";",
"if",
"(",
"$",
"pvalue",
"==",
"null",
")",
"$",
"pvalue",
"=",
"$",
"this",
"->",
"defValues",
"[",
"$",
"pname",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"pvalue",
")",
"&&",
"$",
"pvalue",
"!=",
"\"\"",
")",
"{",
"if",
"(",
"!",
"$",
"optionsShown",
")",
"{",
"$",
"code",
".=",
"'{'",
";",
"$",
"optionsShown",
"=",
"true",
";",
"}",
"else",
"$",
"code",
".=",
"','",
";",
"$",
"code",
".=",
"\"\\n $pname : \\\"$pvalue\\\"\"",
";",
"}",
"}",
"foreach",
"(",
"$",
"this",
"->",
"getParams",
"(",
")",
"as",
"$",
"pname",
"=>",
"$",
"pvalue",
")",
"{",
"if",
"(",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"necessary",
"[",
"$",
"pname",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"defValues",
"[",
"$",
"pname",
"]",
")",
")",
"||",
"(",
"isset",
"(",
"$",
"this",
"->",
"defValues",
"[",
"$",
"pname",
"]",
")",
"&&",
"strtoupper",
"(",
"$",
"this",
"->",
"defValues",
"[",
"$",
"pname",
"]",
")",
"!=",
"strtoupper",
"(",
"$",
"pvalue",
")",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"pvalue",
")",
"&&",
"$",
"pvalue",
"!=",
"\"\"",
")",
"{",
"if",
"(",
"!",
"$",
"optionsShown",
")",
"{",
"$",
"code",
".=",
"'{'",
";",
"$",
"optionsShown",
"=",
"true",
";",
"}",
"else",
"$",
"code",
".=",
"','",
";",
"unset",
"(",
"$",
"necessary",
"[",
"$",
"pname",
"]",
")",
";",
"$",
"code",
".=",
"\"\\n $pname : $pvalue\"",
";",
"}",
"}",
"}",
"if",
"(",
"$",
"optionsShown",
")",
"$",
"code",
".=",
"\"\\n}\"",
";",
"$",
"code",
".=",
"');'",
";",
"return",
"$",
"code",
";",
"}"
] | Generates the jquery code with default values as well
@param type $selector
@param type $function
@return string | [
"Generates",
"the",
"jquery",
"code",
"with",
"default",
"values",
"as",
"well"
] | fb441f51afb16860b0c946a55c36c789fbb125fa | https://github.com/OWeb/OWeb-Framework/blob/fb441f51afb16860b0c946a55c36c789fbb125fa/OWeb/defaults/controllers/OWeb/widgets/jquery/CodeGenerator.php#L98-L149 |
11,722 | OWeb/OWeb-Framework | OWeb/defaults/controllers/OWeb/widgets/jquery/CodeGenerator.php | CodeGenerator.prepareDisplay | public function prepareDisplay(){
if($this->id == null && $this->class == null){
$this->id = (String)(new \OWeb\utils\IdGenerator ());
$displayId = 'id="'.$this->id.'"';
$jid = "#".$this->id;
}else if($this->id == null){
$displayId = 'class="'.$this->class.'"';
$jid = ".".$this->class;
}else{
$displayId = 'id="'.$this->id.'"';
$jid = "#".$this->id;
}
if($this->function == null){
$ex = new \OWeb\Exception("When creating a Jquery Code Generator you need to call setCallFunction to set up the function that needs to be called");
$ex = new \OWeb\types\UserException($this->l("Function unset Error Title"), 0, $ex);
$ex->setUserDescription($this->l("Function unset Error Desc"));
throw $ex;
}
$this->view->id = $displayId;
return $jid;
} | php | public function prepareDisplay(){
if($this->id == null && $this->class == null){
$this->id = (String)(new \OWeb\utils\IdGenerator ());
$displayId = 'id="'.$this->id.'"';
$jid = "#".$this->id;
}else if($this->id == null){
$displayId = 'class="'.$this->class.'"';
$jid = ".".$this->class;
}else{
$displayId = 'id="'.$this->id.'"';
$jid = "#".$this->id;
}
if($this->function == null){
$ex = new \OWeb\Exception("When creating a Jquery Code Generator you need to call setCallFunction to set up the function that needs to be called");
$ex = new \OWeb\types\UserException($this->l("Function unset Error Title"), 0, $ex);
$ex->setUserDescription($this->l("Function unset Error Desc"));
throw $ex;
}
$this->view->id = $displayId;
return $jid;
} | [
"public",
"function",
"prepareDisplay",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
"==",
"null",
"&&",
"$",
"this",
"->",
"class",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"(",
"String",
")",
"(",
"new",
"\\",
"OWeb",
"\\",
"utils",
"\\",
"IdGenerator",
"(",
")",
")",
";",
"$",
"displayId",
"=",
"'id=\"'",
".",
"$",
"this",
"->",
"id",
".",
"'\"'",
";",
"$",
"jid",
"=",
"\"#\"",
".",
"$",
"this",
"->",
"id",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"id",
"==",
"null",
")",
"{",
"$",
"displayId",
"=",
"'class=\"'",
".",
"$",
"this",
"->",
"class",
".",
"'\"'",
";",
"$",
"jid",
"=",
"\".\"",
".",
"$",
"this",
"->",
"class",
";",
"}",
"else",
"{",
"$",
"displayId",
"=",
"'id=\"'",
".",
"$",
"this",
"->",
"id",
".",
"'\"'",
";",
"$",
"jid",
"=",
"\"#\"",
".",
"$",
"this",
"->",
"id",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"function",
"==",
"null",
")",
"{",
"$",
"ex",
"=",
"new",
"\\",
"OWeb",
"\\",
"Exception",
"(",
"\"When creating a Jquery Code Generator you need to call setCallFunction to set up the function that needs to be called\"",
")",
";",
"$",
"ex",
"=",
"new",
"\\",
"OWeb",
"\\",
"types",
"\\",
"UserException",
"(",
"$",
"this",
"->",
"l",
"(",
"\"Function unset Error Title\"",
")",
",",
"0",
",",
"$",
"ex",
")",
";",
"$",
"ex",
"->",
"setUserDescription",
"(",
"$",
"this",
"->",
"l",
"(",
"\"Function unset Error Desc\"",
")",
")",
";",
"throw",
"$",
"ex",
";",
"}",
"$",
"this",
"->",
"view",
"->",
"id",
"=",
"$",
"displayId",
";",
"return",
"$",
"jid",
";",
"}"
] | Makes the necessary verifications to see if the Controller can be displayed.
Will also generate the selector for the jquery call as well as the code needed
for it in the html code
@return string The Jquery selector
@throws \Controller\OWeb\widgets\jquery\OWeb\Exception If the function hasn't been set up | [
"Makes",
"the",
"necessary",
"verifications",
"to",
"see",
"if",
"the",
"Controller",
"can",
"be",
"displayed",
".",
"Will",
"also",
"generate",
"the",
"selector",
"for",
"the",
"jquery",
"call",
"as",
"well",
"as",
"the",
"code",
"needed",
"for",
"it",
"in",
"the",
"html",
"code"
] | fb441f51afb16860b0c946a55c36c789fbb125fa | https://github.com/OWeb/OWeb-Framework/blob/fb441f51afb16860b0c946a55c36c789fbb125fa/OWeb/defaults/controllers/OWeb/widgets/jquery/CodeGenerator.php#L159-L181 |
11,723 | jaztec/jaztec-acl | src/JaztecAcl/Direct/AuthorizedDirectObject.php | AuthorizedDirectObject.checkAcl | public function checkAcl($privilege)
{
// Find the base resource name this module is given.
$moduleName = substr(get_class($this), 0, strpos(get_class($this), '\\'));
$config = $this->getServiceLocator()->get('Config');
$baseName = $config['jaztec_acl']['name'][$moduleName];
$allowed = $this->getAclService()->isAllowed($this->getRole(), $this->aclDenominator, $privilege, $baseName);
return $allowed;
} | php | public function checkAcl($privilege)
{
// Find the base resource name this module is given.
$moduleName = substr(get_class($this), 0, strpos(get_class($this), '\\'));
$config = $this->getServiceLocator()->get('Config');
$baseName = $config['jaztec_acl']['name'][$moduleName];
$allowed = $this->getAclService()->isAllowed($this->getRole(), $this->aclDenominator, $privilege, $baseName);
return $allowed;
} | [
"public",
"function",
"checkAcl",
"(",
"$",
"privilege",
")",
"{",
"// Find the base resource name this module is given.",
"$",
"moduleName",
"=",
"substr",
"(",
"get_class",
"(",
"$",
"this",
")",
",",
"0",
",",
"strpos",
"(",
"get_class",
"(",
"$",
"this",
")",
",",
"'\\\\'",
")",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'Config'",
")",
";",
"$",
"baseName",
"=",
"$",
"config",
"[",
"'jaztec_acl'",
"]",
"[",
"'name'",
"]",
"[",
"$",
"moduleName",
"]",
";",
"$",
"allowed",
"=",
"$",
"this",
"->",
"getAclService",
"(",
")",
"->",
"isAllowed",
"(",
"$",
"this",
"->",
"getRole",
"(",
")",
",",
"$",
"this",
"->",
"aclDenominator",
",",
"$",
"privilege",
",",
"$",
"baseName",
")",
";",
"return",
"$",
"allowed",
";",
"}"
] | Checks the ACL registry.
@param string $privilege
@return boolean | [
"Checks",
"the",
"ACL",
"registry",
"."
] | dcd0f57ee95b362d810b09bfd7efaaf19ea8c4c4 | https://github.com/jaztec/jaztec-acl/blob/dcd0f57ee95b362d810b09bfd7efaaf19ea8c4c4/src/JaztecAcl/Direct/AuthorizedDirectObject.php#L53-L62 |
11,724 | OpenResourceManager/client-php | src/Client/AliasAccount.php | AliasAccount.store | public function store(
$username,
$should_propagate_password = null,
$password = null,
$account_id = null,
$account_identifier = null,
$account_username = null,
$expires_at = null,
$disabled = null
)
{
$fields = [];
//@todo validate params, throw exception when they are missing
$fields['username'] = $username;
if (!is_null($should_propagate_password)) $fields['should_propagate_password'] = $should_propagate_password;
if (!is_null($password)) $fields['password'] = $password;
if (!is_null($account_id)) $fields['account_id'] = $account_id;
if (!is_null($account_identifier)) $fields['account_identifier'] = $account_identifier;
if (!is_null($account_username)) $fields['account_username'] = $account_username;
if (!is_null($expires_at)) $fields['expires_at'] = strftime('%F %R', $expires_at);
if (!is_null($disabled)) $fields['disabled'] = $disabled;
return $this->_post($fields);
} | php | public function store(
$username,
$should_propagate_password = null,
$password = null,
$account_id = null,
$account_identifier = null,
$account_username = null,
$expires_at = null,
$disabled = null
)
{
$fields = [];
//@todo validate params, throw exception when they are missing
$fields['username'] = $username;
if (!is_null($should_propagate_password)) $fields['should_propagate_password'] = $should_propagate_password;
if (!is_null($password)) $fields['password'] = $password;
if (!is_null($account_id)) $fields['account_id'] = $account_id;
if (!is_null($account_identifier)) $fields['account_identifier'] = $account_identifier;
if (!is_null($account_username)) $fields['account_username'] = $account_username;
if (!is_null($expires_at)) $fields['expires_at'] = strftime('%F %R', $expires_at);
if (!is_null($disabled)) $fields['disabled'] = $disabled;
return $this->_post($fields);
} | [
"public",
"function",
"store",
"(",
"$",
"username",
",",
"$",
"should_propagate_password",
"=",
"null",
",",
"$",
"password",
"=",
"null",
",",
"$",
"account_id",
"=",
"null",
",",
"$",
"account_identifier",
"=",
"null",
",",
"$",
"account_username",
"=",
"null",
",",
"$",
"expires_at",
"=",
"null",
",",
"$",
"disabled",
"=",
"null",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"//@todo validate params, throw exception when they are missing",
"$",
"fields",
"[",
"'username'",
"]",
"=",
"$",
"username",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"should_propagate_password",
")",
")",
"$",
"fields",
"[",
"'should_propagate_password'",
"]",
"=",
"$",
"should_propagate_password",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"password",
")",
")",
"$",
"fields",
"[",
"'password'",
"]",
"=",
"$",
"password",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"account_id",
")",
")",
"$",
"fields",
"[",
"'account_id'",
"]",
"=",
"$",
"account_id",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"account_identifier",
")",
")",
"$",
"fields",
"[",
"'account_identifier'",
"]",
"=",
"$",
"account_identifier",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"account_username",
")",
")",
"$",
"fields",
"[",
"'account_username'",
"]",
"=",
"$",
"account_username",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"expires_at",
")",
")",
"$",
"fields",
"[",
"'expires_at'",
"]",
"=",
"strftime",
"(",
"'%F %R'",
",",
"$",
"expires_at",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"disabled",
")",
")",
"$",
"fields",
"[",
"'disabled'",
"]",
"=",
"$",
"disabled",
";",
"return",
"$",
"this",
"->",
"_post",
"(",
"$",
"fields",
")",
";",
"}"
] | Store Alias Account
Create or update an alias account, by it's username.
@param string $username
@param boolean $should_propagate_password
@param string $password
@param int $account_id
@param string $account_identifier
@param string $account_username
@param DateTime $expires_at
@param boolean $disabled
@return \Unirest\Response | [
"Store",
"Alias",
"Account"
] | fa468e3425d32f97294fefed77a7f096f3f8cc86 | https://github.com/OpenResourceManager/client-php/blob/fa468e3425d32f97294fefed77a7f096f3f8cc86/src/Client/AliasAccount.php#L89-L112 |
11,725 | easy-system/es-view | src/Listener/InjectTemplateListener.php | InjectTemplateListener.resolveTemplate | protected function resolveTemplate($controller, $moduleNamespace)
{
$class = get_class($controller);
$server = $this->getServer();
$request = $server->getRequest();
$action = $request->getAttribute('action', 'index');
if (0 !== strpos($class, $moduleNamespace)) {
throw new UnexpectedValueException(sprintf(
'The View Model of Controller "%s" returned unexpected module '
. 'namespace "%s". If you want to use this module namespace, '
. 'you need manually set a template to View Model.',
$class,
$moduleNamespace
));
}
$subNamespace = substr($class, strlen($moduleNamespace) + 1);
$subNamespace = str_replace('Controller', '', $subNamespace);
$subNamespace = str_replace('\\\\', '\\', $subNamespace);
$path = str_replace('\\', '/', $subNamespace) . '/' . $action;
$template = strtolower(
preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1-', $path)
);
return $template;
} | php | protected function resolveTemplate($controller, $moduleNamespace)
{
$class = get_class($controller);
$server = $this->getServer();
$request = $server->getRequest();
$action = $request->getAttribute('action', 'index');
if (0 !== strpos($class, $moduleNamespace)) {
throw new UnexpectedValueException(sprintf(
'The View Model of Controller "%s" returned unexpected module '
. 'namespace "%s". If you want to use this module namespace, '
. 'you need manually set a template to View Model.',
$class,
$moduleNamespace
));
}
$subNamespace = substr($class, strlen($moduleNamespace) + 1);
$subNamespace = str_replace('Controller', '', $subNamespace);
$subNamespace = str_replace('\\\\', '\\', $subNamespace);
$path = str_replace('\\', '/', $subNamespace) . '/' . $action;
$template = strtolower(
preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1-', $path)
);
return $template;
} | [
"protected",
"function",
"resolveTemplate",
"(",
"$",
"controller",
",",
"$",
"moduleNamespace",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"controller",
")",
";",
"$",
"server",
"=",
"$",
"this",
"->",
"getServer",
"(",
")",
";",
"$",
"request",
"=",
"$",
"server",
"->",
"getRequest",
"(",
")",
";",
"$",
"action",
"=",
"$",
"request",
"->",
"getAttribute",
"(",
"'action'",
",",
"'index'",
")",
";",
"if",
"(",
"0",
"!==",
"strpos",
"(",
"$",
"class",
",",
"$",
"moduleNamespace",
")",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"sprintf",
"(",
"'The View Model of Controller \"%s\" returned unexpected module '",
".",
"'namespace \"%s\". If you want to use this module namespace, '",
".",
"'you need manually set a template to View Model.'",
",",
"$",
"class",
",",
"$",
"moduleNamespace",
")",
")",
";",
"}",
"$",
"subNamespace",
"=",
"substr",
"(",
"$",
"class",
",",
"strlen",
"(",
"$",
"moduleNamespace",
")",
"+",
"1",
")",
";",
"$",
"subNamespace",
"=",
"str_replace",
"(",
"'Controller'",
",",
"''",
",",
"$",
"subNamespace",
")",
";",
"$",
"subNamespace",
"=",
"str_replace",
"(",
"'\\\\\\\\'",
",",
"'\\\\'",
",",
"$",
"subNamespace",
")",
";",
"$",
"path",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"subNamespace",
")",
".",
"'/'",
".",
"$",
"action",
";",
"$",
"template",
"=",
"strtolower",
"(",
"preg_replace",
"(",
"'/([a-zA-Z])(?=[A-Z])/'",
",",
"'$1-'",
",",
"$",
"path",
")",
")",
";",
"return",
"$",
"template",
";",
"}"
] | Resolves template for received controller.
@param object $controller The controller
@param string $moduleNamespace The module namespace
@throws \UnexpectedValueException If the controller namespace does not
match with namespace of module
@return string The template name | [
"Resolves",
"template",
"for",
"received",
"controller",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Listener/InjectTemplateListener.php#L71-L99 |
11,726 | wisquimas/valleysofsorcery | admin/mf_post.php | mf_post.mf_post_add_metaboxes | function mf_post_add_metaboxes() {
global $post,$mf_post_values;
//if the user are going to add a new link
//the var $post is not defined and we do nothing
if(!isset($post)) {
return false;
}
$mf_post_values = $this->mf_get_post_values($post->ID);
//Getting the post types
$post_types = $this->mf_get_post_types( array(), 'names' );
foreach ( $post_types as $post_type ){
if ( post_type_supports($post_type, 'page-attributes') && $post_type != 'page' ) {
// If the post type has page-attributes we are going to add
// the meta box for choice a template by hand
// this is because wordpress don't let choice a template
// for any non-page post type
add_meta_box(
'mf_template_attribute',
__('Template'),
array( &$this, 'mf_metabox_template' ),
$post_type,
'side',
'default'
);
}
if( !mf_custom_fields::has_fields($post_type) ) {
continue;
}
//getting the groups (each group is a metabox)
$groups = $this->get_groups_by_post_type($post_type);
//creating the metaboxes
foreach( $groups as $group ) {
if( $this->group_has_fields($group['id'] ) ) {
add_meta_box(
'mf_'.$group['id'],
$group['label'],
array( &$this, 'mf_metabox_content' ),
$post_type,
'normal',
'default',
array( 'group_info' => $group)
);
}
}
}
} | php | function mf_post_add_metaboxes() {
global $post,$mf_post_values;
//if the user are going to add a new link
//the var $post is not defined and we do nothing
if(!isset($post)) {
return false;
}
$mf_post_values = $this->mf_get_post_values($post->ID);
//Getting the post types
$post_types = $this->mf_get_post_types( array(), 'names' );
foreach ( $post_types as $post_type ){
if ( post_type_supports($post_type, 'page-attributes') && $post_type != 'page' ) {
// If the post type has page-attributes we are going to add
// the meta box for choice a template by hand
// this is because wordpress don't let choice a template
// for any non-page post type
add_meta_box(
'mf_template_attribute',
__('Template'),
array( &$this, 'mf_metabox_template' ),
$post_type,
'side',
'default'
);
}
if( !mf_custom_fields::has_fields($post_type) ) {
continue;
}
//getting the groups (each group is a metabox)
$groups = $this->get_groups_by_post_type($post_type);
//creating the metaboxes
foreach( $groups as $group ) {
if( $this->group_has_fields($group['id'] ) ) {
add_meta_box(
'mf_'.$group['id'],
$group['label'],
array( &$this, 'mf_metabox_content' ),
$post_type,
'normal',
'default',
array( 'group_info' => $group)
);
}
}
}
} | [
"function",
"mf_post_add_metaboxes",
"(",
")",
"{",
"global",
"$",
"post",
",",
"$",
"mf_post_values",
";",
"//if the user are going to add a new link",
"//the var $post is not defined and we do nothing",
"if",
"(",
"!",
"isset",
"(",
"$",
"post",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"mf_post_values",
"=",
"$",
"this",
"->",
"mf_get_post_values",
"(",
"$",
"post",
"->",
"ID",
")",
";",
"//Getting the post types",
"$",
"post_types",
"=",
"$",
"this",
"->",
"mf_get_post_types",
"(",
"array",
"(",
")",
",",
"'names'",
")",
";",
"foreach",
"(",
"$",
"post_types",
"as",
"$",
"post_type",
")",
"{",
"if",
"(",
"post_type_supports",
"(",
"$",
"post_type",
",",
"'page-attributes'",
")",
"&&",
"$",
"post_type",
"!=",
"'page'",
")",
"{",
"// If the post type has page-attributes we are going to add",
"// the meta box for choice a template by hand",
"// this is because wordpress don't let choice a template",
"// for any non-page post type",
"add_meta_box",
"(",
"'mf_template_attribute'",
",",
"__",
"(",
"'Template'",
")",
",",
"array",
"(",
"&",
"$",
"this",
",",
"'mf_metabox_template'",
")",
",",
"$",
"post_type",
",",
"'side'",
",",
"'default'",
")",
";",
"}",
"if",
"(",
"!",
"mf_custom_fields",
"::",
"has_fields",
"(",
"$",
"post_type",
")",
")",
"{",
"continue",
";",
"}",
"//getting the groups (each group is a metabox)",
"$",
"groups",
"=",
"$",
"this",
"->",
"get_groups_by_post_type",
"(",
"$",
"post_type",
")",
";",
"//creating the metaboxes",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"group_has_fields",
"(",
"$",
"group",
"[",
"'id'",
"]",
")",
")",
"{",
"add_meta_box",
"(",
"'mf_'",
".",
"$",
"group",
"[",
"'id'",
"]",
",",
"$",
"group",
"[",
"'label'",
"]",
",",
"array",
"(",
"&",
"$",
"this",
",",
"'mf_metabox_content'",
")",
",",
"$",
"post_type",
",",
"'normal'",
",",
"'default'",
",",
"array",
"(",
"'group_info'",
"=>",
"$",
"group",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Adding the metaboxes | [
"Adding",
"the",
"metaboxes"
] | 78a8d8f1d1102c5043e2cf7c98762e63464d2d7a | https://github.com/wisquimas/valleysofsorcery/blob/78a8d8f1d1102c5043e2cf7c98762e63464d2d7a/admin/mf_post.php#L32-L84 |
11,727 | wisquimas/valleysofsorcery | admin/mf_post.php | mf_post.mf_metabox_content | function mf_metabox_content( $post, $metabox ) {
global $mf_domain, $mf_post_values;
//Getting the custom fields for this metabox
$custom_fields = $this->get_custom_fields_by_group($metabox['args']['group_info']['id']);
$group_id = $metabox['args']['group_info']['id'];
//default markup
?>
<div class="mf-group-wrapper group-<?php print $group_id;?>" id="mf_group-<?php print $group_id; ?>" >
<!-- grupos se puede repetir -->
<?php
$extraclass = "";
if( $metabox['args']['group_info']['duplicated'] ) {
$extraclass = "mf_duplicate_group";
$repeated_groups = $this->mf_get_duplicated_groups( $post->ID, $group_id );
} else {
$repeated_groups = 1;
}
for( $group_index = 1; $group_index <= $repeated_groups; $group_index++ ){
$only = ($repeated_groups == 1)? TRUE : FALSE;
$this->mf_draw_group($metabox,$extraclass,$group_index,$custom_fields,$mf_post_values,$only);
}
printf('<input value="%d" id="mf_group_counter_%d" style="display:none" >',$repeated_groups,$group_id);
?>
<!-- fin del grupo -->
</div>
<?php
} | php | function mf_metabox_content( $post, $metabox ) {
global $mf_domain, $mf_post_values;
//Getting the custom fields for this metabox
$custom_fields = $this->get_custom_fields_by_group($metabox['args']['group_info']['id']);
$group_id = $metabox['args']['group_info']['id'];
//default markup
?>
<div class="mf-group-wrapper group-<?php print $group_id;?>" id="mf_group-<?php print $group_id; ?>" >
<!-- grupos se puede repetir -->
<?php
$extraclass = "";
if( $metabox['args']['group_info']['duplicated'] ) {
$extraclass = "mf_duplicate_group";
$repeated_groups = $this->mf_get_duplicated_groups( $post->ID, $group_id );
} else {
$repeated_groups = 1;
}
for( $group_index = 1; $group_index <= $repeated_groups; $group_index++ ){
$only = ($repeated_groups == 1)? TRUE : FALSE;
$this->mf_draw_group($metabox,$extraclass,$group_index,$custom_fields,$mf_post_values,$only);
}
printf('<input value="%d" id="mf_group_counter_%d" style="display:none" >',$repeated_groups,$group_id);
?>
<!-- fin del grupo -->
</div>
<?php
} | [
"function",
"mf_metabox_content",
"(",
"$",
"post",
",",
"$",
"metabox",
")",
"{",
"global",
"$",
"mf_domain",
",",
"$",
"mf_post_values",
";",
"//Getting the custom fields for this metabox",
"$",
"custom_fields",
"=",
"$",
"this",
"->",
"get_custom_fields_by_group",
"(",
"$",
"metabox",
"[",
"'args'",
"]",
"[",
"'group_info'",
"]",
"[",
"'id'",
"]",
")",
";",
"$",
"group_id",
"=",
"$",
"metabox",
"[",
"'args'",
"]",
"[",
"'group_info'",
"]",
"[",
"'id'",
"]",
";",
"//default markup",
"?>\n <div class=\"mf-group-wrapper group-<?php",
"print",
"$",
"group_id",
";",
"?>\" id=\"mf_group-<?php",
"print",
"$",
"group_id",
";",
"?>\" >\n <!-- grupos se puede repetir -->\n <?php",
"$",
"extraclass",
"=",
"\"\"",
";",
"if",
"(",
"$",
"metabox",
"[",
"'args'",
"]",
"[",
"'group_info'",
"]",
"[",
"'duplicated'",
"]",
")",
"{",
"$",
"extraclass",
"=",
"\"mf_duplicate_group\"",
";",
"$",
"repeated_groups",
"=",
"$",
"this",
"->",
"mf_get_duplicated_groups",
"(",
"$",
"post",
"->",
"ID",
",",
"$",
"group_id",
")",
";",
"}",
"else",
"{",
"$",
"repeated_groups",
"=",
"1",
";",
"}",
"for",
"(",
"$",
"group_index",
"=",
"1",
";",
"$",
"group_index",
"<=",
"$",
"repeated_groups",
";",
"$",
"group_index",
"++",
")",
"{",
"$",
"only",
"=",
"(",
"$",
"repeated_groups",
"==",
"1",
")",
"?",
"TRUE",
":",
"FALSE",
";",
"$",
"this",
"->",
"mf_draw_group",
"(",
"$",
"metabox",
",",
"$",
"extraclass",
",",
"$",
"group_index",
",",
"$",
"custom_fields",
",",
"$",
"mf_post_values",
",",
"$",
"only",
")",
";",
"}",
"printf",
"(",
"'<input value=\"%d\" id=\"mf_group_counter_%d\" style=\"display:none\" >'",
",",
"$",
"repeated_groups",
",",
"$",
"group_id",
")",
";",
"?>\n <!-- fin del grupo -->\n </div>\n <?php",
"}"
] | Fill a metabox with custom fields | [
"Fill",
"a",
"metabox",
"with",
"custom",
"fields"
] | 78a8d8f1d1102c5043e2cf7c98762e63464d2d7a | https://github.com/wisquimas/valleysofsorcery/blob/78a8d8f1d1102c5043e2cf7c98762e63464d2d7a/admin/mf_post.php#L89-L117 |
11,728 | wisquimas/valleysofsorcery | admin/mf_post.php | mf_post.mf_get_post_values | function mf_get_post_values( $post_id ) {
global $wpdb;
$raw = $wpdb->get_results(
"SELECT
mfpm.meta_id,
mfpm.field_name,
mfpm.field_count,
mfpm.group_count,
pm.meta_value
FROM
".MF_TABLE_POST_META." as mfpm
LEFT JOIN
".$wpdb->postmeta." as pm
ON
( mfpm.meta_id = pm.meta_id )
WHERE
mfpm.post_id = ".$post_id
);
$data = array();
foreach( $raw as $key => $field ){
$data[$field->field_name][$field->group_count][$field->field_count] = $field->meta_value;
}
return $data;
} | php | function mf_get_post_values( $post_id ) {
global $wpdb;
$raw = $wpdb->get_results(
"SELECT
mfpm.meta_id,
mfpm.field_name,
mfpm.field_count,
mfpm.group_count,
pm.meta_value
FROM
".MF_TABLE_POST_META." as mfpm
LEFT JOIN
".$wpdb->postmeta." as pm
ON
( mfpm.meta_id = pm.meta_id )
WHERE
mfpm.post_id = ".$post_id
);
$data = array();
foreach( $raw as $key => $field ){
$data[$field->field_name][$field->group_count][$field->field_count] = $field->meta_value;
}
return $data;
} | [
"function",
"mf_get_post_values",
"(",
"$",
"post_id",
")",
"{",
"global",
"$",
"wpdb",
";",
"$",
"raw",
"=",
"$",
"wpdb",
"->",
"get_results",
"(",
"\"SELECT\n mfpm.meta_id,\n mfpm.field_name,\n mfpm.field_count,\n mfpm.group_count,\n pm.meta_value\n FROM\n \"",
".",
"MF_TABLE_POST_META",
".",
"\" as mfpm\n LEFT JOIN\n \"",
".",
"$",
"wpdb",
"->",
"postmeta",
".",
"\" as pm\n ON\n ( mfpm.meta_id = pm.meta_id )\n WHERE\n mfpm.post_id = \"",
".",
"$",
"post_id",
")",
";",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"raw",
"as",
"$",
"key",
"=>",
"$",
"field",
")",
"{",
"$",
"data",
"[",
"$",
"field",
"->",
"field_name",
"]",
"[",
"$",
"field",
"->",
"group_count",
"]",
"[",
"$",
"field",
"->",
"field_count",
"]",
"=",
"$",
"field",
"->",
"meta_value",
";",
"}",
"return",
"$",
"data",
";",
"}"
] | retrieve the custom fields values of a certain post | [
"retrieve",
"the",
"custom",
"fields",
"values",
"of",
"a",
"certain",
"post"
] | 78a8d8f1d1102c5043e2cf7c98762e63464d2d7a | https://github.com/wisquimas/valleysofsorcery/blob/78a8d8f1d1102c5043e2cf7c98762e63464d2d7a/admin/mf_post.php#L375-L402 |
11,729 | wisquimas/valleysofsorcery | admin/mf_post.php | mf_post.mf_metabox_template | function mf_metabox_template () {
global $post;
if ( 0 != count( get_page_templates() ) ) {
$template = get_post_meta($post->ID, '_wp_mf_page_template', TRUE);
$template = ($template != '') ? $template : false;
?>
<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($template); ?>
</select>
<?php
}
} | php | function mf_metabox_template () {
global $post;
if ( 0 != count( get_page_templates() ) ) {
$template = get_post_meta($post->ID, '_wp_mf_page_template', TRUE);
$template = ($template != '') ? $template : false;
?>
<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($template); ?>
</select>
<?php
}
} | [
"function",
"mf_metabox_template",
"(",
")",
"{",
"global",
"$",
"post",
";",
"if",
"(",
"0",
"!=",
"count",
"(",
"get_page_templates",
"(",
")",
")",
")",
"{",
"$",
"template",
"=",
"get_post_meta",
"(",
"$",
"post",
"->",
"ID",
",",
"'_wp_mf_page_template'",
",",
"TRUE",
")",
";",
"$",
"template",
"=",
"(",
"$",
"template",
"!=",
"''",
")",
"?",
"$",
"template",
":",
"false",
";",
"?>\n <label class=\"screen-reader-text\" for=\"page_template\"><?php",
"_e",
"(",
"'Page Template'",
")",
"?></label><select name=\"page_template\" id=\"page_template\">\n <option value='default'><?php",
"_e",
"(",
"'Default Template'",
")",
";",
"?></option>\n <?php",
"page_template_dropdown",
"(",
"$",
"template",
")",
";",
"?>\n </select>\n <?php",
"}",
"}"
] | MF Meta box for select template | [
"MF",
"Meta",
"box",
"for",
"select",
"template"
] | 78a8d8f1d1102c5043e2cf7c98762e63464d2d7a | https://github.com/wisquimas/valleysofsorcery/blob/78a8d8f1d1102c5043e2cf7c98762e63464d2d7a/admin/mf_post.php#L624-L638 |
11,730 | squire-assistant/console | Command/Command.php | Command.setAliases | public function setAliases($aliases)
{
if (!is_array($aliases) && !$aliases instanceof \Traversable) {
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
}
foreach ($aliases as $alias) {
$this->validateName($alias);
}
$this->aliases = $aliases;
return $this;
} | php | public function setAliases($aliases)
{
if (!is_array($aliases) && !$aliases instanceof \Traversable) {
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
}
foreach ($aliases as $alias) {
$this->validateName($alias);
}
$this->aliases = $aliases;
return $this;
} | [
"public",
"function",
"setAliases",
"(",
"$",
"aliases",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aliases",
")",
"&&",
"!",
"$",
"aliases",
"instanceof",
"\\",
"Traversable",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$aliases must be an array or an instance of \\Traversable'",
")",
";",
"}",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
")",
"{",
"$",
"this",
"->",
"validateName",
"(",
"$",
"alias",
")",
";",
"}",
"$",
"this",
"->",
"aliases",
"=",
"$",
"aliases",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the aliases for the command.
@param string[] $aliases An array of aliases for the command
@return $this
@throws InvalidArgumentException When an alias is invalid | [
"Sets",
"the",
"aliases",
"for",
"the",
"command",
"."
] | 9e16b975a3b9403af52e2d1b465a625e8936076c | https://github.com/squire-assistant/console/blob/9e16b975a3b9403af52e2d1b465a625e8936076c/Command/Command.php#L564-L577 |
11,731 | rikby/console-helper | src/Helper/Shell/ShellHelper.php | ShellHelper.filterCommand | protected function filterCommand($command, $tail)
{
$command = trim($command);
if (!$command) {
throw new ShellException('Command cannot be empty.');
}
if ($tail && !strpos($command, $tail)) {
$command .= $tail;
}
return $command;
} | php | protected function filterCommand($command, $tail)
{
$command = trim($command);
if (!$command) {
throw new ShellException('Command cannot be empty.');
}
if ($tail && !strpos($command, $tail)) {
$command .= $tail;
}
return $command;
} | [
"protected",
"function",
"filterCommand",
"(",
"$",
"command",
",",
"$",
"tail",
")",
"{",
"$",
"command",
"=",
"trim",
"(",
"$",
"command",
")",
";",
"if",
"(",
"!",
"$",
"command",
")",
"{",
"throw",
"new",
"ShellException",
"(",
"'Command cannot be empty.'",
")",
";",
"}",
"if",
"(",
"$",
"tail",
"&&",
"!",
"strpos",
"(",
"$",
"command",
",",
"$",
"tail",
")",
")",
"{",
"$",
"command",
".=",
"$",
"tail",
";",
"}",
"return",
"$",
"command",
";",
"}"
] | Filter command string
@param string $command
@param string $tail
@return string
@throws ShellException | [
"Filter",
"command",
"string"
] | c618daf79e01439ea6cd60a75c9ff5b09de9b75d | https://github.com/rikby/console-helper/blob/c618daf79e01439ea6cd60a75c9ff5b09de9b75d/src/Helper/Shell/ShellHelper.php#L144-L156 |
11,732 | rikby/console-helper | src/Helper/Shell/ShellHelper.php | ShellHelper.processError | protected function processError($output, $exceptionOnError = true, $exceptionClass = ShellException::class)
{
if ($exceptionOnError && $this->hadError()) {
$exceptionClass = $exceptionClass ?: ShellException::class;
throw new $exceptionClass($output);
}
return $this;
} | php | protected function processError($output, $exceptionOnError = true, $exceptionClass = ShellException::class)
{
if ($exceptionOnError && $this->hadError()) {
$exceptionClass = $exceptionClass ?: ShellException::class;
throw new $exceptionClass($output);
}
return $this;
} | [
"protected",
"function",
"processError",
"(",
"$",
"output",
",",
"$",
"exceptionOnError",
"=",
"true",
",",
"$",
"exceptionClass",
"=",
"ShellException",
"::",
"class",
")",
"{",
"if",
"(",
"$",
"exceptionOnError",
"&&",
"$",
"this",
"->",
"hadError",
"(",
")",
")",
"{",
"$",
"exceptionClass",
"=",
"$",
"exceptionClass",
"?",
":",
"ShellException",
"::",
"class",
";",
"throw",
"new",
"$",
"exceptionClass",
"(",
"$",
"output",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Process error in output
@param string $output
@param bool $exceptionOnError
@param string $exceptionClass
@return $this | [
"Process",
"error",
"in",
"output"
] | c618daf79e01439ea6cd60a75c9ff5b09de9b75d | https://github.com/rikby/console-helper/blob/c618daf79e01439ea6cd60a75c9ff5b09de9b75d/src/Helper/Shell/ShellHelper.php#L196-L204 |
11,733 | teamelf/ext-bulletin | src/Bulletin.php | Bulletin.getAbstract | public function getAbstract($length = 100)
{
$content = $this->getContent();
if (mb_strlen($content) > $length - 3) {
return mb_substr($content, 0, $length - 3) . '...';
} else {
return $content;
}
} | php | public function getAbstract($length = 100)
{
$content = $this->getContent();
if (mb_strlen($content) > $length - 3) {
return mb_substr($content, 0, $length - 3) . '...';
} else {
return $content;
}
} | [
"public",
"function",
"getAbstract",
"(",
"$",
"length",
"=",
"100",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"mb_strlen",
"(",
"$",
"content",
")",
">",
"$",
"length",
"-",
"3",
")",
"{",
"return",
"mb_substr",
"(",
"$",
"content",
",",
"0",
",",
"$",
"length",
"-",
"3",
")",
".",
"'...'",
";",
"}",
"else",
"{",
"return",
"$",
"content",
";",
"}",
"}"
] | get content's abstract
@param int $length
@return string | [
"get",
"content",
"s",
"abstract"
] | 59100b615cfff8fd9645e883a8482b1641144b0f | https://github.com/teamelf/ext-bulletin/blob/59100b615cfff8fd9645e883a8482b1641144b0f/src/Bulletin.php#L174-L182 |
11,734 | zepi/turbo-base | Zepi/Web/AccessControl/src/EventHandler/Profile.php | Profile.execute | public function execute(Framework $framework, WebRequest $request, Response $response)
{
// Prepare the page
$this->setTitle($this->translate('Profile', '\\Zepi\\Web\\AccessControl'));
$menuEntry = $this->activateMenuEntry();
$overviewPage = $this->getOverviewPageRenderer()->render($framework, $menuEntry);
// Display logout message
$response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Profile', array(
'overviewPage' => $overviewPage
)));
} | php | public function execute(Framework $framework, WebRequest $request, Response $response)
{
// Prepare the page
$this->setTitle($this->translate('Profile', '\\Zepi\\Web\\AccessControl'));
$menuEntry = $this->activateMenuEntry();
$overviewPage = $this->getOverviewPageRenderer()->render($framework, $menuEntry);
// Display logout message
$response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Profile', array(
'overviewPage' => $overviewPage
)));
} | [
"public",
"function",
"execute",
"(",
"Framework",
"$",
"framework",
",",
"WebRequest",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"// Prepare the page",
"$",
"this",
"->",
"setTitle",
"(",
"$",
"this",
"->",
"translate",
"(",
"'Profile'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
")",
";",
"$",
"menuEntry",
"=",
"$",
"this",
"->",
"activateMenuEntry",
"(",
")",
";",
"$",
"overviewPage",
"=",
"$",
"this",
"->",
"getOverviewPageRenderer",
"(",
")",
"->",
"render",
"(",
"$",
"framework",
",",
"$",
"menuEntry",
")",
";",
"// Display logout message",
"$",
"response",
"->",
"setOutput",
"(",
"$",
"this",
"->",
"render",
"(",
"'\\\\Zepi\\\\Web\\\\AccessControl\\\\Templates\\\\Profile'",
",",
"array",
"(",
"'overviewPage'",
"=>",
"$",
"overviewPage",
")",
")",
")",
";",
"}"
] | Displays the profile page for an logged in user.
@access public
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\WebRequest $request
@param \Zepi\Turbo\Response\Response $response | [
"Displays",
"the",
"profile",
"page",
"for",
"an",
"logged",
"in",
"user",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/EventHandler/Profile.php#L60-L72 |
11,735 | samurai-fw/samurai | src/Console/Controller/SpecController.php | SpecController.executeAction | public function executeAction()
{
if ($this->isUsage()) return [self::FORWARD_ACTION, 'spec.usage'];
// production
if ($this->application->isProduction() && ! $this->response->confirmation('May I execute spec in production environment ?')) {
$this->send('aborted.');
return;
}
$this->setup();
$this->run();
} | php | public function executeAction()
{
if ($this->isUsage()) return [self::FORWARD_ACTION, 'spec.usage'];
// production
if ($this->application->isProduction() && ! $this->response->confirmation('May I execute spec in production environment ?')) {
$this->send('aborted.');
return;
}
$this->setup();
$this->run();
} | [
"public",
"function",
"executeAction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isUsage",
"(",
")",
")",
"return",
"[",
"self",
"::",
"FORWARD_ACTION",
",",
"'spec.usage'",
"]",
";",
"// production",
"if",
"(",
"$",
"this",
"->",
"application",
"->",
"isProduction",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"response",
"->",
"confirmation",
"(",
"'May I execute spec in production environment ?'",
")",
")",
"{",
"$",
"this",
"->",
"send",
"(",
"'aborted.'",
")",
";",
"return",
";",
"}",
"$",
"this",
"->",
"setup",
"(",
")",
";",
"$",
"this",
"->",
"run",
"(",
")",
";",
"}"
] | execute spec files.
spec step is...
1. setup
4. run spec.
@access public | [
"execute",
"spec",
"files",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Console/Controller/SpecController.php#L66-L78 |
11,736 | samurai-fw/samurai | src/Console/Controller/SpecController.php | SpecController.setup | private function setup()
{
$this->runner = $this->specHelper->getRunner();
$this->setupWorkspace();
$this->setupTargets();
// call initializers
foreach ($this->application->config('spec.initializers.*') as $initializer) {
$initializer($this->application);
}
} | php | private function setup()
{
$this->runner = $this->specHelper->getRunner();
$this->setupWorkspace();
$this->setupTargets();
// call initializers
foreach ($this->application->config('spec.initializers.*') as $initializer) {
$initializer($this->application);
}
} | [
"private",
"function",
"setup",
"(",
")",
"{",
"$",
"this",
"->",
"runner",
"=",
"$",
"this",
"->",
"specHelper",
"->",
"getRunner",
"(",
")",
";",
"$",
"this",
"->",
"setupWorkspace",
"(",
")",
";",
"$",
"this",
"->",
"setupTargets",
"(",
")",
";",
"// call initializers",
"foreach",
"(",
"$",
"this",
"->",
"application",
"->",
"config",
"(",
"'spec.initializers.*'",
")",
"as",
"$",
"initializer",
")",
"{",
"$",
"initializer",
"(",
"$",
"this",
"->",
"application",
")",
";",
"}",
"}"
] | set up for to run spec.
@access private | [
"set",
"up",
"for",
"to",
"run",
"spec",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Console/Controller/SpecController.php#L101-L112 |
11,737 | samurai-fw/samurai | src/Console/Controller/SpecController.php | SpecController.setupWorkspace | private function setupWorkspace()
{
// search spec configuration file.
$config_file_name = $this->runner->getConfigurationFileName();
$dirs = explode(DS, getcwd());
$find = false;
do {
$workspace = join(DS, $dirs);
$config_file_path = $workspace . DS . $config_file_name;
if (file_exists($config_file_path) && is_file($config_file_path)) {
$find = true;
break;
}
} while (array_pop($dirs));
if (!$find) $workspace = getcwd();
$this->runner->setWorkspace($workspace);
} | php | private function setupWorkspace()
{
// search spec configuration file.
$config_file_name = $this->runner->getConfigurationFileName();
$dirs = explode(DS, getcwd());
$find = false;
do {
$workspace = join(DS, $dirs);
$config_file_path = $workspace . DS . $config_file_name;
if (file_exists($config_file_path) && is_file($config_file_path)) {
$find = true;
break;
}
} while (array_pop($dirs));
if (!$find) $workspace = getcwd();
$this->runner->setWorkspace($workspace);
} | [
"private",
"function",
"setupWorkspace",
"(",
")",
"{",
"// search spec configuration file.",
"$",
"config_file_name",
"=",
"$",
"this",
"->",
"runner",
"->",
"getConfigurationFileName",
"(",
")",
";",
"$",
"dirs",
"=",
"explode",
"(",
"DS",
",",
"getcwd",
"(",
")",
")",
";",
"$",
"find",
"=",
"false",
";",
"do",
"{",
"$",
"workspace",
"=",
"join",
"(",
"DS",
",",
"$",
"dirs",
")",
";",
"$",
"config_file_path",
"=",
"$",
"workspace",
".",
"DS",
".",
"$",
"config_file_name",
";",
"if",
"(",
"file_exists",
"(",
"$",
"config_file_path",
")",
"&&",
"is_file",
"(",
"$",
"config_file_path",
")",
")",
"{",
"$",
"find",
"=",
"true",
";",
"break",
";",
"}",
"}",
"while",
"(",
"array_pop",
"(",
"$",
"dirs",
")",
")",
";",
"if",
"(",
"!",
"$",
"find",
")",
"$",
"workspace",
"=",
"getcwd",
"(",
")",
";",
"$",
"this",
"->",
"runner",
"->",
"setWorkspace",
"(",
"$",
"workspace",
")",
";",
"}"
] | Setup workspace.
@access private | [
"Setup",
"workspace",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Console/Controller/SpecController.php#L119-L136 |
11,738 | samurai-fw/samurai | src/Console/Controller/SpecController.php | SpecController.setupTargets | private function setupTargets()
{
// has targets
$args = $this->request->getAsArray('args');
foreach ($args as $arg) {
$this->runner->addTarget(realpath($arg));
}
} | php | private function setupTargets()
{
// has targets
$args = $this->request->getAsArray('args');
foreach ($args as $arg) {
$this->runner->addTarget(realpath($arg));
}
} | [
"private",
"function",
"setupTargets",
"(",
")",
"{",
"// has targets",
"$",
"args",
"=",
"$",
"this",
"->",
"request",
"->",
"getAsArray",
"(",
"'args'",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
")",
"{",
"$",
"this",
"->",
"runner",
"->",
"addTarget",
"(",
"realpath",
"(",
"$",
"arg",
")",
")",
";",
"}",
"}"
] | Setup target.
@access private | [
"Setup",
"target",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Console/Controller/SpecController.php#L143-L150 |
11,739 | athena-oss/php-fluent-webdriver-client | src/Browser/Page/Find/PageFinderBuilder.php | PageFinderBuilder.build | public function build()
{
$pageFinder = new PageFinder($this->browser);
if ($this->isWithAssertions) {
$pageFinder = new PageFinderWithAssertions($pageFinder);
}
if ($this->isWithWaits) {
$pageFinder = new PageFinderWithWaits($pageFinder, $this->timeOutInSeconds);
}
return $pageFinder;
} | php | public function build()
{
$pageFinder = new PageFinder($this->browser);
if ($this->isWithAssertions) {
$pageFinder = new PageFinderWithAssertions($pageFinder);
}
if ($this->isWithWaits) {
$pageFinder = new PageFinderWithWaits($pageFinder, $this->timeOutInSeconds);
}
return $pageFinder;
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"pageFinder",
"=",
"new",
"PageFinder",
"(",
"$",
"this",
"->",
"browser",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isWithAssertions",
")",
"{",
"$",
"pageFinder",
"=",
"new",
"PageFinderWithAssertions",
"(",
"$",
"pageFinder",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isWithWaits",
")",
"{",
"$",
"pageFinder",
"=",
"new",
"PageFinderWithWaits",
"(",
"$",
"pageFinder",
",",
"$",
"this",
"->",
"timeOutInSeconds",
")",
";",
"}",
"return",
"$",
"pageFinder",
";",
"}"
] | Creates and returns a new PageFinder object according to the current builder state.
@return PageFinderInterface | [
"Creates",
"and",
"returns",
"a",
"new",
"PageFinder",
"object",
"according",
"to",
"the",
"current",
"builder",
"state",
"."
] | 0b4cca15ab876bd9af40c115728fafce08ce3472 | https://github.com/athena-oss/php-fluent-webdriver-client/blob/0b4cca15ab876bd9af40c115728fafce08ce3472/src/Browser/Page/Find/PageFinderBuilder.php#L64-L77 |
11,740 | rodmcnew/symfonize-zf-container-bridge | ContainerBridge.php | ContainerBridge.getContainer | public static function getContainer($zendServiceManager = null)
{
if (!self::$container) {
self::$container = new SymfonyContainerWithZFFallback();
}
if (!Module::$zendServiceManager && $zendServiceManager) {
if ($zendServiceManager->has('serviceLocator')) {
$zendServiceManager = $zendServiceManager->get('serviceLocator');
}
Module::$zendServiceManager = $zendServiceManager;
}
return self::$container;
} | php | public static function getContainer($zendServiceManager = null)
{
if (!self::$container) {
self::$container = new SymfonyContainerWithZFFallback();
}
if (!Module::$zendServiceManager && $zendServiceManager) {
if ($zendServiceManager->has('serviceLocator')) {
$zendServiceManager = $zendServiceManager->get('serviceLocator');
}
Module::$zendServiceManager = $zendServiceManager;
}
return self::$container;
} | [
"public",
"static",
"function",
"getContainer",
"(",
"$",
"zendServiceManager",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"container",
")",
"{",
"self",
"::",
"$",
"container",
"=",
"new",
"SymfonyContainerWithZFFallback",
"(",
")",
";",
"}",
"if",
"(",
"!",
"Module",
"::",
"$",
"zendServiceManager",
"&&",
"$",
"zendServiceManager",
")",
"{",
"if",
"(",
"$",
"zendServiceManager",
"->",
"has",
"(",
"'serviceLocator'",
")",
")",
"{",
"$",
"zendServiceManager",
"=",
"$",
"zendServiceManager",
"->",
"get",
"(",
"'serviceLocator'",
")",
";",
"}",
"Module",
"::",
"$",
"zendServiceManager",
"=",
"$",
"zendServiceManager",
";",
"}",
"return",
"self",
"::",
"$",
"container",
";",
"}"
] | Returns the Symfony Container
@param ServiceLocatorInterface $zendServiceManager
@return ContainerInterface | [
"Returns",
"the",
"Symfony",
"Container"
] | 6781ed5686a87a7351e3617c6692ef1fc55e0792 | https://github.com/rodmcnew/symfonize-zf-container-bridge/blob/6781ed5686a87a7351e3617c6692ef1fc55e0792/ContainerBridge.php#L22-L36 |
11,741 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveImageMsg | protected function createReceiveImageMsg(array $data)
{
$result = new WxReceiveImageMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setPicUrl(isset($data['PicUrl']) ? trim($data['PicUrl']) : '');
return $result;
} | php | protected function createReceiveImageMsg(array $data)
{
$result = new WxReceiveImageMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setPicUrl(isset($data['PicUrl']) ? trim($data['PicUrl']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveImageMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveImageMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"$",
"result",
"->",
"setMediaId",
"(",
"isset",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
":",
"''",
")",
";",
"$",
"result",
"->",
"setPicUrl",
"(",
"isset",
"(",
"$",
"data",
"[",
"'PicUrl'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'PicUrl'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create image msg
@param array $data
@return WxReceiveImageMsg | [
"create",
"image",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L66-L73 |
11,742 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveLinkMsg | protected function createReceiveLinkMsg(array $data)
{
$result = new WxReceiveLinkMsg();
$this->initReceiveMsg($result, $data);
$result->setTitle(isset($data['Title']) ? trim($data['Title']) : '');
$result->setDescription(isset($data['Description']) ? trim($data['Description']) : '');
$result->setUrl(isset($data['Url']) ? trim($data['Url']) : '');
return $result;
} | php | protected function createReceiveLinkMsg(array $data)
{
$result = new WxReceiveLinkMsg();
$this->initReceiveMsg($result, $data);
$result->setTitle(isset($data['Title']) ? trim($data['Title']) : '');
$result->setDescription(isset($data['Description']) ? trim($data['Description']) : '');
$result->setUrl(isset($data['Url']) ? trim($data['Url']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveLinkMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveLinkMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"$",
"result",
"->",
"setTitle",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Title'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'Title'",
"]",
")",
":",
"''",
")",
";",
"$",
"result",
"->",
"setDescription",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Description'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'Description'",
"]",
")",
":",
"''",
")",
";",
"$",
"result",
"->",
"setUrl",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Url'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'Url'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create link msg
@param array $data
@return WxReceiveLinkMsg | [
"create",
"link",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L81-L89 |
11,743 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveLocationMsg | protected function createReceiveLocationMsg(array $data)
{
$result = new WxReceiveLocationMsg();
$this->initReceiveMsg($result, $data);
$result->setLocationX(isset($data['Location_X']) ? $data['Location_X']: '');
$result->setLocationY(isset($data['Location_Y']) ? $data['Location_Y'] : '');
$result->setScale(isset($data['Scale']) ? $data['Scale'] : '');
$result->setLabel(isset($data['Label']) ? trim($data['Label']) : '');
return $result;
} | php | protected function createReceiveLocationMsg(array $data)
{
$result = new WxReceiveLocationMsg();
$this->initReceiveMsg($result, $data);
$result->setLocationX(isset($data['Location_X']) ? $data['Location_X']: '');
$result->setLocationY(isset($data['Location_Y']) ? $data['Location_Y'] : '');
$result->setScale(isset($data['Scale']) ? $data['Scale'] : '');
$result->setLabel(isset($data['Label']) ? trim($data['Label']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveLocationMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveLocationMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"$",
"result",
"->",
"setLocationX",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Location_X'",
"]",
")",
"?",
"$",
"data",
"[",
"'Location_X'",
"]",
":",
"''",
")",
";",
"$",
"result",
"->",
"setLocationY",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Location_Y'",
"]",
")",
"?",
"$",
"data",
"[",
"'Location_Y'",
"]",
":",
"''",
")",
";",
"$",
"result",
"->",
"setScale",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Scale'",
"]",
")",
"?",
"$",
"data",
"[",
"'Scale'",
"]",
":",
"''",
")",
";",
"$",
"result",
"->",
"setLabel",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Label'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'Label'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create location msg
@param array $data
@return WxReceiveLocationMsg | [
"create",
"location",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L97-L106 |
11,744 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveShortVideoMsg | protected function createReceiveShortVideoMsg(array $data)
{
$result = new WxReceiveShortVideoMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setThumbMediaId(isset($data['ThumbMediaId']) ? trim($data['ThumbMediaId']) : '');
return $result;
} | php | protected function createReceiveShortVideoMsg(array $data)
{
$result = new WxReceiveShortVideoMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setThumbMediaId(isset($data['ThumbMediaId']) ? trim($data['ThumbMediaId']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveShortVideoMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveShortVideoMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"$",
"result",
"->",
"setMediaId",
"(",
"isset",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
":",
"''",
")",
";",
"$",
"result",
"->",
"setThumbMediaId",
"(",
"isset",
"(",
"$",
"data",
"[",
"'ThumbMediaId'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'ThumbMediaId'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create short video msg
@param array $data
@return WxReceiveShortVideoMsg | [
"create",
"short",
"video",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L114-L121 |
11,745 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveTextMsg | protected function createReceiveTextMsg(array $data)
{
$result = new WxReceiveTextMsg();
$this->initReceiveMsg($result, $data);
if (isset($data['Content'])) {
if (!is_string($data['Content'])) {
Helper::getLogWriter()->debug("[createReceiveTextMsg]" . serialize($data));
$data['Content'] = '';
}
}
$result->setContent(isset($data['Content']) ? trim($data['Content']) : '');
return $result;
} | php | protected function createReceiveTextMsg(array $data)
{
$result = new WxReceiveTextMsg();
$this->initReceiveMsg($result, $data);
if (isset($data['Content'])) {
if (!is_string($data['Content'])) {
Helper::getLogWriter()->debug("[createReceiveTextMsg]" . serialize($data));
$data['Content'] = '';
}
}
$result->setContent(isset($data['Content']) ? trim($data['Content']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveTextMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveTextMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Content'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"data",
"[",
"'Content'",
"]",
")",
")",
"{",
"Helper",
"::",
"getLogWriter",
"(",
")",
"->",
"debug",
"(",
"\"[createReceiveTextMsg]\"",
".",
"serialize",
"(",
"$",
"data",
")",
")",
";",
"$",
"data",
"[",
"'Content'",
"]",
"=",
"''",
";",
"}",
"}",
"$",
"result",
"->",
"setContent",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Content'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'Content'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create text msg
@param array $data
@return WxReceiveTextMsg | [
"create",
"text",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L129-L142 |
11,746 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveVideoMsg | protected function createReceiveVideoMsg(array $data)
{
$result = new WxReceiveVideoMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setThumbMediaId(isset($data['ThumbMediaId']) ? trim($data['ThumbMediaId']) : '');
return $result;
} | php | protected function createReceiveVideoMsg(array $data)
{
$result = new WxReceiveVideoMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setThumbMediaId(isset($data['ThumbMediaId']) ? trim($data['ThumbMediaId']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveVideoMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveVideoMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"$",
"result",
"->",
"setMediaId",
"(",
"isset",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
":",
"''",
")",
";",
"$",
"result",
"->",
"setThumbMediaId",
"(",
"isset",
"(",
"$",
"data",
"[",
"'ThumbMediaId'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'ThumbMediaId'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create video msg
@param array $data
@return WxReceiveVideoMsg | [
"create",
"video",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L150-L157 |
11,747 | flavorzyb/wechat | src/Message/Parser.php | Parser.createReceiveVoiceMsg | protected function createReceiveVoiceMsg(array $data)
{
$result = new WxReceiveVoiceMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setFormat(isset($data['Format']) ? trim($data['Format']) : '');
return $result;
} | php | protected function createReceiveVoiceMsg(array $data)
{
$result = new WxReceiveVoiceMsg();
$this->initReceiveMsg($result, $data);
$result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
$result->setFormat(isset($data['Format']) ? trim($data['Format']) : '');
return $result;
} | [
"protected",
"function",
"createReceiveVoiceMsg",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"new",
"WxReceiveVoiceMsg",
"(",
")",
";",
"$",
"this",
"->",
"initReceiveMsg",
"(",
"$",
"result",
",",
"$",
"data",
")",
";",
"$",
"result",
"->",
"setMediaId",
"(",
"isset",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'MediaId'",
"]",
")",
":",
"''",
")",
";",
"$",
"result",
"->",
"setFormat",
"(",
"isset",
"(",
"$",
"data",
"[",
"'Format'",
"]",
")",
"?",
"trim",
"(",
"$",
"data",
"[",
"'Format'",
"]",
")",
":",
"''",
")",
";",
"return",
"$",
"result",
";",
"}"
] | create Voice msg
@param array $data
@return WxReceiveVoiceMsg | [
"create",
"Voice",
"msg"
] | e7854a193c4d23cc9b84afa465f4706c09e7e7c5 | https://github.com/flavorzyb/wechat/blob/e7854a193c4d23cc9b84afa465f4706c09e7e7c5/src/Message/Parser.php#L165-L172 |
11,748 | Palmabit-IT/authenticator | src/Palmabit/Authentication/Helpers/FileRouteHelper.php | FileRouteHelper.getPermFromRoute | public function getPermFromRoute($route) {
$menu_info = Config::get($this->config_path);
foreach ($menu_info as $menu) {
if ($menu[$this->route_variable_index] == $route) {
return $menu[$this->pemissions_variable_index];
}
}
} | php | public function getPermFromRoute($route) {
$menu_info = Config::get($this->config_path);
foreach ($menu_info as $menu) {
if ($menu[$this->route_variable_index] == $route) {
return $menu[$this->pemissions_variable_index];
}
}
} | [
"public",
"function",
"getPermFromRoute",
"(",
"$",
"route",
")",
"{",
"$",
"menu_info",
"=",
"Config",
"::",
"get",
"(",
"$",
"this",
"->",
"config_path",
")",
";",
"foreach",
"(",
"$",
"menu_info",
"as",
"$",
"menu",
")",
"{",
"if",
"(",
"$",
"menu",
"[",
"$",
"this",
"->",
"route_variable_index",
"]",
"==",
"$",
"route",
")",
"{",
"return",
"$",
"menu",
"[",
"$",
"this",
"->",
"pemissions_variable_index",
"]",
";",
"}",
"}",
"}"
] | Obtain the permissions from a given url
@param $url
@return mixed | [
"Obtain",
"the",
"permissions",
"from",
"a",
"given",
"url"
] | 986cfc7e666e0e1b0312e518d586ec61b08cdb42 | https://github.com/Palmabit-IT/authenticator/blob/986cfc7e666e0e1b0312e518d586ec61b08cdb42/src/Palmabit/Authentication/Helpers/FileRouteHelper.php#L35-L43 |
11,749 | Flowpack/Flowpack.SingleSignOn.DemoInstance | Classes/Flowpack/SingleSignOn/DemoInstance/ViewHelpers/Security/AccountViewHelper.php | AccountViewHelper.render | public function render($as) {
$this->templateVariableContainer->add($as, $this->securityContext->getAccount());
$result = $this->renderChildren();
$this->templateVariableContainer->remove($as);
return $result;
} | php | public function render($as) {
$this->templateVariableContainer->add($as, $this->securityContext->getAccount());
$result = $this->renderChildren();
$this->templateVariableContainer->remove($as);
return $result;
} | [
"public",
"function",
"render",
"(",
"$",
"as",
")",
"{",
"$",
"this",
"->",
"templateVariableContainer",
"->",
"add",
"(",
"$",
"as",
",",
"$",
"this",
"->",
"securityContext",
"->",
"getAccount",
"(",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"renderChildren",
"(",
")",
";",
"$",
"this",
"->",
"templateVariableContainer",
"->",
"remove",
"(",
"$",
"as",
")",
";",
"return",
"$",
"result",
";",
"}"
] | Assign the authenticated account to a template variable
@param string $as Variable name for the account
@return mixed | [
"Assign",
"the",
"authenticated",
"account",
"to",
"a",
"template",
"variable"
] | a3de8fef092cec34e2577832576e32b37ca507c5 | https://github.com/Flowpack/Flowpack.SingleSignOn.DemoInstance/blob/a3de8fef092cec34e2577832576e32b37ca507c5/Classes/Flowpack/SingleSignOn/DemoInstance/ViewHelpers/Security/AccountViewHelper.php#L27-L32 |
11,750 | marcqualie/mongominify | src/MongoMinify/Query.php | Query.isSequentialArray | public function isSequentialArray($array)
{
$counter = 0;
foreach ($array as $key => $value) {
if ($counter !== $key) {
return false;
}
$counter++;
}
return true;
} | php | public function isSequentialArray($array)
{
$counter = 0;
foreach ($array as $key => $value) {
if ($counter !== $key) {
return false;
}
$counter++;
}
return true;
} | [
"public",
"function",
"isSequentialArray",
"(",
"$",
"array",
")",
"{",
"$",
"counter",
"=",
"0",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"counter",
"!==",
"$",
"key",
")",
"{",
"return",
"false",
";",
"}",
"$",
"counter",
"++",
";",
"}",
"return",
"true",
";",
"}"
] | Check if this array is sequential | [
"Check",
"if",
"this",
"array",
"is",
"sequential"
] | 63240a91431e09279009235596bfc7f67636b269 | https://github.com/marcqualie/mongominify/blob/63240a91431e09279009235596bfc7f67636b269/src/MongoMinify/Query.php#L152-L163 |
11,751 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikPlugin.php | PiwikPlugin.setVisitPlugin | public function setVisitPlugin(\BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin = null)
{
$this->visitPlugin = $visitPlugin;
return $this;
} | php | public function setVisitPlugin(\BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin = null)
{
$this->visitPlugin = $visitPlugin;
return $this;
} | [
"public",
"function",
"setVisitPlugin",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitPlugin",
"$",
"visitPlugin",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"visitPlugin",
"=",
"$",
"visitPlugin",
";",
"return",
"$",
"this",
";",
"}"
] | Set visitPlugin.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitPlugin|null $visitPlugin
@return PiwikPlugin | [
"Set",
"visitPlugin",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikPlugin.php#L224-L229 |
11,752 | bishopb/vanilla | applications/dashboard/controllers/class.importcontroller.php | ImportController.Export | public function Export() {
$this->Permission('Garden.Export'); // This permission doesn't exist, so only users with Admin == '1' will succeed.
set_time_limit(60*2);
$Ex = new ExportModel();
$Ex->PDO(Gdn::Database()->Connection());
$Ex->Prefix = Gdn::Database()->DatabasePrefix;
/// 2. Do the export. ///
$Ex->UseCompression = TRUE;
$Ex->BeginExport(PATH_ROOT.DS.'uploads'.DS.'export '.date('Y-m-d His').'.txt.gz', 'Vanilla 2.0');
$Ex->ExportTable('User', 'select * from :_User'); // ":_" will be replace by database prefix
$Ex->ExportTable('Role', 'select * from :_Role');
$Ex->ExportTable('UserRole', 'select * from :_UserRole');
$Ex->ExportTable('Category', 'select * from :_Category');
$Ex->ExportTable('Discussion', 'select * from :_Discussion');
$Ex->ExportTable('Comment', 'select * from :_Comment');
$Ex->ExportTable('Conversation', 'select * from :_Conversation');
$Ex->ExportTable('UserConversation', 'select * from :_UserConversation');
$Ex->ExportTable('ConversationMessage', 'select * from :_ConversationMessage');
$Ex->EndExport();
} | php | public function Export() {
$this->Permission('Garden.Export'); // This permission doesn't exist, so only users with Admin == '1' will succeed.
set_time_limit(60*2);
$Ex = new ExportModel();
$Ex->PDO(Gdn::Database()->Connection());
$Ex->Prefix = Gdn::Database()->DatabasePrefix;
/// 2. Do the export. ///
$Ex->UseCompression = TRUE;
$Ex->BeginExport(PATH_ROOT.DS.'uploads'.DS.'export '.date('Y-m-d His').'.txt.gz', 'Vanilla 2.0');
$Ex->ExportTable('User', 'select * from :_User'); // ":_" will be replace by database prefix
$Ex->ExportTable('Role', 'select * from :_Role');
$Ex->ExportTable('UserRole', 'select * from :_UserRole');
$Ex->ExportTable('Category', 'select * from :_Category');
$Ex->ExportTable('Discussion', 'select * from :_Discussion');
$Ex->ExportTable('Comment', 'select * from :_Comment');
$Ex->ExportTable('Conversation', 'select * from :_Conversation');
$Ex->ExportTable('UserConversation', 'select * from :_UserConversation');
$Ex->ExportTable('ConversationMessage', 'select * from :_ConversationMessage');
$Ex->EndExport();
} | [
"public",
"function",
"Export",
"(",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.Export'",
")",
";",
"// This permission doesn't exist, so only users with Admin == '1' will succeed.\r",
"set_time_limit",
"(",
"60",
"*",
"2",
")",
";",
"$",
"Ex",
"=",
"new",
"ExportModel",
"(",
")",
";",
"$",
"Ex",
"->",
"PDO",
"(",
"Gdn",
"::",
"Database",
"(",
")",
"->",
"Connection",
"(",
")",
")",
";",
"$",
"Ex",
"->",
"Prefix",
"=",
"Gdn",
"::",
"Database",
"(",
")",
"->",
"DatabasePrefix",
";",
"/// 2. Do the export. ///\r",
"$",
"Ex",
"->",
"UseCompression",
"=",
"TRUE",
";",
"$",
"Ex",
"->",
"BeginExport",
"(",
"PATH_ROOT",
".",
"DS",
".",
"'uploads'",
".",
"DS",
".",
"'export '",
".",
"date",
"(",
"'Y-m-d His'",
")",
".",
"'.txt.gz'",
",",
"'Vanilla 2.0'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'User'",
",",
"'select * from :_User'",
")",
";",
"// \":_\" will be replace by database prefix\r",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'Role'",
",",
"'select * from :_Role'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'UserRole'",
",",
"'select * from :_UserRole'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'Category'",
",",
"'select * from :_Category'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'Discussion'",
",",
"'select * from :_Discussion'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'Comment'",
",",
"'select * from :_Comment'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'Conversation'",
",",
"'select * from :_Conversation'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'UserConversation'",
",",
"'select * from :_UserConversation'",
")",
";",
"$",
"Ex",
"->",
"ExportTable",
"(",
"'ConversationMessage'",
",",
"'select * from :_ConversationMessage'",
")",
";",
"$",
"Ex",
"->",
"EndExport",
"(",
")",
";",
"}"
] | Export core Vanilla and Conversations tables.
@since 2.0.0
@access public | [
"Export",
"core",
"Vanilla",
"and",
"Conversations",
"tables",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.importcontroller.php#L34-L59 |
11,753 | bishopb/vanilla | applications/dashboard/controllers/class.importcontroller.php | ImportController.Go | public function Go() {
$this->Permission('Garden.Settings.Manage');
$Imp = new ImportModel();
$Imp->LoadState();
$this->SetData('Steps', $Imp->Steps());
$this->Form = new Gdn_Form();
if($Imp->CurrentStep < 1) {
// Check for the import file.
if($Imp->ImportPath)
$Imp->CurrentStep = 1;
else
Redirect(strtolower($this->Application).'/import');
}
if($Imp->CurrentStep >= 1) {
if($this->Form->IsPostBack())
$Imp->FromPost($this->Form->FormValues());
try {
$Result = $Imp->RunStep($Imp->CurrentStep);
} catch(Exception $Ex) {
$Result = FALSE;
$this->Form->AddError($Ex);
$this->SetJson('Error', TRUE);
}
if($Result === TRUE) {
$Imp->CurrentStep++;
} elseif($Result === 'COMPLETE') {
$this->SetJson('Complete', TRUE);
}
/*elseif(is_array($Result)) {
SaveToConfig(array(
'Garden.Import.CurrentStep' => $CurrentStep,
'Garden.Import.CurrentStepData' => ArrayValue('Data', $Result)));
$this->SetData('CurrentStepMessage', ArrayValue('Message', $Result));
}*/
}
$Imp->SaveState();
$this->Form->SetValidationResults($Imp->Validation->Results());
$this->SetData('Stats', GetValue('Stats', $Imp->Data, array()));
$this->SetData('CurrentStep', $Imp->CurrentStep);
$this->SetData('CurrentStepMessage', GetValue('CurrentStepMessage', $Imp->Data, ''));
$this->SetData('ErrorType', GetValue('ErrorType', $Imp));
if ($this->Data('ErrorType'))
$this->SetJson('Error', TRUE);
$Imp->ToPost($Post);
$this->Form->FormValues($Post);
$this->AddJsFile('import.js');
$this->Render();
} | php | public function Go() {
$this->Permission('Garden.Settings.Manage');
$Imp = new ImportModel();
$Imp->LoadState();
$this->SetData('Steps', $Imp->Steps());
$this->Form = new Gdn_Form();
if($Imp->CurrentStep < 1) {
// Check for the import file.
if($Imp->ImportPath)
$Imp->CurrentStep = 1;
else
Redirect(strtolower($this->Application).'/import');
}
if($Imp->CurrentStep >= 1) {
if($this->Form->IsPostBack())
$Imp->FromPost($this->Form->FormValues());
try {
$Result = $Imp->RunStep($Imp->CurrentStep);
} catch(Exception $Ex) {
$Result = FALSE;
$this->Form->AddError($Ex);
$this->SetJson('Error', TRUE);
}
if($Result === TRUE) {
$Imp->CurrentStep++;
} elseif($Result === 'COMPLETE') {
$this->SetJson('Complete', TRUE);
}
/*elseif(is_array($Result)) {
SaveToConfig(array(
'Garden.Import.CurrentStep' => $CurrentStep,
'Garden.Import.CurrentStepData' => ArrayValue('Data', $Result)));
$this->SetData('CurrentStepMessage', ArrayValue('Message', $Result));
}*/
}
$Imp->SaveState();
$this->Form->SetValidationResults($Imp->Validation->Results());
$this->SetData('Stats', GetValue('Stats', $Imp->Data, array()));
$this->SetData('CurrentStep', $Imp->CurrentStep);
$this->SetData('CurrentStepMessage', GetValue('CurrentStepMessage', $Imp->Data, ''));
$this->SetData('ErrorType', GetValue('ErrorType', $Imp));
if ($this->Data('ErrorType'))
$this->SetJson('Error', TRUE);
$Imp->ToPost($Post);
$this->Form->FormValues($Post);
$this->AddJsFile('import.js');
$this->Render();
} | [
"public",
"function",
"Go",
"(",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.Settings.Manage'",
")",
";",
"$",
"Imp",
"=",
"new",
"ImportModel",
"(",
")",
";",
"$",
"Imp",
"->",
"LoadState",
"(",
")",
";",
"$",
"this",
"->",
"SetData",
"(",
"'Steps'",
",",
"$",
"Imp",
"->",
"Steps",
"(",
")",
")",
";",
"$",
"this",
"->",
"Form",
"=",
"new",
"Gdn_Form",
"(",
")",
";",
"if",
"(",
"$",
"Imp",
"->",
"CurrentStep",
"<",
"1",
")",
"{",
"// Check for the import file.\r",
"if",
"(",
"$",
"Imp",
"->",
"ImportPath",
")",
"$",
"Imp",
"->",
"CurrentStep",
"=",
"1",
";",
"else",
"Redirect",
"(",
"strtolower",
"(",
"$",
"this",
"->",
"Application",
")",
".",
"'/import'",
")",
";",
"}",
"if",
"(",
"$",
"Imp",
"->",
"CurrentStep",
">=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Form",
"->",
"IsPostBack",
"(",
")",
")",
"$",
"Imp",
"->",
"FromPost",
"(",
"$",
"this",
"->",
"Form",
"->",
"FormValues",
"(",
")",
")",
";",
"try",
"{",
"$",
"Result",
"=",
"$",
"Imp",
"->",
"RunStep",
"(",
"$",
"Imp",
"->",
"CurrentStep",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"Ex",
")",
"{",
"$",
"Result",
"=",
"FALSE",
";",
"$",
"this",
"->",
"Form",
"->",
"AddError",
"(",
"$",
"Ex",
")",
";",
"$",
"this",
"->",
"SetJson",
"(",
"'Error'",
",",
"TRUE",
")",
";",
"}",
"if",
"(",
"$",
"Result",
"===",
"TRUE",
")",
"{",
"$",
"Imp",
"->",
"CurrentStep",
"++",
";",
"}",
"elseif",
"(",
"$",
"Result",
"===",
"'COMPLETE'",
")",
"{",
"$",
"this",
"->",
"SetJson",
"(",
"'Complete'",
",",
"TRUE",
")",
";",
"}",
"/*elseif(is_array($Result)) {\r\n\t\t\t\tSaveToConfig(array(\r\n\t\t\t\t\t'Garden.Import.CurrentStep' => $CurrentStep,\r\n\t\t\t\t\t'Garden.Import.CurrentStepData' => ArrayValue('Data', $Result)));\r\n\t\t\t\t$this->SetData('CurrentStepMessage', ArrayValue('Message', $Result));\r\n\t\t\t}*/",
"}",
"$",
"Imp",
"->",
"SaveState",
"(",
")",
";",
"$",
"this",
"->",
"Form",
"->",
"SetValidationResults",
"(",
"$",
"Imp",
"->",
"Validation",
"->",
"Results",
"(",
")",
")",
";",
"$",
"this",
"->",
"SetData",
"(",
"'Stats'",
",",
"GetValue",
"(",
"'Stats'",
",",
"$",
"Imp",
"->",
"Data",
",",
"array",
"(",
")",
")",
")",
";",
"$",
"this",
"->",
"SetData",
"(",
"'CurrentStep'",
",",
"$",
"Imp",
"->",
"CurrentStep",
")",
";",
"$",
"this",
"->",
"SetData",
"(",
"'CurrentStepMessage'",
",",
"GetValue",
"(",
"'CurrentStepMessage'",
",",
"$",
"Imp",
"->",
"Data",
",",
"''",
")",
")",
";",
"$",
"this",
"->",
"SetData",
"(",
"'ErrorType'",
",",
"GetValue",
"(",
"'ErrorType'",
",",
"$",
"Imp",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Data",
"(",
"'ErrorType'",
")",
")",
"$",
"this",
"->",
"SetJson",
"(",
"'Error'",
",",
"TRUE",
")",
";",
"$",
"Imp",
"->",
"ToPost",
"(",
"$",
"Post",
")",
";",
"$",
"this",
"->",
"Form",
"->",
"FormValues",
"(",
"$",
"Post",
")",
";",
"$",
"this",
"->",
"AddJsFile",
"(",
"'import.js'",
")",
";",
"$",
"this",
"->",
"Render",
"(",
")",
";",
"}"
] | Manage importing process.
@since 2.0.0
@access public | [
"Manage",
"importing",
"process",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.importcontroller.php#L67-L122 |
11,754 | bishopb/vanilla | applications/dashboard/controllers/class.importcontroller.php | ImportController.Restart | public function Restart() {
$this->Permission('Garden.Import'); // This permission doesn't exist, so only users with Admin == '1' will succeed.
// Delete the individual table files.
$Imp = new ImportModel();
try {
$Imp->LoadState();
$Imp->DeleteFiles();
} catch(Exception $Ex) {
}
$Imp->DeleteState();
Redirect(strtolower($this->Application).'/import');
} | php | public function Restart() {
$this->Permission('Garden.Import'); // This permission doesn't exist, so only users with Admin == '1' will succeed.
// Delete the individual table files.
$Imp = new ImportModel();
try {
$Imp->LoadState();
$Imp->DeleteFiles();
} catch(Exception $Ex) {
}
$Imp->DeleteState();
Redirect(strtolower($this->Application).'/import');
} | [
"public",
"function",
"Restart",
"(",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.Import'",
")",
";",
"// This permission doesn't exist, so only users with Admin == '1' will succeed.\r",
"// Delete the individual table files.\r",
"$",
"Imp",
"=",
"new",
"ImportModel",
"(",
")",
";",
"try",
"{",
"$",
"Imp",
"->",
"LoadState",
"(",
")",
";",
"$",
"Imp",
"->",
"DeleteFiles",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"Ex",
")",
"{",
"}",
"$",
"Imp",
"->",
"DeleteState",
"(",
")",
";",
"Redirect",
"(",
"strtolower",
"(",
"$",
"this",
"->",
"Application",
")",
".",
"'/import'",
")",
";",
"}"
] | Restart the import process. Undo any work we've done so far and erase state.
@since 2.0.0
@access public | [
"Restart",
"the",
"import",
"process",
".",
"Undo",
"any",
"work",
"we",
"ve",
"done",
"so",
"far",
"and",
"erase",
"state",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.importcontroller.php#L244-L257 |
11,755 | silverstripe-modular-project/silverstripe-placeable | code/models/PlaceableObject_Preset.php | PlaceableObject_Preset.getPlaceableObject | public function getPlaceableObject()
{
if ($this->placeableobject) {
return $this->placeableobject;
}
$instance = Injector::inst()->get($this->ObjectClassName);
$this->placeableobject = $instance;
return $instance;
} | php | public function getPlaceableObject()
{
if ($this->placeableobject) {
return $this->placeableobject;
}
$instance = Injector::inst()->get($this->ObjectClassName);
$this->placeableobject = $instance;
return $instance;
} | [
"public",
"function",
"getPlaceableObject",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"placeableobject",
")",
"{",
"return",
"$",
"this",
"->",
"placeableobject",
";",
"}",
"$",
"instance",
"=",
"Injector",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"ObjectClassName",
")",
";",
"$",
"this",
"->",
"placeableobject",
"=",
"$",
"instance",
";",
"return",
"$",
"instance",
";",
"}"
] | Gets a class instance of PlaceableObject
@return string | [
"Gets",
"a",
"class",
"instance",
"of",
"PlaceableObject"
] | 8ac5891493e5af2efaab7afa93ef2d1c1bea946f | https://github.com/silverstripe-modular-project/silverstripe-placeable/blob/8ac5891493e5af2efaab7afa93ef2d1c1bea946f/code/models/PlaceableObject_Preset.php#L160-L168 |
11,756 | silverstripe-modular-project/silverstripe-placeable | code/models/PlaceableObject_Preset.php | PlaceableObject_Preset.getSubClassNames | public function getSubClassNames()
{
$classes = array();
$killAncestors = array();
// make it easier to unset values
foreach(ClassInfo::subclassesFor($this->ClassName) as $class) {
$classes[$class] = $class;
}
unset(
$classes['PlaceableObject_Preset'],
$classes['BlockObject_Preset'],
$classes['RegionObject_Preset']
);
// figure out if there are any classes we don't want to appear
foreach($classes as $class) {
$instance = singleton($class);
if($instance instanceof HiddenClass) {
unset($classes[$class]);
continue;
};
// apply Translatable name
$classes[$class] = $instance->i18n_singular_name();
// do any of the progeny want to hide an ancestor?
if($ancestor_to_hide = $instance->stat('hide_ancestor')) {
// note for killing later
$killAncestors[] = $ancestor_to_hide;
}
}
// If any of the descendents don't want any of the elders to show up,
// cruelly render the elders surplus to requirements
if($killAncestors) {
$killAncestors = array_unique($killAncestors);
foreach($killAncestors as $mark) {
unset($classes[$mark]);
}
}
return $classes;
} | php | public function getSubClassNames()
{
$classes = array();
$killAncestors = array();
// make it easier to unset values
foreach(ClassInfo::subclassesFor($this->ClassName) as $class) {
$classes[$class] = $class;
}
unset(
$classes['PlaceableObject_Preset'],
$classes['BlockObject_Preset'],
$classes['RegionObject_Preset']
);
// figure out if there are any classes we don't want to appear
foreach($classes as $class) {
$instance = singleton($class);
if($instance instanceof HiddenClass) {
unset($classes[$class]);
continue;
};
// apply Translatable name
$classes[$class] = $instance->i18n_singular_name();
// do any of the progeny want to hide an ancestor?
if($ancestor_to_hide = $instance->stat('hide_ancestor')) {
// note for killing later
$killAncestors[] = $ancestor_to_hide;
}
}
// If any of the descendents don't want any of the elders to show up,
// cruelly render the elders surplus to requirements
if($killAncestors) {
$killAncestors = array_unique($killAncestors);
foreach($killAncestors as $mark) {
unset($classes[$mark]);
}
}
return $classes;
} | [
"public",
"function",
"getSubClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
")",
";",
"$",
"killAncestors",
"=",
"array",
"(",
")",
";",
"// make it easier to unset values",
"foreach",
"(",
"ClassInfo",
"::",
"subclassesFor",
"(",
"$",
"this",
"->",
"ClassName",
")",
"as",
"$",
"class",
")",
"{",
"$",
"classes",
"[",
"$",
"class",
"]",
"=",
"$",
"class",
";",
"}",
"unset",
"(",
"$",
"classes",
"[",
"'PlaceableObject_Preset'",
"]",
",",
"$",
"classes",
"[",
"'BlockObject_Preset'",
"]",
",",
"$",
"classes",
"[",
"'RegionObject_Preset'",
"]",
")",
";",
"// figure out if there are any classes we don't want to appear",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"$",
"instance",
"=",
"singleton",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"instance",
"instanceof",
"HiddenClass",
")",
"{",
"unset",
"(",
"$",
"classes",
"[",
"$",
"class",
"]",
")",
";",
"continue",
";",
"}",
";",
"// apply Translatable name",
"$",
"classes",
"[",
"$",
"class",
"]",
"=",
"$",
"instance",
"->",
"i18n_singular_name",
"(",
")",
";",
"// do any of the progeny want to hide an ancestor?",
"if",
"(",
"$",
"ancestor_to_hide",
"=",
"$",
"instance",
"->",
"stat",
"(",
"'hide_ancestor'",
")",
")",
"{",
"// note for killing later",
"$",
"killAncestors",
"[",
"]",
"=",
"$",
"ancestor_to_hide",
";",
"}",
"}",
"// If any of the descendents don't want any of the elders to show up,",
"// cruelly render the elders surplus to requirements",
"if",
"(",
"$",
"killAncestors",
")",
"{",
"$",
"killAncestors",
"=",
"array_unique",
"(",
"$",
"killAncestors",
")",
";",
"foreach",
"(",
"$",
"killAncestors",
"as",
"$",
"mark",
")",
"{",
"unset",
"(",
"$",
"classes",
"[",
"$",
"mark",
"]",
")",
";",
"}",
"}",
"return",
"$",
"classes",
";",
"}"
] | Get available sub classes from current class
@return array | [
"Get",
"available",
"sub",
"classes",
"from",
"current",
"class"
] | 8ac5891493e5af2efaab7afa93ef2d1c1bea946f | https://github.com/silverstripe-modular-project/silverstripe-placeable/blob/8ac5891493e5af2efaab7afa93ef2d1c1bea946f/code/models/PlaceableObject_Preset.php#L174-L218 |
11,757 | silverstripe-modular-project/silverstripe-placeable | code/models/PlaceableObject_Preset.php | PlaceableObject_Preset.getStyles | public function getStyles()
{
$styles = $this->config()->get('styles');
$i18nStyles = array();
if ($styles) {
foreach ($styles as $key => $label) {
$i18nStyles[$key] = _t('PlaceableObject_Preset.STYLE'.strtoupper($key), $label);
}
}
return $i18nStyles;
} | php | public function getStyles()
{
$styles = $this->config()->get('styles');
$i18nStyles = array();
if ($styles) {
foreach ($styles as $key => $label) {
$i18nStyles[$key] = _t('PlaceableObject_Preset.STYLE'.strtoupper($key), $label);
}
}
return $i18nStyles;
} | [
"public",
"function",
"getStyles",
"(",
")",
"{",
"$",
"styles",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'styles'",
")",
";",
"$",
"i18nStyles",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"styles",
")",
"{",
"foreach",
"(",
"$",
"styles",
"as",
"$",
"key",
"=>",
"$",
"label",
")",
"{",
"$",
"i18nStyles",
"[",
"$",
"key",
"]",
"=",
"_t",
"(",
"'PlaceableObject_Preset.STYLE'",
".",
"strtoupper",
"(",
"$",
"key",
")",
",",
"$",
"label",
")",
";",
"}",
"}",
"return",
"$",
"i18nStyles",
";",
"}"
] | Get available template styles from config
@return array | [
"Get",
"available",
"template",
"styles",
"from",
"config"
] | 8ac5891493e5af2efaab7afa93ef2d1c1bea946f | https://github.com/silverstripe-modular-project/silverstripe-placeable/blob/8ac5891493e5af2efaab7afa93ef2d1c1bea946f/code/models/PlaceableObject_Preset.php#L262-L272 |
11,758 | phlexible/phlexible | src/Phlexible/Bundle/MessageBundle/Digest/Digest.php | Digest.sendDigestMails | public function sendDigestMails()
{
$subscriptionRepository = $this->entityManager->getRepository('PhlexibleMessageBundle:Subscription');
$subscriptions = $subscriptionRepository->findByHandler('digest');
$digests = [];
foreach ($subscriptions as $subscription) {
$filter = $this->filterManager->find($subscription->getFilterId());
if (!$filter) {
continue;
}
$user = $this->userManager->find($subscription->getUserId());
if (!$user || !$user->getEmail()) {
continue;
}
$lastSend = $subscription->getAttribute('lastSend', null);
if (!$lastSend) {
$lastSend = new \DateTime();
$lastSend = $lastSend->sub(new \DateInterval('P30D'));
} else {
$lastSend = new \DateTime($lastSend);
}
$criteria = new Criteria([$filter->getCriteria()], Criteria::MODE_AND);
$criteria->dateFrom($lastSend);
$messages = $this->messageRepository->findByCriteria($criteria);
if (!count($messages)) {
continue;
}
if ($this->mailer->sendDigestMail($user, $messages)) {
$digests[] = ['filter' => $filter->getTitle(), 'to' => $user->getEmail(), 'status' => 'ok'];
$subscription->setAttribute('lastSend', date('Y-m-d H:i:s'));
$this->subscriptionRepository->save($subscription);
} else {
$digests[] = ['filter' => $filter->getTitle(), 'to' => $user->getEmail(), 'status' => 'failed'];
}
}
if (count($digests)) {
$message = Message::create(
count($digests).' digest mail(s) sent.',
'Status: '.PHP_EOL.print_r($digests, true),
Message::PRIORITY_NORMAL,
null,
'ROLE_MESSAGES',
'cli'
);
$this->messageService->post($message);
}
return $digests;
} | php | public function sendDigestMails()
{
$subscriptionRepository = $this->entityManager->getRepository('PhlexibleMessageBundle:Subscription');
$subscriptions = $subscriptionRepository->findByHandler('digest');
$digests = [];
foreach ($subscriptions as $subscription) {
$filter = $this->filterManager->find($subscription->getFilterId());
if (!$filter) {
continue;
}
$user = $this->userManager->find($subscription->getUserId());
if (!$user || !$user->getEmail()) {
continue;
}
$lastSend = $subscription->getAttribute('lastSend', null);
if (!$lastSend) {
$lastSend = new \DateTime();
$lastSend = $lastSend->sub(new \DateInterval('P30D'));
} else {
$lastSend = new \DateTime($lastSend);
}
$criteria = new Criteria([$filter->getCriteria()], Criteria::MODE_AND);
$criteria->dateFrom($lastSend);
$messages = $this->messageRepository->findByCriteria($criteria);
if (!count($messages)) {
continue;
}
if ($this->mailer->sendDigestMail($user, $messages)) {
$digests[] = ['filter' => $filter->getTitle(), 'to' => $user->getEmail(), 'status' => 'ok'];
$subscription->setAttribute('lastSend', date('Y-m-d H:i:s'));
$this->subscriptionRepository->save($subscription);
} else {
$digests[] = ['filter' => $filter->getTitle(), 'to' => $user->getEmail(), 'status' => 'failed'];
}
}
if (count($digests)) {
$message = Message::create(
count($digests).' digest mail(s) sent.',
'Status: '.PHP_EOL.print_r($digests, true),
Message::PRIORITY_NORMAL,
null,
'ROLE_MESSAGES',
'cli'
);
$this->messageService->post($message);
}
return $digests;
} | [
"public",
"function",
"sendDigestMails",
"(",
")",
"{",
"$",
"subscriptionRepository",
"=",
"$",
"this",
"->",
"entityManager",
"->",
"getRepository",
"(",
"'PhlexibleMessageBundle:Subscription'",
")",
";",
"$",
"subscriptions",
"=",
"$",
"subscriptionRepository",
"->",
"findByHandler",
"(",
"'digest'",
")",
";",
"$",
"digests",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"subscriptions",
"as",
"$",
"subscription",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"filterManager",
"->",
"find",
"(",
"$",
"subscription",
"->",
"getFilterId",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"filter",
")",
"{",
"continue",
";",
"}",
"$",
"user",
"=",
"$",
"this",
"->",
"userManager",
"->",
"find",
"(",
"$",
"subscription",
"->",
"getUserId",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"user",
"||",
"!",
"$",
"user",
"->",
"getEmail",
"(",
")",
")",
"{",
"continue",
";",
"}",
"$",
"lastSend",
"=",
"$",
"subscription",
"->",
"getAttribute",
"(",
"'lastSend'",
",",
"null",
")",
";",
"if",
"(",
"!",
"$",
"lastSend",
")",
"{",
"$",
"lastSend",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"lastSend",
"=",
"$",
"lastSend",
"->",
"sub",
"(",
"new",
"\\",
"DateInterval",
"(",
"'P30D'",
")",
")",
";",
"}",
"else",
"{",
"$",
"lastSend",
"=",
"new",
"\\",
"DateTime",
"(",
"$",
"lastSend",
")",
";",
"}",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"[",
"$",
"filter",
"->",
"getCriteria",
"(",
")",
"]",
",",
"Criteria",
"::",
"MODE_AND",
")",
";",
"$",
"criteria",
"->",
"dateFrom",
"(",
"$",
"lastSend",
")",
";",
"$",
"messages",
"=",
"$",
"this",
"->",
"messageRepository",
"->",
"findByCriteria",
"(",
"$",
"criteria",
")",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"messages",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"mailer",
"->",
"sendDigestMail",
"(",
"$",
"user",
",",
"$",
"messages",
")",
")",
"{",
"$",
"digests",
"[",
"]",
"=",
"[",
"'filter'",
"=>",
"$",
"filter",
"->",
"getTitle",
"(",
")",
",",
"'to'",
"=>",
"$",
"user",
"->",
"getEmail",
"(",
")",
",",
"'status'",
"=>",
"'ok'",
"]",
";",
"$",
"subscription",
"->",
"setAttribute",
"(",
"'lastSend'",
",",
"date",
"(",
"'Y-m-d H:i:s'",
")",
")",
";",
"$",
"this",
"->",
"subscriptionRepository",
"->",
"save",
"(",
"$",
"subscription",
")",
";",
"}",
"else",
"{",
"$",
"digests",
"[",
"]",
"=",
"[",
"'filter'",
"=>",
"$",
"filter",
"->",
"getTitle",
"(",
")",
",",
"'to'",
"=>",
"$",
"user",
"->",
"getEmail",
"(",
")",
",",
"'status'",
"=>",
"'failed'",
"]",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"digests",
")",
")",
"{",
"$",
"message",
"=",
"Message",
"::",
"create",
"(",
"count",
"(",
"$",
"digests",
")",
".",
"' digest mail(s) sent.'",
",",
"'Status: '",
".",
"PHP_EOL",
".",
"print_r",
"(",
"$",
"digests",
",",
"true",
")",
",",
"Message",
"::",
"PRIORITY_NORMAL",
",",
"null",
",",
"'ROLE_MESSAGES'",
",",
"'cli'",
")",
";",
"$",
"this",
"->",
"messageService",
"->",
"post",
"(",
"$",
"message",
")",
";",
"}",
"return",
"$",
"digests",
";",
"}"
] | Static send function for use with events.
@return array | [
"Static",
"send",
"function",
"for",
"use",
"with",
"events",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/MessageBundle/Digest/Digest.php#L88-L142 |
11,759 | mimmi20/ua-result-company | src/CompanyLoader.php | CompanyLoader.load | public function load(string $key): CompanyInterface
{
if (!$this->has($key)) {
throw new NotFoundException('the company with key "' . $key . '" was not found');
}
$company = $this->companies[$key];
return new Company(
$key,
$company['name'],
$company['brandname']
);
} | php | public function load(string $key): CompanyInterface
{
if (!$this->has($key)) {
throw new NotFoundException('the company with key "' . $key . '" was not found');
}
$company = $this->companies[$key];
return new Company(
$key,
$company['name'],
$company['brandname']
);
} | [
"public",
"function",
"load",
"(",
"string",
"$",
"key",
")",
":",
"CompanyInterface",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"'the company with key \"'",
".",
"$",
"key",
".",
"'\" was not found'",
")",
";",
"}",
"$",
"company",
"=",
"$",
"this",
"->",
"companies",
"[",
"$",
"key",
"]",
";",
"return",
"new",
"Company",
"(",
"$",
"key",
",",
"$",
"company",
"[",
"'name'",
"]",
",",
"$",
"company",
"[",
"'brandname'",
"]",
")",
";",
"}"
] | Gets the information about the company
@param string $key
@throws \BrowserDetector\Loader\NotFoundException
@return \UaResult\Company\CompanyInterface | [
"Gets",
"the",
"information",
"about",
"the",
"company"
] | 16d4454169c004ddb1d00ad736d9296cecafd002 | https://github.com/mimmi20/ua-result-company/blob/16d4454169c004ddb1d00ad736d9296cecafd002/src/CompanyLoader.php#L91-L104 |
11,760 | phlexible/phlexible | src/Phlexible/Bundle/GuiBundle/Properties/Properties.php | Properties.remove | public function remove($component, $name)
{
$this->load();
$propertyKey = sprintf('%s__%s', $component, $name);
if (isset($this->properties[$propertyKey])) {
$this->entityManager->remove($this->properties[$propertyKey]);
unset($this->properties[$propertyKey]);
}
return $this;
} | php | public function remove($component, $name)
{
$this->load();
$propertyKey = sprintf('%s__%s', $component, $name);
if (isset($this->properties[$propertyKey])) {
$this->entityManager->remove($this->properties[$propertyKey]);
unset($this->properties[$propertyKey]);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"component",
",",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"load",
"(",
")",
";",
"$",
"propertyKey",
"=",
"sprintf",
"(",
"'%s__%s'",
",",
"$",
"component",
",",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"properties",
"[",
"$",
"propertyKey",
"]",
")",
")",
"{",
"$",
"this",
"->",
"entityManager",
"->",
"remove",
"(",
"$",
"this",
"->",
"properties",
"[",
"$",
"propertyKey",
"]",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"properties",
"[",
"$",
"propertyKey",
"]",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Remove property.
@param string $component
@param string $name
@return $this | [
"Remove",
"property",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/GuiBundle/Properties/Properties.php#L105-L117 |
11,761 | phlexible/phlexible | src/Phlexible/Bundle/GuiBundle/Properties/Properties.php | Properties.has | public function has($component, $name)
{
$this->load();
return (bool) mb_strlen($this->get($component, $name));
} | php | public function has($component, $name)
{
$this->load();
return (bool) mb_strlen($this->get($component, $name));
} | [
"public",
"function",
"has",
"(",
"$",
"component",
",",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"load",
"(",
")",
";",
"return",
"(",
"bool",
")",
"mb_strlen",
"(",
"$",
"this",
"->",
"get",
"(",
"$",
"component",
",",
"$",
"name",
")",
")",
";",
"}"
] | Is property set?
@param string $component
@param string $name
@return bool | [
"Is",
"property",
"set?"
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/GuiBundle/Properties/Properties.php#L127-L132 |
11,762 | oyjz/phpQuery-single | phpQuery.php | DOMDocumentWrapper.documentFragmentCreate | protected function documentFragmentCreate($source, $charset = null)
{
$fake = new DOMDocumentWrapper();
$fake->contentType = $this->contentType;
$fake->isXML = $this->isXML;
$fake->isHTML = $this->isHTML;
$fake->isXHTML = $this->isXHTML;
$fake->root = $fake->document;
if (!$charset) {
$charset = $this->charset;
}
// $fake->documentCreate($this->charset);
if ($source instanceof DOMNODE && !($source instanceof DOMNODELIST)) {
$source = array($source);
}
if (is_array($source) || $source instanceof DOMNODELIST) {
// dom nodes
// load fake document
if (!$this->documentFragmentLoadMarkup($fake, $charset)) {
return false;
}
$nodes = $fake->import($source);
foreach ($nodes as $node)
$fake->root->appendChild($node);
} else {
// string markup
$this->documentFragmentLoadMarkup($fake, $charset, $source);
}
return $fake;
} | php | protected function documentFragmentCreate($source, $charset = null)
{
$fake = new DOMDocumentWrapper();
$fake->contentType = $this->contentType;
$fake->isXML = $this->isXML;
$fake->isHTML = $this->isHTML;
$fake->isXHTML = $this->isXHTML;
$fake->root = $fake->document;
if (!$charset) {
$charset = $this->charset;
}
// $fake->documentCreate($this->charset);
if ($source instanceof DOMNODE && !($source instanceof DOMNODELIST)) {
$source = array($source);
}
if (is_array($source) || $source instanceof DOMNODELIST) {
// dom nodes
// load fake document
if (!$this->documentFragmentLoadMarkup($fake, $charset)) {
return false;
}
$nodes = $fake->import($source);
foreach ($nodes as $node)
$fake->root->appendChild($node);
} else {
// string markup
$this->documentFragmentLoadMarkup($fake, $charset, $source);
}
return $fake;
} | [
"protected",
"function",
"documentFragmentCreate",
"(",
"$",
"source",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"$",
"fake",
"=",
"new",
"DOMDocumentWrapper",
"(",
")",
";",
"$",
"fake",
"->",
"contentType",
"=",
"$",
"this",
"->",
"contentType",
";",
"$",
"fake",
"->",
"isXML",
"=",
"$",
"this",
"->",
"isXML",
";",
"$",
"fake",
"->",
"isHTML",
"=",
"$",
"this",
"->",
"isHTML",
";",
"$",
"fake",
"->",
"isXHTML",
"=",
"$",
"this",
"->",
"isXHTML",
";",
"$",
"fake",
"->",
"root",
"=",
"$",
"fake",
"->",
"document",
";",
"if",
"(",
"!",
"$",
"charset",
")",
"{",
"$",
"charset",
"=",
"$",
"this",
"->",
"charset",
";",
"}",
"//\t$fake->documentCreate($this->charset);",
"if",
"(",
"$",
"source",
"instanceof",
"DOMNODE",
"&&",
"!",
"(",
"$",
"source",
"instanceof",
"DOMNODELIST",
")",
")",
"{",
"$",
"source",
"=",
"array",
"(",
"$",
"source",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"source",
")",
"||",
"$",
"source",
"instanceof",
"DOMNODELIST",
")",
"{",
"// dom nodes",
"// load fake document",
"if",
"(",
"!",
"$",
"this",
"->",
"documentFragmentLoadMarkup",
"(",
"$",
"fake",
",",
"$",
"charset",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"nodes",
"=",
"$",
"fake",
"->",
"import",
"(",
"$",
"source",
")",
";",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"$",
"fake",
"->",
"root",
"->",
"appendChild",
"(",
"$",
"node",
")",
";",
"}",
"else",
"{",
"// string markup",
"$",
"this",
"->",
"documentFragmentLoadMarkup",
"(",
"$",
"fake",
",",
"$",
"charset",
",",
"$",
"source",
")",
";",
"}",
"return",
"$",
"fake",
";",
"}"
] | Creates new document fragment.
@param $source
@return DOMDocumentWrapper | bool | [
"Creates",
"new",
"document",
"fragment",
"."
] | d91fafb8aa75a9080640c4b96f592785da557d0d | https://github.com/oyjz/phpQuery-single/blob/d91fafb8aa75a9080640c4b96f592785da557d0d/phpQuery.php#L703-L733 |
11,763 | rozaverta/cmf | core/Language/Lang.php | Lang.reload | public function reload( string $language ): bool
{
$language = trim( $language );
if( ! self::valid($language) )
{
return false;
}
if( $this->language === $language && $this->lang_init )
{
return true;
}
$packages = is_null($this->lang) ? [] : $this->lang->packages();
$this->language = $language;
$this->lang = null;
$this->lang_init = true;
$this->proxy = [];
$event = new LanguageLoadEvent($this);
EventManager::dispatch(
$event,
function( $result ) use($event) {
if( $result instanceof Language )
{
$this->lang = $result;
$event->stopPropagation();
}
});
if( is_null($this->lang) )
{
$this->lang = new LanguageFiles($language);
}
$this->lang_i18 = $this->lang instanceof I18Interface;
$this->lang_transliteration = $this->lang instanceof TransliterationInterface;
$this->lang_text = $this->lang instanceof TextInterface;
$this->lang_is_default = $this->lang === $this->lang_default;
foreach($packages as $package)
{
$this->lang->load($package);
}
return true;
} | php | public function reload( string $language ): bool
{
$language = trim( $language );
if( ! self::valid($language) )
{
return false;
}
if( $this->language === $language && $this->lang_init )
{
return true;
}
$packages = is_null($this->lang) ? [] : $this->lang->packages();
$this->language = $language;
$this->lang = null;
$this->lang_init = true;
$this->proxy = [];
$event = new LanguageLoadEvent($this);
EventManager::dispatch(
$event,
function( $result ) use($event) {
if( $result instanceof Language )
{
$this->lang = $result;
$event->stopPropagation();
}
});
if( is_null($this->lang) )
{
$this->lang = new LanguageFiles($language);
}
$this->lang_i18 = $this->lang instanceof I18Interface;
$this->lang_transliteration = $this->lang instanceof TransliterationInterface;
$this->lang_text = $this->lang instanceof TextInterface;
$this->lang_is_default = $this->lang === $this->lang_default;
foreach($packages as $package)
{
$this->lang->load($package);
}
return true;
} | [
"public",
"function",
"reload",
"(",
"string",
"$",
"language",
")",
":",
"bool",
"{",
"$",
"language",
"=",
"trim",
"(",
"$",
"language",
")",
";",
"if",
"(",
"!",
"self",
"::",
"valid",
"(",
"$",
"language",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"language",
"===",
"$",
"language",
"&&",
"$",
"this",
"->",
"lang_init",
")",
"{",
"return",
"true",
";",
"}",
"$",
"packages",
"=",
"is_null",
"(",
"$",
"this",
"->",
"lang",
")",
"?",
"[",
"]",
":",
"$",
"this",
"->",
"lang",
"->",
"packages",
"(",
")",
";",
"$",
"this",
"->",
"language",
"=",
"$",
"language",
";",
"$",
"this",
"->",
"lang",
"=",
"null",
";",
"$",
"this",
"->",
"lang_init",
"=",
"true",
";",
"$",
"this",
"->",
"proxy",
"=",
"[",
"]",
";",
"$",
"event",
"=",
"new",
"LanguageLoadEvent",
"(",
"$",
"this",
")",
";",
"EventManager",
"::",
"dispatch",
"(",
"$",
"event",
",",
"function",
"(",
"$",
"result",
")",
"use",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"result",
"instanceof",
"Language",
")",
"{",
"$",
"this",
"->",
"lang",
"=",
"$",
"result",
";",
"$",
"event",
"->",
"stopPropagation",
"(",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"lang",
")",
")",
"{",
"$",
"this",
"->",
"lang",
"=",
"new",
"LanguageFiles",
"(",
"$",
"language",
")",
";",
"}",
"$",
"this",
"->",
"lang_i18",
"=",
"$",
"this",
"->",
"lang",
"instanceof",
"I18Interface",
";",
"$",
"this",
"->",
"lang_transliteration",
"=",
"$",
"this",
"->",
"lang",
"instanceof",
"TransliterationInterface",
";",
"$",
"this",
"->",
"lang_text",
"=",
"$",
"this",
"->",
"lang",
"instanceof",
"TextInterface",
";",
"$",
"this",
"->",
"lang_is_default",
"=",
"$",
"this",
"->",
"lang",
"===",
"$",
"this",
"->",
"lang_default",
";",
"foreach",
"(",
"$",
"packages",
"as",
"$",
"package",
")",
"{",
"$",
"this",
"->",
"lang",
"->",
"load",
"(",
"$",
"package",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Set new language key and reload all packages
@param string $language
@return bool | [
"Set",
"new",
"language",
"key",
"and",
"reload",
"all",
"packages"
] | 95ed38362e397d1c700ee255f7200234ef98d356 | https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Language/Lang.php#L131-L177 |
11,764 | rozaverta/cmf | core/Language/Lang.php | Lang.getProxy | public function getProxy( string $context ): ThenProxy
{
if( isset($this->proxy[$context]) )
{
return $this->proxy[$context];
}
if( !$this->lang->load($context) )
{
throw new \InvalidArgumentException("Cannot load the '{$context}' language package");
}
$this->proxy[$context] = new ThenProxy($this, $context);
return $this->proxy[$context];
} | php | public function getProxy( string $context ): ThenProxy
{
if( isset($this->proxy[$context]) )
{
return $this->proxy[$context];
}
if( !$this->lang->load($context) )
{
throw new \InvalidArgumentException("Cannot load the '{$context}' language package");
}
$this->proxy[$context] = new ThenProxy($this, $context);
return $this->proxy[$context];
} | [
"public",
"function",
"getProxy",
"(",
"string",
"$",
"context",
")",
":",
"ThenProxy",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"proxy",
"[",
"$",
"context",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"proxy",
"[",
"$",
"context",
"]",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"lang",
"->",
"load",
"(",
"$",
"context",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Cannot load the '{$context}' language package\"",
")",
";",
"}",
"$",
"this",
"->",
"proxy",
"[",
"$",
"context",
"]",
"=",
"new",
"ThenProxy",
"(",
"$",
"this",
",",
"$",
"context",
")",
";",
"return",
"$",
"this",
"->",
"proxy",
"[",
"$",
"context",
"]",
";",
"}"
] | Get the language package proxy
@param string $context
@return ThenProxy | [
"Get",
"the",
"language",
"package",
"proxy"
] | 95ed38362e397d1c700ee255f7200234ef98d356 | https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Language/Lang.php#L197-L211 |
11,765 | rozaverta/cmf | core/Language/Lang.php | Lang.replace | public function replace( string $text, ... $replace ): string
{
$then = $this->package_context;
return $this->format(
$this->line($text),
$then,
count($replace) === 1 && is_array($replace[0]) ? $replace[0] : $replace
);
} | php | public function replace( string $text, ... $replace ): string
{
$then = $this->package_context;
return $this->format(
$this->line($text),
$then,
count($replace) === 1 && is_array($replace[0]) ? $replace[0] : $replace
);
} | [
"public",
"function",
"replace",
"(",
"string",
"$",
"text",
",",
"...",
"$",
"replace",
")",
":",
"string",
"{",
"$",
"then",
"=",
"$",
"this",
"->",
"package_context",
";",
"return",
"$",
"this",
"->",
"format",
"(",
"$",
"this",
"->",
"line",
"(",
"$",
"text",
")",
",",
"$",
"then",
",",
"count",
"(",
"$",
"replace",
")",
"===",
"1",
"&&",
"is_array",
"(",
"$",
"replace",
"[",
"0",
"]",
")",
"?",
"$",
"replace",
"[",
"0",
"]",
":",
"$",
"replace",
")",
";",
"}"
] | Get line and replace values
@param string $text
@param array ...$replace
@return string | [
"Get",
"line",
"and",
"replace",
"values"
] | 95ed38362e397d1c700ee255f7200234ef98d356 | https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Language/Lang.php#L244-L252 |
11,766 | rozaverta/cmf | core/Language/Lang.php | Lang.text | public function text( string $text ): string
{
$then = $this->getThen();
if( $this->lang_text )
{
return $this->lang->text($text, $then);
}
else
{
return $text;
}
} | php | public function text( string $text ): string
{
$then = $this->getThen();
if( $this->lang_text )
{
return $this->lang->text($text, $then);
}
else
{
return $text;
}
} | [
"public",
"function",
"text",
"(",
"string",
"$",
"text",
")",
":",
"string",
"{",
"$",
"then",
"=",
"$",
"this",
"->",
"getThen",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"lang_text",
")",
"{",
"return",
"$",
"this",
"->",
"lang",
"->",
"text",
"(",
"$",
"text",
",",
"$",
"then",
")",
";",
"}",
"else",
"{",
"return",
"$",
"text",
";",
"}",
"}"
] | Get text block
@param string $text
@return string | [
"Get",
"text",
"block"
] | 95ed38362e397d1c700ee255f7200234ef98d356 | https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Language/Lang.php#L302-L313 |
11,767 | crip-laravel/core | src/Helpers/FileSystem.php | FileSystem.canonical | public static function canonical($path)
{
$path = self::split($path);
$canon = [];
foreach ($path as $segment) {
if ($segment === '..') {
array_pop($canon);
} elseif ($segment !== '.') {
$canon[] = $segment;
}
}
if ($canon[count($canon) - 1] === '') {
array_pop($canon);
}
return self::join($canon);
} | php | public static function canonical($path)
{
$path = self::split($path);
$canon = [];
foreach ($path as $segment) {
if ($segment === '..') {
array_pop($canon);
} elseif ($segment !== '.') {
$canon[] = $segment;
}
}
if ($canon[count($canon) - 1] === '') {
array_pop($canon);
}
return self::join($canon);
} | [
"public",
"static",
"function",
"canonical",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"split",
"(",
"$",
"path",
")",
";",
"$",
"canon",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"path",
"as",
"$",
"segment",
")",
"{",
"if",
"(",
"$",
"segment",
"===",
"'..'",
")",
"{",
"array_pop",
"(",
"$",
"canon",
")",
";",
"}",
"elseif",
"(",
"$",
"segment",
"!==",
"'.'",
")",
"{",
"$",
"canon",
"[",
"]",
"=",
"$",
"segment",
";",
"}",
"}",
"if",
"(",
"$",
"canon",
"[",
"count",
"(",
"$",
"canon",
")",
"-",
"1",
"]",
"===",
"''",
")",
"{",
"array_pop",
"(",
"$",
"canon",
")",
";",
"}",
"return",
"self",
"::",
"join",
"(",
"$",
"canon",
")",
";",
"}"
] | Canonicalizes the file system path. Always remove slash from the end.
@param string $path The path to canoncalize.
@return string The canoncalized path. | [
"Canonicalizes",
"the",
"file",
"system",
"path",
".",
"Always",
"remove",
"slash",
"from",
"the",
"end",
"."
] | d58cef97d97fba8b01bec33801452ecbd7c992de | https://github.com/crip-laravel/core/blob/d58cef97d97fba8b01bec33801452ecbd7c992de/src/Helpers/FileSystem.php#L45-L62 |
11,768 | crip-laravel/core | src/Helpers/FileSystem.php | FileSystem.trimFileName | public static function trimFileName($path)
{
$name = static::nameFromPath($path);
return substr($path, 0, strlen($path) - strlen($name));
} | php | public static function trimFileName($path)
{
$name = static::nameFromPath($path);
return substr($path, 0, strlen($path) - strlen($name));
} | [
"public",
"static",
"function",
"trimFileName",
"(",
"$",
"path",
")",
"{",
"$",
"name",
"=",
"static",
"::",
"nameFromPath",
"(",
"$",
"path",
")",
";",
"return",
"substr",
"(",
"$",
"path",
",",
"0",
",",
"strlen",
"(",
"$",
"path",
")",
"-",
"strlen",
"(",
"$",
"name",
")",
")",
";",
"}"
] | Trim file name from provided path
@param string $path
@return string | [
"Trim",
"file",
"name",
"from",
"provided",
"path"
] | d58cef97d97fba8b01bec33801452ecbd7c992de | https://github.com/crip-laravel/core/blob/d58cef97d97fba8b01bec33801452ecbd7c992de/src/Helpers/FileSystem.php#L127-L132 |
11,769 | crip-laravel/core | src/Helpers/FileSystem.php | FileSystem.splitNameFromPath | public static function splitNameFromPath($path)
{
$name = static::nameFromPath($path);
$path = static::trimFileName($path);
return [$path, $name];
} | php | public static function splitNameFromPath($path)
{
$name = static::nameFromPath($path);
$path = static::trimFileName($path);
return [$path, $name];
} | [
"public",
"static",
"function",
"splitNameFromPath",
"(",
"$",
"path",
")",
"{",
"$",
"name",
"=",
"static",
"::",
"nameFromPath",
"(",
"$",
"path",
")",
";",
"$",
"path",
"=",
"static",
"::",
"trimFileName",
"(",
"$",
"path",
")",
";",
"return",
"[",
"$",
"path",
",",
"$",
"name",
"]",
";",
"}"
] | Get the path separate from name
@param string $path
@return array | [
"Get",
"the",
"path",
"separate",
"from",
"name"
] | d58cef97d97fba8b01bec33801452ecbd7c992de | https://github.com/crip-laravel/core/blob/d58cef97d97fba8b01bec33801452ecbd7c992de/src/Helpers/FileSystem.php#L141-L147 |
11,770 | crip-laravel/core | src/Helpers/FileSystem.php | FileSystem.deleteDirectory | public static function deleteDirectory($path)
{
if (!is_dir($path)) {
return false;
}
$files = array_diff(scandir($path), ['.', '..']);
foreach ($files as $file) {
$inner_file = static::join($path, $file);
if (is_dir($inner_file)) {
// Delete inner directory recursive
static::deleteDirectory($inner_file);
} else {
// Delete file
unlink($inner_file);
}
}
return rmdir($path);
} | php | public static function deleteDirectory($path)
{
if (!is_dir($path)) {
return false;
}
$files = array_diff(scandir($path), ['.', '..']);
foreach ($files as $file) {
$inner_file = static::join($path, $file);
if (is_dir($inner_file)) {
// Delete inner directory recursive
static::deleteDirectory($inner_file);
} else {
// Delete file
unlink($inner_file);
}
}
return rmdir($path);
} | [
"public",
"static",
"function",
"deleteDirectory",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"files",
"=",
"array_diff",
"(",
"scandir",
"(",
"$",
"path",
")",
",",
"[",
"'.'",
",",
"'..'",
"]",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"inner_file",
"=",
"static",
"::",
"join",
"(",
"$",
"path",
",",
"$",
"file",
")",
";",
"if",
"(",
"is_dir",
"(",
"$",
"inner_file",
")",
")",
"{",
"// Delete inner directory recursive",
"static",
"::",
"deleteDirectory",
"(",
"$",
"inner_file",
")",
";",
"}",
"else",
"{",
"// Delete file",
"unlink",
"(",
"$",
"inner_file",
")",
";",
"}",
"}",
"return",
"rmdir",
"(",
"$",
"path",
")",
";",
"}"
] | Delete directory recursive
@param string $path
@return bool | [
"Delete",
"directory",
"recursive"
] | d58cef97d97fba8b01bec33801452ecbd7c992de | https://github.com/crip-laravel/core/blob/d58cef97d97fba8b01bec33801452ecbd7c992de/src/Helpers/FileSystem.php#L197-L216 |
11,771 | crip-laravel/core | src/Helpers/FileSystem.php | FileSystem.dirSize | public static function dirSize($path, array $exclude = [])
{
if (!is_dir($path)) {
return 0;
}
$size = 0;
$exclude = array_merge(['.', '..'], $exclude);
$items = array_diff(scandir($path), $exclude);
foreach ($items as $item) {
$inner_item = static::join($path, $item);
$size += is_file($inner_item) ? filesize($inner_item) : static::dirSize($inner_item, $exclude);
}
return $size;
} | php | public static function dirSize($path, array $exclude = [])
{
if (!is_dir($path)) {
return 0;
}
$size = 0;
$exclude = array_merge(['.', '..'], $exclude);
$items = array_diff(scandir($path), $exclude);
foreach ($items as $item) {
$inner_item = static::join($path, $item);
$size += is_file($inner_item) ? filesize($inner_item) : static::dirSize($inner_item, $exclude);
}
return $size;
} | [
"public",
"static",
"function",
"dirSize",
"(",
"$",
"path",
",",
"array",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"return",
"0",
";",
"}",
"$",
"size",
"=",
"0",
";",
"$",
"exclude",
"=",
"array_merge",
"(",
"[",
"'.'",
",",
"'..'",
"]",
",",
"$",
"exclude",
")",
";",
"$",
"items",
"=",
"array_diff",
"(",
"scandir",
"(",
"$",
"path",
")",
",",
"$",
"exclude",
")",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"inner_item",
"=",
"static",
"::",
"join",
"(",
"$",
"path",
",",
"$",
"item",
")",
";",
"$",
"size",
"+=",
"is_file",
"(",
"$",
"inner_item",
")",
"?",
"filesize",
"(",
"$",
"inner_item",
")",
":",
"static",
"::",
"dirSize",
"(",
"$",
"inner_item",
",",
"$",
"exclude",
")",
";",
"}",
"return",
"$",
"size",
";",
"}"
] | Calculate directory size including sub-folders
@param string $path
@param array $exclude
@return int | [
"Calculate",
"directory",
"size",
"including",
"sub",
"-",
"folders"
] | d58cef97d97fba8b01bec33801452ecbd7c992de | https://github.com/crip-laravel/core/blob/d58cef97d97fba8b01bec33801452ecbd7c992de/src/Helpers/FileSystem.php#L226-L241 |
11,772 | anklimsk/cakephp-basic-functions | Vendor/langcode-conv/zendframework/zend-filter/src/StringTrim.php | StringTrim.setCharList | public function setCharList($charList)
{
if (! strlen($charList)) {
$charList = null;
}
$this->options['charlist'] = $charList;
return $this;
} | php | public function setCharList($charList)
{
if (! strlen($charList)) {
$charList = null;
}
$this->options['charlist'] = $charList;
return $this;
} | [
"public",
"function",
"setCharList",
"(",
"$",
"charList",
")",
"{",
"if",
"(",
"!",
"strlen",
"(",
"$",
"charList",
")",
")",
"{",
"$",
"charList",
"=",
"null",
";",
"}",
"$",
"this",
"->",
"options",
"[",
"'charlist'",
"]",
"=",
"$",
"charList",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the charList option
@param string $charList
@return self Provides a fluent interface | [
"Sets",
"the",
"charList",
"option"
] | 7554e8b0b420fd3155593af7bf76b7ccbdc8701e | https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/StringTrim.php#L45-L54 |
11,773 | ehough/shortstop | src/main/php/ehough/shortstop/impl/DefaultHttpClient.php | ehough_shortstop_impl_DefaultHttpClient.execute | public final function execute(ehough_shortstop_api_HttpRequest $request)
{
/**
* Fire request event.
*/
$requestEvent = new ehough_tickertape_GenericEvent($request);
$this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::REQUEST, $requestEvent);
/**
* Execute the chain.
*/
$chainContext = new ehough_chaingang_impl_StandardContext();
$chainContext->put('request', $request);
$result = $this->_executionChain->execute($chainContext);
if (!$result || !$chainContext->containsKey('response') || (!($chainContext->get('response') instanceof ehough_shortstop_api_HttpResponse))) {
throw new ehough_shortstop_api_exception_RuntimeException(sprintf('No HTTP transports could execute %s', $request));
}
/**
* Fire response event.
*/
$response = $chainContext->get('response');
$responseEvent = new ehough_tickertape_GenericEvent($response, array('request' => $requestEvent->getSubject()));
$this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::RESPONSE, $responseEvent);
/**
* All done. Return the response.
*/
return $response;
} | php | public final function execute(ehough_shortstop_api_HttpRequest $request)
{
/**
* Fire request event.
*/
$requestEvent = new ehough_tickertape_GenericEvent($request);
$this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::REQUEST, $requestEvent);
/**
* Execute the chain.
*/
$chainContext = new ehough_chaingang_impl_StandardContext();
$chainContext->put('request', $request);
$result = $this->_executionChain->execute($chainContext);
if (!$result || !$chainContext->containsKey('response') || (!($chainContext->get('response') instanceof ehough_shortstop_api_HttpResponse))) {
throw new ehough_shortstop_api_exception_RuntimeException(sprintf('No HTTP transports could execute %s', $request));
}
/**
* Fire response event.
*/
$response = $chainContext->get('response');
$responseEvent = new ehough_tickertape_GenericEvent($response, array('request' => $requestEvent->getSubject()));
$this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::RESPONSE, $responseEvent);
/**
* All done. Return the response.
*/
return $response;
} | [
"public",
"final",
"function",
"execute",
"(",
"ehough_shortstop_api_HttpRequest",
"$",
"request",
")",
"{",
"/**\n * Fire request event.\n */",
"$",
"requestEvent",
"=",
"new",
"ehough_tickertape_GenericEvent",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"_eventDispatcher",
"->",
"dispatch",
"(",
"ehough_shortstop_api_Events",
"::",
"REQUEST",
",",
"$",
"requestEvent",
")",
";",
"/**\n * Execute the chain.\n */",
"$",
"chainContext",
"=",
"new",
"ehough_chaingang_impl_StandardContext",
"(",
")",
";",
"$",
"chainContext",
"->",
"put",
"(",
"'request'",
",",
"$",
"request",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"_executionChain",
"->",
"execute",
"(",
"$",
"chainContext",
")",
";",
"if",
"(",
"!",
"$",
"result",
"||",
"!",
"$",
"chainContext",
"->",
"containsKey",
"(",
"'response'",
")",
"||",
"(",
"!",
"(",
"$",
"chainContext",
"->",
"get",
"(",
"'response'",
")",
"instanceof",
"ehough_shortstop_api_HttpResponse",
")",
")",
")",
"{",
"throw",
"new",
"ehough_shortstop_api_exception_RuntimeException",
"(",
"sprintf",
"(",
"'No HTTP transports could execute %s'",
",",
"$",
"request",
")",
")",
";",
"}",
"/**\n * Fire response event.\n */",
"$",
"response",
"=",
"$",
"chainContext",
"->",
"get",
"(",
"'response'",
")",
";",
"$",
"responseEvent",
"=",
"new",
"ehough_tickertape_GenericEvent",
"(",
"$",
"response",
",",
"array",
"(",
"'request'",
"=>",
"$",
"requestEvent",
"->",
"getSubject",
"(",
")",
")",
")",
";",
"$",
"this",
"->",
"_eventDispatcher",
"->",
"dispatch",
"(",
"ehough_shortstop_api_Events",
"::",
"RESPONSE",
",",
"$",
"responseEvent",
")",
";",
"/**\n * All done. Return the response.\n */",
"return",
"$",
"response",
";",
"}"
] | Execute a given HTTP request.
@param ehough_shortstop_api_HttpRequest $request The HTTP request.
@throws ehough_shortstop_api_exception_RuntimeException If something goes wrong.
@return ehough_shortstop_api_HttpResponse The HTTP response. | [
"Execute",
"a",
"given",
"HTTP",
"request",
"."
] | 4cef21457741347546c70e8e5c0cef6d3162b257 | https://github.com/ehough/shortstop/blob/4cef21457741347546c70e8e5c0cef6d3162b257/src/main/php/ehough/shortstop/impl/DefaultHttpClient.php#L47-L78 |
11,774 | chippyash/Validation | src/Chippyash/Validation/Common/ISO8601/SplitDate.php | SplitDate.splitDate | public function splitDate($value)
{
$parts = Match::on($this->laxTime)
->test(true, function () use ($value) {
$parts = explode(' ', $value);
//join back zone part if found
if (count($parts) == 3) {
$parts[1] .= ' ' . $parts[2];
unset($parts[2]);
}
return $parts;
})
->test(false, function () use ($value) {
return explode('t', $value);
})
->value();
//guard
if (count($parts) == 0 || count($parts) > 2 || (count($parts) == 1 && empty($parts[0]))) {
return array(null, null, null, $this->timepartFound, $this->zonepartFound);
}
if (count($parts) == 1) {
//we have a date only
return array($parts[0], null, null, $this->timepartFound, $this->zonepartFound);
}
if (count($parts) == 2) {
$this->timepartFound = true;
//we have a date and something else
list($time, $zone) = $this->splitTime($parts[1]);
if (!is_null($zone)) {
return array($parts[0], $time, $zone, $this->timepartFound, $this->zonepartFound);
} elseif (!is_null($time)) {
return array($parts[0], $time, null, $this->timepartFound, $this->zonepartFound);
}
return array($parts[0], null, null, $this->timepartFound, $this->zonepartFound);
}
return array($parts[0], null, null, $this->timepartFound, $this->zonepartFound);
} | php | public function splitDate($value)
{
$parts = Match::on($this->laxTime)
->test(true, function () use ($value) {
$parts = explode(' ', $value);
//join back zone part if found
if (count($parts) == 3) {
$parts[1] .= ' ' . $parts[2];
unset($parts[2]);
}
return $parts;
})
->test(false, function () use ($value) {
return explode('t', $value);
})
->value();
//guard
if (count($parts) == 0 || count($parts) > 2 || (count($parts) == 1 && empty($parts[0]))) {
return array(null, null, null, $this->timepartFound, $this->zonepartFound);
}
if (count($parts) == 1) {
//we have a date only
return array($parts[0], null, null, $this->timepartFound, $this->zonepartFound);
}
if (count($parts) == 2) {
$this->timepartFound = true;
//we have a date and something else
list($time, $zone) = $this->splitTime($parts[1]);
if (!is_null($zone)) {
return array($parts[0], $time, $zone, $this->timepartFound, $this->zonepartFound);
} elseif (!is_null($time)) {
return array($parts[0], $time, null, $this->timepartFound, $this->zonepartFound);
}
return array($parts[0], null, null, $this->timepartFound, $this->zonepartFound);
}
return array($parts[0], null, null, $this->timepartFound, $this->zonepartFound);
} | [
"public",
"function",
"splitDate",
"(",
"$",
"value",
")",
"{",
"$",
"parts",
"=",
"Match",
"::",
"on",
"(",
"$",
"this",
"->",
"laxTime",
")",
"->",
"test",
"(",
"true",
",",
"function",
"(",
")",
"use",
"(",
"$",
"value",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"' '",
",",
"$",
"value",
")",
";",
"//join back zone part if found",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"==",
"3",
")",
"{",
"$",
"parts",
"[",
"1",
"]",
".=",
"' '",
".",
"$",
"parts",
"[",
"2",
"]",
";",
"unset",
"(",
"$",
"parts",
"[",
"2",
"]",
")",
";",
"}",
"return",
"$",
"parts",
";",
"}",
")",
"->",
"test",
"(",
"false",
",",
"function",
"(",
")",
"use",
"(",
"$",
"value",
")",
"{",
"return",
"explode",
"(",
"'t'",
",",
"$",
"value",
")",
";",
"}",
")",
"->",
"value",
"(",
")",
";",
"//guard",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"==",
"0",
"||",
"count",
"(",
"$",
"parts",
")",
">",
"2",
"||",
"(",
"count",
"(",
"$",
"parts",
")",
"==",
"1",
"&&",
"empty",
"(",
"$",
"parts",
"[",
"0",
"]",
")",
")",
")",
"{",
"return",
"array",
"(",
"null",
",",
"null",
",",
"null",
",",
"$",
"this",
"->",
"timepartFound",
",",
"$",
"this",
"->",
"zonepartFound",
")",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"==",
"1",
")",
"{",
"//we have a date only",
"return",
"array",
"(",
"$",
"parts",
"[",
"0",
"]",
",",
"null",
",",
"null",
",",
"$",
"this",
"->",
"timepartFound",
",",
"$",
"this",
"->",
"zonepartFound",
")",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"==",
"2",
")",
"{",
"$",
"this",
"->",
"timepartFound",
"=",
"true",
";",
"//we have a date and something else",
"list",
"(",
"$",
"time",
",",
"$",
"zone",
")",
"=",
"$",
"this",
"->",
"splitTime",
"(",
"$",
"parts",
"[",
"1",
"]",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"zone",
")",
")",
"{",
"return",
"array",
"(",
"$",
"parts",
"[",
"0",
"]",
",",
"$",
"time",
",",
"$",
"zone",
",",
"$",
"this",
"->",
"timepartFound",
",",
"$",
"this",
"->",
"zonepartFound",
")",
";",
"}",
"elseif",
"(",
"!",
"is_null",
"(",
"$",
"time",
")",
")",
"{",
"return",
"array",
"(",
"$",
"parts",
"[",
"0",
"]",
",",
"$",
"time",
",",
"null",
",",
"$",
"this",
"->",
"timepartFound",
",",
"$",
"this",
"->",
"zonepartFound",
")",
";",
"}",
"return",
"array",
"(",
"$",
"parts",
"[",
"0",
"]",
",",
"null",
",",
"null",
",",
"$",
"this",
"->",
"timepartFound",
",",
"$",
"this",
"->",
"zonepartFound",
")",
";",
"}",
"return",
"array",
"(",
"$",
"parts",
"[",
"0",
"]",
",",
"null",
",",
"null",
",",
"$",
"this",
"->",
"timepartFound",
",",
"$",
"this",
"->",
"zonepartFound",
")",
";",
"}"
] | Split date by its parts
@param string $value ISO datetime string
@return array[date, time, zone, timePartFound] | [
"Split",
"date",
"by",
"its",
"parts"
] | 8e2373ce968e84077f67101404ea74b997e3ccf3 | https://github.com/chippyash/Validation/blob/8e2373ce968e84077f67101404ea74b997e3ccf3/src/Chippyash/Validation/Common/ISO8601/SplitDate.php#L67-L105 |
11,775 | chippyash/Validation | src/Chippyash/Validation/Common/ISO8601/SplitDate.php | SplitDate.splitTime | protected function splitTime($value)
{
//guard
if (empty($value)) {
return array(null, null);
}
//try to find zone, z == UTC
$partsZ = explode('z', $value);
$partsM = explode('-', $value);
$partsP = explode('+', $value);
if ($this->laxZone) {
//trim the time part cus there may be a space
$partsZ[0] = rtrim($partsZ[0]);
$partsM[0] = rtrim($partsM[0]);
$partsP[0] = rtrim($partsP[0]);
}
//guard
if (count($partsZ) == 0 && count($partsM) == 0 && count($partsP) == 0) {
return array(null, null);
}
//UTC timezone stated
if (count($partsZ) == 2 && empty($partsZ[1])) {
$this->zonepartFound = true;
return array($partsZ[0], $this->getUTCTimezone());
}
//minus timezone stated
if (count($partsM) == 2) {
$this->zonepartFound = true;
return array($partsM[0], "-{$partsM[1]}");
}
//plus timezone stated
if (count($partsP) == 2) {
$this->zonepartFound = true;
return array($partsP[0], "+{$partsP[1]}");
}
//no zone found
return array((empty($value) ? null : $value), null);
} | php | protected function splitTime($value)
{
//guard
if (empty($value)) {
return array(null, null);
}
//try to find zone, z == UTC
$partsZ = explode('z', $value);
$partsM = explode('-', $value);
$partsP = explode('+', $value);
if ($this->laxZone) {
//trim the time part cus there may be a space
$partsZ[0] = rtrim($partsZ[0]);
$partsM[0] = rtrim($partsM[0]);
$partsP[0] = rtrim($partsP[0]);
}
//guard
if (count($partsZ) == 0 && count($partsM) == 0 && count($partsP) == 0) {
return array(null, null);
}
//UTC timezone stated
if (count($partsZ) == 2 && empty($partsZ[1])) {
$this->zonepartFound = true;
return array($partsZ[0], $this->getUTCTimezone());
}
//minus timezone stated
if (count($partsM) == 2) {
$this->zonepartFound = true;
return array($partsM[0], "-{$partsM[1]}");
}
//plus timezone stated
if (count($partsP) == 2) {
$this->zonepartFound = true;
return array($partsP[0], "+{$partsP[1]}");
}
//no zone found
return array((empty($value) ? null : $value), null);
} | [
"protected",
"function",
"splitTime",
"(",
"$",
"value",
")",
"{",
"//guard",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"array",
"(",
"null",
",",
"null",
")",
";",
"}",
"//try to find zone, z == UTC",
"$",
"partsZ",
"=",
"explode",
"(",
"'z'",
",",
"$",
"value",
")",
";",
"$",
"partsM",
"=",
"explode",
"(",
"'-'",
",",
"$",
"value",
")",
";",
"$",
"partsP",
"=",
"explode",
"(",
"'+'",
",",
"$",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"laxZone",
")",
"{",
"//trim the time part cus there may be a space",
"$",
"partsZ",
"[",
"0",
"]",
"=",
"rtrim",
"(",
"$",
"partsZ",
"[",
"0",
"]",
")",
";",
"$",
"partsM",
"[",
"0",
"]",
"=",
"rtrim",
"(",
"$",
"partsM",
"[",
"0",
"]",
")",
";",
"$",
"partsP",
"[",
"0",
"]",
"=",
"rtrim",
"(",
"$",
"partsP",
"[",
"0",
"]",
")",
";",
"}",
"//guard",
"if",
"(",
"count",
"(",
"$",
"partsZ",
")",
"==",
"0",
"&&",
"count",
"(",
"$",
"partsM",
")",
"==",
"0",
"&&",
"count",
"(",
"$",
"partsP",
")",
"==",
"0",
")",
"{",
"return",
"array",
"(",
"null",
",",
"null",
")",
";",
"}",
"//UTC timezone stated",
"if",
"(",
"count",
"(",
"$",
"partsZ",
")",
"==",
"2",
"&&",
"empty",
"(",
"$",
"partsZ",
"[",
"1",
"]",
")",
")",
"{",
"$",
"this",
"->",
"zonepartFound",
"=",
"true",
";",
"return",
"array",
"(",
"$",
"partsZ",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"getUTCTimezone",
"(",
")",
")",
";",
"}",
"//minus timezone stated",
"if",
"(",
"count",
"(",
"$",
"partsM",
")",
"==",
"2",
")",
"{",
"$",
"this",
"->",
"zonepartFound",
"=",
"true",
";",
"return",
"array",
"(",
"$",
"partsM",
"[",
"0",
"]",
",",
"\"-{$partsM[1]}\"",
")",
";",
"}",
"//plus timezone stated",
"if",
"(",
"count",
"(",
"$",
"partsP",
")",
"==",
"2",
")",
"{",
"$",
"this",
"->",
"zonepartFound",
"=",
"true",
";",
"return",
"array",
"(",
"$",
"partsP",
"[",
"0",
"]",
",",
"\"+{$partsP[1]}\"",
")",
";",
"}",
"//no zone found",
"return",
"array",
"(",
"(",
"empty",
"(",
"$",
"value",
")",
"?",
"null",
":",
"$",
"value",
")",
",",
"null",
")",
";",
"}"
] | Split timezone by its parts
@param string $value
@return array[time, zone] | [
"Split",
"timezone",
"by",
"its",
"parts"
] | 8e2373ce968e84077f67101404ea74b997e3ccf3 | https://github.com/chippyash/Validation/blob/8e2373ce968e84077f67101404ea74b997e3ccf3/src/Chippyash/Validation/Common/ISO8601/SplitDate.php#L113-L154 |
11,776 | chippyash/Validation | src/Chippyash/Validation/Common/ISO8601/SplitDate.php | SplitDate.getUTCTimezone | protected function getUTCTimezone()
{
if (\date_default_timezone_get() == 'UTC') {
return 'UTC'; //already in UTC. workaround as zone must be non empty
}
$timezone = new \DateTimeZone(\date_default_timezone_get()); // Get default system timezone to create a new DateTimeZone object
$offset = $timezone->getOffset(new \DateTime()); // Offset in seconds to UTC
$offsetHours = round(abs($offset) / 3600);
$offsetMinutes = round((abs($offset) - $offsetHours * 3600) / 60);
$offsetString = ($offset < 0 ? '-' : '+')
. ($offsetHours < 10 ? '0' : '') . $offsetHours
. ($this->format == C::FORMAT_EXTENDED || $this->format == C::FORMAT_EXTENDED_SIGNED ? ':' : '')
. ($offsetMinutes < 10 ? '0' : '') . $offsetMinutes;
return $offsetString;
} | php | protected function getUTCTimezone()
{
if (\date_default_timezone_get() == 'UTC') {
return 'UTC'; //already in UTC. workaround as zone must be non empty
}
$timezone = new \DateTimeZone(\date_default_timezone_get()); // Get default system timezone to create a new DateTimeZone object
$offset = $timezone->getOffset(new \DateTime()); // Offset in seconds to UTC
$offsetHours = round(abs($offset) / 3600);
$offsetMinutes = round((abs($offset) - $offsetHours * 3600) / 60);
$offsetString = ($offset < 0 ? '-' : '+')
. ($offsetHours < 10 ? '0' : '') . $offsetHours
. ($this->format == C::FORMAT_EXTENDED || $this->format == C::FORMAT_EXTENDED_SIGNED ? ':' : '')
. ($offsetMinutes < 10 ? '0' : '') . $offsetMinutes;
return $offsetString;
} | [
"protected",
"function",
"getUTCTimezone",
"(",
")",
"{",
"if",
"(",
"\\",
"date_default_timezone_get",
"(",
")",
"==",
"'UTC'",
")",
"{",
"return",
"'UTC'",
";",
"//already in UTC. workaround as zone must be non empty",
"}",
"$",
"timezone",
"=",
"new",
"\\",
"DateTimeZone",
"(",
"\\",
"date_default_timezone_get",
"(",
")",
")",
";",
"// Get default system timezone to create a new DateTimeZone object",
"$",
"offset",
"=",
"$",
"timezone",
"->",
"getOffset",
"(",
"new",
"\\",
"DateTime",
"(",
")",
")",
";",
"// Offset in seconds to UTC",
"$",
"offsetHours",
"=",
"round",
"(",
"abs",
"(",
"$",
"offset",
")",
"/",
"3600",
")",
";",
"$",
"offsetMinutes",
"=",
"round",
"(",
"(",
"abs",
"(",
"$",
"offset",
")",
"-",
"$",
"offsetHours",
"*",
"3600",
")",
"/",
"60",
")",
";",
"$",
"offsetString",
"=",
"(",
"$",
"offset",
"<",
"0",
"?",
"'-'",
":",
"'+'",
")",
".",
"(",
"$",
"offsetHours",
"<",
"10",
"?",
"'0'",
":",
"''",
")",
".",
"$",
"offsetHours",
".",
"(",
"$",
"this",
"->",
"format",
"==",
"C",
"::",
"FORMAT_EXTENDED",
"||",
"$",
"this",
"->",
"format",
"==",
"C",
"::",
"FORMAT_EXTENDED_SIGNED",
"?",
"':'",
":",
"''",
")",
".",
"(",
"$",
"offsetMinutes",
"<",
"10",
"?",
"'0'",
":",
"''",
")",
".",
"$",
"offsetMinutes",
";",
"return",
"$",
"offsetString",
";",
"}"
] | Get current UTC timezone offset
@return string|null | [
"Get",
"current",
"UTC",
"timezone",
"offset"
] | 8e2373ce968e84077f67101404ea74b997e3ccf3 | https://github.com/chippyash/Validation/blob/8e2373ce968e84077f67101404ea74b997e3ccf3/src/Chippyash/Validation/Common/ISO8601/SplitDate.php#L161-L177 |
11,777 | eix/core | src/php/main/Eix/Services/Identity/Providers/OpenId.php | OpenId.authenticate | public function authenticate()
{
Logger::get()->debug('Authenticating OpenID user...');
if (!$this->isAuthenticated) {
if (!static::getConsumer()->validate()) {
Logger::get()->debug(' Failed!');
throw new NotAuthenticatedException('OpenID authentication failed.');
} else {
$this->isAuthenticated = true;
}
}
Logger::get()->debug(' OK!');
} | php | public function authenticate()
{
Logger::get()->debug('Authenticating OpenID user...');
if (!$this->isAuthenticated) {
if (!static::getConsumer()->validate()) {
Logger::get()->debug(' Failed!');
throw new NotAuthenticatedException('OpenID authentication failed.');
} else {
$this->isAuthenticated = true;
}
}
Logger::get()->debug(' OK!');
} | [
"public",
"function",
"authenticate",
"(",
")",
"{",
"Logger",
"::",
"get",
"(",
")",
"->",
"debug",
"(",
"'Authenticating OpenID user...'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isAuthenticated",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"getConsumer",
"(",
")",
"->",
"validate",
"(",
")",
")",
"{",
"Logger",
"::",
"get",
"(",
")",
"->",
"debug",
"(",
"' Failed!'",
")",
";",
"throw",
"new",
"NotAuthenticatedException",
"(",
"'OpenID authentication failed.'",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"isAuthenticated",
"=",
"true",
";",
"}",
"}",
"Logger",
"::",
"get",
"(",
")",
"->",
"debug",
"(",
"' OK!'",
")",
";",
"}"
] | Makes sure the user is authenticated. If not, an exception is thrown.
@throws NotAuthenticatedException | [
"Makes",
"sure",
"the",
"user",
"is",
"authenticated",
".",
"If",
"not",
"an",
"exception",
"is",
"thrown",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Identity/Providers/OpenId.php#L49-L62 |
11,778 | nattreid/tracy-plugin | src/Tracy.php | Tracy.setMail | public function setMail(string $mailPath, bool $mailPanel): void
{
$this->mailPath = $mailPath;
$this->mailPanel = $mailPanel;
} | php | public function setMail(string $mailPath, bool $mailPanel): void
{
$this->mailPath = $mailPath;
$this->mailPanel = $mailPanel;
} | [
"public",
"function",
"setMail",
"(",
"string",
"$",
"mailPath",
",",
"bool",
"$",
"mailPanel",
")",
":",
"void",
"{",
"$",
"this",
"->",
"mailPath",
"=",
"$",
"mailPath",
";",
"$",
"this",
"->",
"mailPanel",
"=",
"$",
"mailPanel",
";",
"}"
] | Nastavi mail panel
@param string $mailPath
@param bool $mailPanel | [
"Nastavi",
"mail",
"panel"
] | 05ff14c52112b5b2c92fb82d8cf8eeb041bd1300 | https://github.com/nattreid/tracy-plugin/blob/05ff14c52112b5b2c92fb82d8cf8eeb041bd1300/src/Tracy.php#L61-L65 |
11,779 | nattreid/tracy-plugin | src/Tracy.php | Tracy.enable | public function enable(): void
{
$this->response->setCookie(Configurator::COOKIE_SECRET, $this->cookie, strtotime('1 years'), '/', '', '', true);
$this->enable = true;
} | php | public function enable(): void
{
$this->response->setCookie(Configurator::COOKIE_SECRET, $this->cookie, strtotime('1 years'), '/', '', '', true);
$this->enable = true;
} | [
"public",
"function",
"enable",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"response",
"->",
"setCookie",
"(",
"Configurator",
"::",
"COOKIE_SECRET",
",",
"$",
"this",
"->",
"cookie",
",",
"strtotime",
"(",
"'1 years'",
")",
",",
"'/'",
",",
"''",
",",
"''",
",",
"true",
")",
";",
"$",
"this",
"->",
"enable",
"=",
"true",
";",
"}"
] | Zapnuti debug modu pomoci cookie | [
"Zapnuti",
"debug",
"modu",
"pomoci",
"cookie"
] | 05ff14c52112b5b2c92fb82d8cf8eeb041bd1300 | https://github.com/nattreid/tracy-plugin/blob/05ff14c52112b5b2c92fb82d8cf8eeb041bd1300/src/Tracy.php#L88-L92 |
11,780 | nattreid/tracy-plugin | src/Tracy.php | Tracy.disable | public function disable(): void
{
$this->response->deleteCookie(Configurator::COOKIE_SECRET);
$this->enable = false;
} | php | public function disable(): void
{
$this->response->deleteCookie(Configurator::COOKIE_SECRET);
$this->enable = false;
} | [
"public",
"function",
"disable",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"response",
"->",
"deleteCookie",
"(",
"Configurator",
"::",
"COOKIE_SECRET",
")",
";",
"$",
"this",
"->",
"enable",
"=",
"false",
";",
"}"
] | Vypnuti debug modu pomoci cookie | [
"Vypnuti",
"debug",
"modu",
"pomoci",
"cookie"
] | 05ff14c52112b5b2c92fb82d8cf8eeb041bd1300 | https://github.com/nattreid/tracy-plugin/blob/05ff14c52112b5b2c92fb82d8cf8eeb041bd1300/src/Tracy.php#L97-L101 |
11,781 | clacy-builders/xml-express-php | src/shared/ClassAttribute.php | ClassAttribute.stripes | public function stripes($classes, $column = false)
{
$count = count($classes);
$index = -1;
$prev = null;
foreach ($this->children as $i => $row) {
if ($column === false) {
$index = ++$index % $count;
}
else {
foreach ($row->children as $k => $cell) {
if ($k > $column) break;
if ($i == 0 || $cell->content != $prev->children[$k]->content) {
$index = ++$index % $count;
break;
}
}
$prev = $row;
}
$this->children[$i]->setClass($classes[$index]);
}
return $this;
} | php | public function stripes($classes, $column = false)
{
$count = count($classes);
$index = -1;
$prev = null;
foreach ($this->children as $i => $row) {
if ($column === false) {
$index = ++$index % $count;
}
else {
foreach ($row->children as $k => $cell) {
if ($k > $column) break;
if ($i == 0 || $cell->content != $prev->children[$k]->content) {
$index = ++$index % $count;
break;
}
}
$prev = $row;
}
$this->children[$i]->setClass($classes[$index]);
}
return $this;
} | [
"public",
"function",
"stripes",
"(",
"$",
"classes",
",",
"$",
"column",
"=",
"false",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"classes",
")",
";",
"$",
"index",
"=",
"-",
"1",
";",
"$",
"prev",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"i",
"=>",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"column",
"===",
"false",
")",
"{",
"$",
"index",
"=",
"++",
"$",
"index",
"%",
"$",
"count",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"row",
"->",
"children",
"as",
"$",
"k",
"=>",
"$",
"cell",
")",
"{",
"if",
"(",
"$",
"k",
">",
"$",
"column",
")",
"break",
";",
"if",
"(",
"$",
"i",
"==",
"0",
"||",
"$",
"cell",
"->",
"content",
"!=",
"$",
"prev",
"->",
"children",
"[",
"$",
"k",
"]",
"->",
"content",
")",
"{",
"$",
"index",
"=",
"++",
"$",
"index",
"%",
"$",
"count",
";",
"break",
";",
"}",
"}",
"$",
"prev",
"=",
"$",
"row",
";",
"}",
"$",
"this",
"->",
"children",
"[",
"$",
"i",
"]",
"->",
"setClass",
"(",
"$",
"classes",
"[",
"$",
"index",
"]",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds alternating classes to child elements.
@param string[] $classes
@param int|false $column
@return Xml | [
"Adds",
"alternating",
"classes",
"to",
"child",
"elements",
"."
] | 9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0 | https://github.com/clacy-builders/xml-express-php/blob/9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0/src/shared/ClassAttribute.php#L26-L48 |
11,782 | liip/LiipDrupalEventManagerModule | src/Liip/Drupal/Modules/EventManager/SubjectFactory.php | SubjectFactory.getSubject | public function getSubject($name)
{
if (empty($this->subjects[$name])) {
$this->initSubject($name);
}
return $this->subjects[$name];
} | php | public function getSubject($name)
{
if (empty($this->subjects[$name])) {
$this->initSubject($name);
}
return $this->subjects[$name];
} | [
"public",
"function",
"getSubject",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"initSubject",
"(",
"$",
"name",
")",
";",
"}",
"return",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
";",
"}"
] | Provides an event subject identified by the given name.
@param string $name
@return \Liip\Drupal\Modules\EventManager\EventSubject | [
"Provides",
"an",
"event",
"subject",
"identified",
"by",
"the",
"given",
"name",
"."
] | c049662aa1efaab1149d7edb0cb7bca265983571 | https://github.com/liip/LiipDrupalEventManagerModule/blob/c049662aa1efaab1149d7edb0cb7bca265983571/src/Liip/Drupal/Modules/EventManager/SubjectFactory.php#L51-L59 |
11,783 | liip/LiipDrupalEventManagerModule | src/Liip/Drupal/Modules/EventManager/SubjectFactory.php | SubjectFactory.initSubject | public function initSubject($name)
{
$this->fetchSubjectsFromRegistry($name);
try {
if (empty($this->subjects[$name])) {
$this->subjects[$name] = new EventSubject($name);
if ($this->registry->isRegistered($name)) {
// modify registration
$this->registry->replace($name, $this->subjects[$name]);
} else {
$this->registry->register($name, $this->subjects[$name]);
}
}
} catch (RegistryException $re) {
$this->getDrupalConnectorFactory()
->getCommonConnector()
->watchdog(
'Liip Drupal Event Manager',
$re->getMessage(),
array(),
WATCHDOG_ERROR
);
}
} | php | public function initSubject($name)
{
$this->fetchSubjectsFromRegistry($name);
try {
if (empty($this->subjects[$name])) {
$this->subjects[$name] = new EventSubject($name);
if ($this->registry->isRegistered($name)) {
// modify registration
$this->registry->replace($name, $this->subjects[$name]);
} else {
$this->registry->register($name, $this->subjects[$name]);
}
}
} catch (RegistryException $re) {
$this->getDrupalConnectorFactory()
->getCommonConnector()
->watchdog(
'Liip Drupal Event Manager',
$re->getMessage(),
array(),
WATCHDOG_ERROR
);
}
} | [
"public",
"function",
"initSubject",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"fetchSubjectsFromRegistry",
"(",
"$",
"name",
")",
";",
"try",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
"=",
"new",
"EventSubject",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"this",
"->",
"registry",
"->",
"isRegistered",
"(",
"$",
"name",
")",
")",
"{",
"// modify registration",
"$",
"this",
"->",
"registry",
"->",
"replace",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"registry",
"->",
"register",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"RegistryException",
"$",
"re",
")",
"{",
"$",
"this",
"->",
"getDrupalConnectorFactory",
"(",
")",
"->",
"getCommonConnector",
"(",
")",
"->",
"watchdog",
"(",
"'Liip Drupal Event Manager'",
",",
"$",
"re",
"->",
"getMessage",
"(",
")",
",",
"array",
"(",
")",
",",
"WATCHDOG_ERROR",
")",
";",
"}",
"}"
] | Initiates and caches an event subject for later use.
@param string $name | [
"Initiates",
"and",
"caches",
"an",
"event",
"subject",
"for",
"later",
"use",
"."
] | c049662aa1efaab1149d7edb0cb7bca265983571 | https://github.com/liip/LiipDrupalEventManagerModule/blob/c049662aa1efaab1149d7edb0cb7bca265983571/src/Liip/Drupal/Modules/EventManager/SubjectFactory.php#L66-L96 |
11,784 | liip/LiipDrupalEventManagerModule | src/Liip/Drupal/Modules/EventManager/SubjectFactory.php | SubjectFactory.fetchSubjectsFromRegistry | protected function fetchSubjectsFromRegistry($name)
{
try {
$this->subjects = $this->registry->getContent();
if (!empty($this->subjects[$name])) {
$this->assertions->isInstanceOf(
$this->subjects[$name],
'\\Liip\\Drupal\\Modules\\EventManager\\EventSubjectInterface',
'Someone sneaked wrong value in there.. neat!! Will be reset now ;)'
);
}
} catch (InvalidArgumentException $e) {
$this->getDrupalConnectorFactory()
->getCommonConnector()
->watchdog(
'Liip Drupal Event Manager',
$e->getMessage(),
array(),
WATCHDOG_ERROR
);
$this->subjects[$name] = null;
}
} | php | protected function fetchSubjectsFromRegistry($name)
{
try {
$this->subjects = $this->registry->getContent();
if (!empty($this->subjects[$name])) {
$this->assertions->isInstanceOf(
$this->subjects[$name],
'\\Liip\\Drupal\\Modules\\EventManager\\EventSubjectInterface',
'Someone sneaked wrong value in there.. neat!! Will be reset now ;)'
);
}
} catch (InvalidArgumentException $e) {
$this->getDrupalConnectorFactory()
->getCommonConnector()
->watchdog(
'Liip Drupal Event Manager',
$e->getMessage(),
array(),
WATCHDOG_ERROR
);
$this->subjects[$name] = null;
}
} | [
"protected",
"function",
"fetchSubjectsFromRegistry",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"subjects",
"=",
"$",
"this",
"->",
"registry",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"assertions",
"->",
"isInstanceOf",
"(",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
",",
"'\\\\Liip\\\\Drupal\\\\Modules\\\\EventManager\\\\EventSubjectInterface'",
",",
"'Someone sneaked wrong value in there.. neat!! Will be reset now ;)'",
")",
";",
"}",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"getDrupalConnectorFactory",
"(",
")",
"->",
"getCommonConnector",
"(",
")",
"->",
"watchdog",
"(",
"'Liip Drupal Event Manager'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"array",
"(",
")",
",",
"WATCHDOG_ERROR",
")",
";",
"$",
"this",
"->",
"subjects",
"[",
"$",
"name",
"]",
"=",
"null",
";",
"}",
"}"
] | Retrieves the set of subjects from the registry currently attached.
@param string $name | [
"Retrieves",
"the",
"set",
"of",
"subjects",
"from",
"the",
"registry",
"currently",
"attached",
"."
] | c049662aa1efaab1149d7edb0cb7bca265983571 | https://github.com/liip/LiipDrupalEventManagerModule/blob/c049662aa1efaab1149d7edb0cb7bca265983571/src/Liip/Drupal/Modules/EventManager/SubjectFactory.php#L103-L128 |
11,785 | elastification/php-client | src/Repository/DocumentRepository.php | DocumentRepository.create | public function create($index, $type, $document)
{
$request = $this->createRequestInstance(self::CREATE_DOCUMENT, $index, $type);
$request->setBody($document);
return $this->client->send($request);
} | php | public function create($index, $type, $document)
{
$request = $this->createRequestInstance(self::CREATE_DOCUMENT, $index, $type);
$request->setBody($document);
return $this->client->send($request);
} | [
"public",
"function",
"create",
"(",
"$",
"index",
",",
"$",
"type",
",",
"$",
"document",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequestInstance",
"(",
"self",
"::",
"CREATE_DOCUMENT",
",",
"$",
"index",
",",
"$",
"type",
")",
";",
"$",
"request",
"->",
"setBody",
"(",
"$",
"document",
")",
";",
"return",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"$",
"request",
")",
";",
"}"
] | creates a document
@param string $index
@param string $type
@param mixed $document
@return \Elastification\Client\Response\ResponseInterface
@author Daniel Wendlandt | [
"creates",
"a",
"document"
] | eb01be0905dd1eba7baa62f84492d82e4b3cae61 | https://github.com/elastification/php-client/blob/eb01be0905dd1eba7baa62f84492d82e4b3cae61/src/Repository/DocumentRepository.php#L34-L40 |
11,786 | elastification/php-client | src/Repository/DocumentRepository.php | DocumentRepository.delete | public function delete($index, $type, $id)
{
$request = $this->createRequestInstance(self::DELETE_DOCUMENT, $index, $type);
$request->setId($id);
return $this->client->send($request);
} | php | public function delete($index, $type, $id)
{
$request = $this->createRequestInstance(self::DELETE_DOCUMENT, $index, $type);
$request->setId($id);
return $this->client->send($request);
} | [
"public",
"function",
"delete",
"(",
"$",
"index",
",",
"$",
"type",
",",
"$",
"id",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequestInstance",
"(",
"self",
"::",
"DELETE_DOCUMENT",
",",
"$",
"index",
",",
"$",
"type",
")",
";",
"$",
"request",
"->",
"setId",
"(",
"$",
"id",
")",
";",
"return",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"$",
"request",
")",
";",
"}"
] | Deletes a document by id
@param string $index
@param string $type
@param string $id
@return \Elastification\Client\Response\ResponseInterface
@author Daniel Wendlandt | [
"Deletes",
"a",
"document",
"by",
"id"
] | eb01be0905dd1eba7baa62f84492d82e4b3cae61 | https://github.com/elastification/php-client/blob/eb01be0905dd1eba7baa62f84492d82e4b3cae61/src/Repository/DocumentRepository.php#L52-L58 |
11,787 | elastification/php-client | src/Repository/DocumentRepository.php | DocumentRepository.get | public function get($index, $type, $id)
{
$request = $this->createRequestInstance(self::GET_DOCUMENT, $index, $type);
$request->setId($id);
return $this->client->send($request);
} | php | public function get($index, $type, $id)
{
$request = $this->createRequestInstance(self::GET_DOCUMENT, $index, $type);
$request->setId($id);
return $this->client->send($request);
} | [
"public",
"function",
"get",
"(",
"$",
"index",
",",
"$",
"type",
",",
"$",
"id",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequestInstance",
"(",
"self",
"::",
"GET_DOCUMENT",
",",
"$",
"index",
",",
"$",
"type",
")",
";",
"$",
"request",
"->",
"setId",
"(",
"$",
"id",
")",
";",
"return",
"$",
"this",
"->",
"client",
"->",
"send",
"(",
"$",
"request",
")",
";",
"}"
] | gets a document by id
@param string $index
@param string $type
@param string $id
@return \Elastification\Client\Response\ResponseInterface
@author Daniel Wendlandt | [
"gets",
"a",
"document",
"by",
"id"
] | eb01be0905dd1eba7baa62f84492d82e4b3cae61 | https://github.com/elastification/php-client/blob/eb01be0905dd1eba7baa62f84492d82e4b3cae61/src/Repository/DocumentRepository.php#L70-L76 |
11,788 | JamesRezo/webhelper-parser | src/Parser/Checker.php | Checker.setString | public function setString($string = '')
{
try {
Assert::string($string);
} catch (InvalidArgumentException $e) {
$this->string = '';
}
$this->string = $string;
return $this;
} | php | public function setString($string = '')
{
try {
Assert::string($string);
} catch (InvalidArgumentException $e) {
$this->string = '';
}
$this->string = $string;
return $this;
} | [
"public",
"function",
"setString",
"(",
"$",
"string",
"=",
"''",
")",
"{",
"try",
"{",
"Assert",
"::",
"string",
"(",
"$",
"string",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"string",
"=",
"''",
";",
"}",
"$",
"this",
"->",
"string",
"=",
"$",
"string",
";",
"return",
"$",
"this",
";",
"}"
] | Sets an empty string if the parameter has the wrong type.
@param string $string a string to check | [
"Sets",
"an",
"empty",
"string",
"if",
"the",
"parameter",
"has",
"the",
"wrong",
"type",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Parser/Checker.php#L32-L43 |
11,789 | JamesRezo/webhelper-parser | src/Parser/Checker.php | Checker.isValidAbsolutePath | public function isValidAbsolutePath()
{
if (!Path::isAbsolute($this->string)) {
return false;
}
if (!is_dir($this->string)) {
return false;
}
return true;
} | php | public function isValidAbsolutePath()
{
if (!Path::isAbsolute($this->string)) {
return false;
}
if (!is_dir($this->string)) {
return false;
}
return true;
} | [
"public",
"function",
"isValidAbsolutePath",
"(",
")",
"{",
"if",
"(",
"!",
"Path",
"::",
"isAbsolute",
"(",
"$",
"this",
"->",
"string",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"string",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Confirms if a string is an existing absolute path.
@return bool true if the string is an existing absolute path, false otherwise | [
"Confirms",
"if",
"a",
"string",
"is",
"an",
"existing",
"absolute",
"path",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Parser/Checker.php#L60-L71 |
11,790 | JamesRezo/webhelper-parser | src/Parser/Checker.php | Checker.isValidRegex | public function isValidRegex()
{
set_error_handler(function ($errno, $errstr) {
throw new InvalidArgumentException($errstr, $errno);
}, E_WARNING);
$valid = true;
try {
preg_match($this->string, 'tester');
} catch (InvalidArgumentException $e) {
$valid = false;
}
restore_error_handler();
return $valid;
} | php | public function isValidRegex()
{
set_error_handler(function ($errno, $errstr) {
throw new InvalidArgumentException($errstr, $errno);
}, E_WARNING);
$valid = true;
try {
preg_match($this->string, 'tester');
} catch (InvalidArgumentException $e) {
$valid = false;
}
restore_error_handler();
return $valid;
} | [
"public",
"function",
"isValidRegex",
"(",
")",
"{",
"set_error_handler",
"(",
"function",
"(",
"$",
"errno",
",",
"$",
"errstr",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"$",
"errstr",
",",
"$",
"errno",
")",
";",
"}",
",",
"E_WARNING",
")",
";",
"$",
"valid",
"=",
"true",
";",
"try",
"{",
"preg_match",
"(",
"$",
"this",
"->",
"string",
",",
"'tester'",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"{",
"$",
"valid",
"=",
"false",
";",
"}",
"restore_error_handler",
"(",
")",
";",
"return",
"$",
"valid",
";",
"}"
] | Confirms if a string is a valid regular expression.
@return bool true if the string is a valid regex, false otherwise | [
"Confirms",
"if",
"a",
"string",
"is",
"a",
"valid",
"regular",
"expression",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Parser/Checker.php#L78-L95 |
11,791 | JamesRezo/webhelper-parser | src/Parser/Checker.php | Checker.hasKeyAndValueSubPattern | public function hasKeyAndValueSubPattern()
{
if (!$this->isValidRegex()) {
return false;
}
if (false === strpos($this->string, '(?<key>') || false === strpos($this->string, '(?<value>')) {
return false;
}
return true;
} | php | public function hasKeyAndValueSubPattern()
{
if (!$this->isValidRegex()) {
return false;
}
if (false === strpos($this->string, '(?<key>') || false === strpos($this->string, '(?<value>')) {
return false;
}
return true;
} | [
"public",
"function",
"hasKeyAndValueSubPattern",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidRegex",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"this",
"->",
"string",
",",
"'(?<key>'",
")",
"||",
"false",
"===",
"strpos",
"(",
"$",
"this",
"->",
"string",
",",
"'(?<value>'",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Confirms if a valid regex string contains a key and a value named suppattern.
A simple directive matcher MUST contain a key and a value named subpattern.
A starting block directive matcher MUST contain a key and a value named subpattern.
@return bool true if the string is valid, false otherwise | [
"Confirms",
"if",
"a",
"valid",
"regex",
"string",
"contains",
"a",
"key",
"and",
"a",
"value",
"named",
"suppattern",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Parser/Checker.php#L105-L116 |
11,792 | DevGroup-ru/dotplant-entity-structure | src/models/StructureTranslation.php | StructureTranslation.validateUrl | public function validateUrl($attribute, $params)
{
$parentParentId = (null === $this->structure) ? 0 : (int)$this->structure->parent_id;
$parentContextId = (null === $this->structure) ? 0 : (int)$this->structure->context_id;
if (
$this->slug != $this->oldSlug
|| $this->parentParentId !== $parentParentId
|| $this->parentContextId !== $parentContextId
) {
$url = $this->compileUrl();
$query = self::find()
->select('url')
->innerJoin(
BaseStructure::tableName(),
'model_id = ' . BaseStructure::tableName() . '.id'
)
->where([
'language_id' => $this->language_id,
'context_id' => $this->parentContextId,
'url' => $url
]);
if (false === $this->isNewRecord) {
$query->andWhere(['not', ['model_id' => $this->model_id]]);
}
$isset = $query->scalar();
if (false !== $isset) {
$this->addError('slug', Yii::t(
'dotplant.entity.structure',
'Value \'{value}\' already in use, please, choose another!',
['value' => $this->slug]
));
}
$this->url = $url;
}
} | php | public function validateUrl($attribute, $params)
{
$parentParentId = (null === $this->structure) ? 0 : (int)$this->structure->parent_id;
$parentContextId = (null === $this->structure) ? 0 : (int)$this->structure->context_id;
if (
$this->slug != $this->oldSlug
|| $this->parentParentId !== $parentParentId
|| $this->parentContextId !== $parentContextId
) {
$url = $this->compileUrl();
$query = self::find()
->select('url')
->innerJoin(
BaseStructure::tableName(),
'model_id = ' . BaseStructure::tableName() . '.id'
)
->where([
'language_id' => $this->language_id,
'context_id' => $this->parentContextId,
'url' => $url
]);
if (false === $this->isNewRecord) {
$query->andWhere(['not', ['model_id' => $this->model_id]]);
}
$isset = $query->scalar();
if (false !== $isset) {
$this->addError('slug', Yii::t(
'dotplant.entity.structure',
'Value \'{value}\' already in use, please, choose another!',
['value' => $this->slug]
));
}
$this->url = $url;
}
} | [
"public",
"function",
"validateUrl",
"(",
"$",
"attribute",
",",
"$",
"params",
")",
"{",
"$",
"parentParentId",
"=",
"(",
"null",
"===",
"$",
"this",
"->",
"structure",
")",
"?",
"0",
":",
"(",
"int",
")",
"$",
"this",
"->",
"structure",
"->",
"parent_id",
";",
"$",
"parentContextId",
"=",
"(",
"null",
"===",
"$",
"this",
"->",
"structure",
")",
"?",
"0",
":",
"(",
"int",
")",
"$",
"this",
"->",
"structure",
"->",
"context_id",
";",
"if",
"(",
"$",
"this",
"->",
"slug",
"!=",
"$",
"this",
"->",
"oldSlug",
"||",
"$",
"this",
"->",
"parentParentId",
"!==",
"$",
"parentParentId",
"||",
"$",
"this",
"->",
"parentContextId",
"!==",
"$",
"parentContextId",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"compileUrl",
"(",
")",
";",
"$",
"query",
"=",
"self",
"::",
"find",
"(",
")",
"->",
"select",
"(",
"'url'",
")",
"->",
"innerJoin",
"(",
"BaseStructure",
"::",
"tableName",
"(",
")",
",",
"'model_id = '",
".",
"BaseStructure",
"::",
"tableName",
"(",
")",
".",
"'.id'",
")",
"->",
"where",
"(",
"[",
"'language_id'",
"=>",
"$",
"this",
"->",
"language_id",
",",
"'context_id'",
"=>",
"$",
"this",
"->",
"parentContextId",
",",
"'url'",
"=>",
"$",
"url",
"]",
")",
";",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"isNewRecord",
")",
"{",
"$",
"query",
"->",
"andWhere",
"(",
"[",
"'not'",
",",
"[",
"'model_id'",
"=>",
"$",
"this",
"->",
"model_id",
"]",
"]",
")",
";",
"}",
"$",
"isset",
"=",
"$",
"query",
"->",
"scalar",
"(",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"isset",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"'slug'",
",",
"Yii",
"::",
"t",
"(",
"'dotplant.entity.structure'",
",",
"'Value \\'{value}\\' already in use, please, choose another!'",
",",
"[",
"'value'",
"=>",
"$",
"this",
"->",
"slug",
"]",
")",
")",
";",
"}",
"$",
"this",
"->",
"url",
"=",
"$",
"url",
";",
"}",
"}"
] | Validates url to be unique among other in one context and in one language range
@param $attribute
@param $params | [
"Validates",
"url",
"to",
"be",
"unique",
"among",
"other",
"in",
"one",
"context",
"and",
"in",
"one",
"language",
"range"
] | 43e3354b5ebf9171e9afef38d82dccb02357bfed | https://github.com/DevGroup-ru/dotplant-entity-structure/blob/43e3354b5ebf9171e9afef38d82dccb02357bfed/src/models/StructureTranslation.php#L104-L138 |
11,793 | corycollier/php-cli | src/Output.php | Output.write | public function write($message, $params = [])
{
$options = $this->getMergedWriteParams($params);
echo $this->getMessagePrefix($options)
, $this->getDecoratedMessage($message, $options)
, $this->getReset();
return $this;
} | php | public function write($message, $params = [])
{
$options = $this->getMergedWriteParams($params);
echo $this->getMessagePrefix($options)
, $this->getDecoratedMessage($message, $options)
, $this->getReset();
return $this;
} | [
"public",
"function",
"write",
"(",
"$",
"message",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getMergedWriteParams",
"(",
"$",
"params",
")",
";",
"echo",
"$",
"this",
"->",
"getMessagePrefix",
"(",
"$",
"options",
")",
",",
"$",
"this",
"->",
"getDecoratedMessage",
"(",
"$",
"message",
",",
"$",
"options",
")",
",",
"$",
"this",
"->",
"getReset",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | writes a messge to the output
@param string $message The message to write.
@param array $params Array of parameters for writing.
@return \PhpCli\Output Return $this for object-chaining. | [
"writes",
"a",
"messge",
"to",
"the",
"output"
] | f6763c1b22a674ce9d83f179538d5500fa573ec5 | https://github.com/corycollier/php-cli/blob/f6763c1b22a674ce9d83f179538d5500fa573ec5/src/Output.php#L60-L69 |
11,794 | corycollier/php-cli | src/Output.php | Output.getMergedWriteParams | protected function getMergedWriteParams($params = [])
{
$defaults = [
'background' => false,
'color' => false,
'bold' => false,
'underline' => false,
];
return array_merge($defaults, $params);
} | php | protected function getMergedWriteParams($params = [])
{
$defaults = [
'background' => false,
'color' => false,
'bold' => false,
'underline' => false,
];
return array_merge($defaults, $params);
} | [
"protected",
"function",
"getMergedWriteParams",
"(",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'background'",
"=>",
"false",
",",
"'color'",
"=>",
"false",
",",
"'bold'",
"=>",
"false",
",",
"'underline'",
"=>",
"false",
",",
"]",
";",
"return",
"array_merge",
"(",
"$",
"defaults",
",",
"$",
"params",
")",
";",
"}"
] | Gets merged params with defaults
@param array $params An array of parameters to merge with.
@return array An array of merged parameters. | [
"Gets",
"merged",
"params",
"with",
"defaults"
] | f6763c1b22a674ce9d83f179538d5500fa573ec5 | https://github.com/corycollier/php-cli/blob/f6763c1b22a674ce9d83f179538d5500fa573ec5/src/Output.php#L89-L99 |
11,795 | corycollier/php-cli | src/Output.php | Output.getDecoratedMessage | protected function getDecoratedMessage($message, $params = [])
{
$result = '';
$prefix = '';
foreach ($params as $option => $value) {
if ($value) {
$result .= $prefix . $this->decorations[$option][$value];
$prefix = ';';
}
}
if ($prefix) {
$message = 'm' . $message;
}
return $result . $message;
} | php | protected function getDecoratedMessage($message, $params = [])
{
$result = '';
$prefix = '';
foreach ($params as $option => $value) {
if ($value) {
$result .= $prefix . $this->decorations[$option][$value];
$prefix = ';';
}
}
if ($prefix) {
$message = 'm' . $message;
}
return $result . $message;
} | [
"protected",
"function",
"getDecoratedMessage",
"(",
"$",
"message",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"prefix",
"=",
"''",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
")",
"{",
"$",
"result",
".=",
"$",
"prefix",
".",
"$",
"this",
"->",
"decorations",
"[",
"$",
"option",
"]",
"[",
"$",
"value",
"]",
";",
"$",
"prefix",
"=",
"';'",
";",
"}",
"}",
"if",
"(",
"$",
"prefix",
")",
"{",
"$",
"message",
"=",
"'m'",
".",
"$",
"message",
";",
"}",
"return",
"$",
"result",
".",
"$",
"message",
";",
"}"
] | Gets a decorated version of the message.
@param string $message The message to output.
@param array $params An array of options for outputting the message.
@return string The decorated message. | [
"Gets",
"a",
"decorated",
"version",
"of",
"the",
"message",
"."
] | f6763c1b22a674ce9d83f179538d5500fa573ec5 | https://github.com/corycollier/php-cli/blob/f6763c1b22a674ce9d83f179538d5500fa573ec5/src/Output.php#L109-L125 |
11,796 | samurai-fw/samurai | src/Samurai/Component/Core/Config.php | Config.import | public function import($file)
{
$data = $this->yaml->load($file);
parent::import($data);
} | php | public function import($file)
{
$data = $this->yaml->load($file);
parent::import($data);
} | [
"public",
"function",
"import",
"(",
"$",
"file",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"yaml",
"->",
"load",
"(",
"$",
"file",
")",
";",
"parent",
"::",
"import",
"(",
"$",
"data",
")",
";",
"}"
] | import config file.
@access public
@param string $file | [
"import",
"config",
"file",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Core/Config.php#L50-L54 |
11,797 | digipolisgent/openbib-id-api | src/Value/UserActivities/HoldCollection.php | HoldCollection.fromXml | public static function fromXml(\DOMNodeList $xml)
{
$items = array();
foreach ($xml as $xmlTag) {
$items[] = Hold::fromXml($xmlTag);
}
return new static($items);
} | php | public static function fromXml(\DOMNodeList $xml)
{
$items = array();
foreach ($xml as $xmlTag) {
$items[] = Hold::fromXml($xmlTag);
}
return new static($items);
} | [
"public",
"static",
"function",
"fromXml",
"(",
"\\",
"DOMNodeList",
"$",
"xml",
")",
"{",
"$",
"items",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"as",
"$",
"xmlTag",
")",
"{",
"$",
"items",
"[",
"]",
"=",
"Hold",
"::",
"fromXml",
"(",
"$",
"xmlTag",
")",
";",
"}",
"return",
"new",
"static",
"(",
"$",
"items",
")",
";",
"}"
] | Builds a HoldCollection object from XML.
@param \DOMNodeList $xml
The list of xml tags representing the holds.
@return HoldCollection
A HoldCollection object. | [
"Builds",
"a",
"HoldCollection",
"object",
"from",
"XML",
"."
] | 79f58dec53a91f44333d10fa4ef79f85f31fc2de | https://github.com/digipolisgent/openbib-id-api/blob/79f58dec53a91f44333d10fa4ef79f85f31fc2de/src/Value/UserActivities/HoldCollection.php#L18-L25 |
11,798 | lasallecrm/lasallecrm-l5-listmanagement-pkg | src/Http/Controllers/FrontendListSubscribeController.php | FrontendListSubscribeController.subscribeform | public function subscribeform($listID) {
if (!$this->subscribeToList->getListByID($listID)) {
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.list_invalid', [
'title' => 'Invalid List',
]);
}
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_form', [
'title' => 'List Sign-up',
'email_field_only' => Config::get('lasallecrmlistmanagement.listmgmt_subscribe_form_email_field_only'),
'list' => $this->subscribeToList->getListnameByListId($listID),
'listID' => $listID,
]);
} | php | public function subscribeform($listID) {
if (!$this->subscribeToList->getListByID($listID)) {
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.list_invalid', [
'title' => 'Invalid List',
]);
}
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_form', [
'title' => 'List Sign-up',
'email_field_only' => Config::get('lasallecrmlistmanagement.listmgmt_subscribe_form_email_field_only'),
'list' => $this->subscribeToList->getListnameByListId($listID),
'listID' => $listID,
]);
} | [
"public",
"function",
"subscribeform",
"(",
"$",
"listID",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"subscribeToList",
"->",
"getListByID",
"(",
"$",
"listID",
")",
")",
"{",
"return",
"view",
"(",
"'lasallecrmlistmanagement::subscribe-unsubscribe-list.list_invalid'",
",",
"[",
"'title'",
"=>",
"'Invalid List'",
",",
"]",
")",
";",
"}",
"return",
"view",
"(",
"'lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_form'",
",",
"[",
"'title'",
"=>",
"'List Sign-up'",
",",
"'email_field_only'",
"=>",
"Config",
"::",
"get",
"(",
"'lasallecrmlistmanagement.listmgmt_subscribe_form_email_field_only'",
")",
",",
"'list'",
"=>",
"$",
"this",
"->",
"subscribeToList",
"->",
"getListnameByListId",
"(",
"$",
"listID",
")",
",",
"'listID'",
"=>",
"$",
"listID",
",",
"]",
")",
";",
"}"
] | Display the subscribe form for a given list ID
@param int $listID The "id" field of the "email_list" db table
@return \Illuminate\Http\Response | [
"Display",
"the",
"subscribe",
"form",
"for",
"a",
"given",
"list",
"ID"
] | 4b5da1af5d25d5fb4be5199f3cf22da313d475f3 | https://github.com/lasallecrm/lasallecrm-l5-listmanagement-pkg/blob/4b5da1af5d25d5fb4be5199f3cf22da313d475f3/src/Http/Controllers/FrontendListSubscribeController.php#L79-L93 |
11,799 | lasallecrm/lasallecrm-l5-listmanagement-pkg | src/Http/Controllers/FrontendListSubscribeController.php | FrontendListSubscribeController.postSubscribe | public function postSubscribe(Request $request) {
// Does the email ID exist in the "list_emails" table for this list ID already?
// We need the email ID, but only have an email address. See if this email address exists in the "emails" db table
if ($this->subscribeToList->getEmailIDByTitle($request->input('email'))) {
// yes, the email address exists in the "emails" db table
if ($this->subscribeToList->getList_emailByEmailIdAndListId(
$this->subscribeToList->getEmailIDByTitle($request->input('email')),
$request->input('listID')
)
) {
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_email_already_in_list', [
'title' => $this->subscribeToList->getListnameByListId($request->input('listID')),
'email' => $request->input('email')
]);
}
}
// Add email to the email list
$emailID = $this->subscribeToList->getEmailIDByTitle($request->input('email'));
if (!$emailID) {
// The email address does NOT exist in the "emails" db table.
// So, create the email address in the "emails" db table
// (i) prep the data
$data = $this->subscribeToList->prepareEmailDataForInsert($request);
// (ii) create the new record
$emailID = $this->subscribeToList->createNewEmailRecord($data);
}
// if the INSERT to the "emails" db table failed, then try the subscribe all over again
if (!$emailID) {
$message = "Something did not quite go right in the processing. Please try again.";
Session::flash('message', $message);
return redirect('list/subscribe/'.$request->input('listID'))
->withInput()
;
}
// INSERT INTO list_email
// consolidate POST vars and processed data into one array
$input = array_merge($request->all(),['emailID' => $emailID]);
// prep the data for the INSERT
$data = $this->subscribeToList->prepareList_emailDataForInsert($input);
// INSERT record
$list_emailID = $this->subscribeToList->createNewList_emailRecord($data);
// if the INSERT into the "list_email" db table failed, then try the subscribe all over again
if (!$list_emailID) {
$message = "Something did not go quite right in the processing. Please try again.";
Session::flash('message', $message);
return redirect('list/subscribe/'.$request->input('listID'))
->withInput()
;
}
if ($request->has('surname')) {
$peopleID = $this->subscribeToList->isFirstnameSurname($request->input('first_name'), $request->input('surname'));
if (!$peopleID) {
// prep the data for the INSERT
$data = $this->subscribeToList->preparePeoplesDataForInsert($input);
// INSERT record
$peopleID = $this->subscribeToList->createNewPeoplesRecord($data);
}
if ($peopleID) {
// INSERT INTO people_email
$people_emailID = $this->subscribeToList->createNewPeople_emailRecord(['people_id' => $peopleID, 'email_id' => $emailID]);
}
if (!$people_emailID) {
// whaddaya mean the INSERT INTO "people_email" failed?! try again...
$people_emailID = $this->subscribeToList->createNewPeople_emailRecord(['people_id' => $peopleID, 'email_id' => $emailID]);
}
}
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_success', [
'title' => $this->subscribeToList->getListnameByListId($request->input('listID')),
'email' => $request->input('email')
]);
} | php | public function postSubscribe(Request $request) {
// Does the email ID exist in the "list_emails" table for this list ID already?
// We need the email ID, but only have an email address. See if this email address exists in the "emails" db table
if ($this->subscribeToList->getEmailIDByTitle($request->input('email'))) {
// yes, the email address exists in the "emails" db table
if ($this->subscribeToList->getList_emailByEmailIdAndListId(
$this->subscribeToList->getEmailIDByTitle($request->input('email')),
$request->input('listID')
)
) {
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_email_already_in_list', [
'title' => $this->subscribeToList->getListnameByListId($request->input('listID')),
'email' => $request->input('email')
]);
}
}
// Add email to the email list
$emailID = $this->subscribeToList->getEmailIDByTitle($request->input('email'));
if (!$emailID) {
// The email address does NOT exist in the "emails" db table.
// So, create the email address in the "emails" db table
// (i) prep the data
$data = $this->subscribeToList->prepareEmailDataForInsert($request);
// (ii) create the new record
$emailID = $this->subscribeToList->createNewEmailRecord($data);
}
// if the INSERT to the "emails" db table failed, then try the subscribe all over again
if (!$emailID) {
$message = "Something did not quite go right in the processing. Please try again.";
Session::flash('message', $message);
return redirect('list/subscribe/'.$request->input('listID'))
->withInput()
;
}
// INSERT INTO list_email
// consolidate POST vars and processed data into one array
$input = array_merge($request->all(),['emailID' => $emailID]);
// prep the data for the INSERT
$data = $this->subscribeToList->prepareList_emailDataForInsert($input);
// INSERT record
$list_emailID = $this->subscribeToList->createNewList_emailRecord($data);
// if the INSERT into the "list_email" db table failed, then try the subscribe all over again
if (!$list_emailID) {
$message = "Something did not go quite right in the processing. Please try again.";
Session::flash('message', $message);
return redirect('list/subscribe/'.$request->input('listID'))
->withInput()
;
}
if ($request->has('surname')) {
$peopleID = $this->subscribeToList->isFirstnameSurname($request->input('first_name'), $request->input('surname'));
if (!$peopleID) {
// prep the data for the INSERT
$data = $this->subscribeToList->preparePeoplesDataForInsert($input);
// INSERT record
$peopleID = $this->subscribeToList->createNewPeoplesRecord($data);
}
if ($peopleID) {
// INSERT INTO people_email
$people_emailID = $this->subscribeToList->createNewPeople_emailRecord(['people_id' => $peopleID, 'email_id' => $emailID]);
}
if (!$people_emailID) {
// whaddaya mean the INSERT INTO "people_email" failed?! try again...
$people_emailID = $this->subscribeToList->createNewPeople_emailRecord(['people_id' => $peopleID, 'email_id' => $emailID]);
}
}
return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_success', [
'title' => $this->subscribeToList->getListnameByListId($request->input('listID')),
'email' => $request->input('email')
]);
} | [
"public",
"function",
"postSubscribe",
"(",
"Request",
"$",
"request",
")",
"{",
"// Does the email ID exist in the \"list_emails\" table for this list ID already?",
"// We need the email ID, but only have an email address. See if this email address exists in the \"emails\" db table",
"if",
"(",
"$",
"this",
"->",
"subscribeToList",
"->",
"getEmailIDByTitle",
"(",
"$",
"request",
"->",
"input",
"(",
"'email'",
")",
")",
")",
"{",
"// yes, the email address exists in the \"emails\" db table",
"if",
"(",
"$",
"this",
"->",
"subscribeToList",
"->",
"getList_emailByEmailIdAndListId",
"(",
"$",
"this",
"->",
"subscribeToList",
"->",
"getEmailIDByTitle",
"(",
"$",
"request",
"->",
"input",
"(",
"'email'",
")",
")",
",",
"$",
"request",
"->",
"input",
"(",
"'listID'",
")",
")",
")",
"{",
"return",
"view",
"(",
"'lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_email_already_in_list'",
",",
"[",
"'title'",
"=>",
"$",
"this",
"->",
"subscribeToList",
"->",
"getListnameByListId",
"(",
"$",
"request",
"->",
"input",
"(",
"'listID'",
")",
")",
",",
"'email'",
"=>",
"$",
"request",
"->",
"input",
"(",
"'email'",
")",
"]",
")",
";",
"}",
"}",
"// Add email to the email list",
"$",
"emailID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"getEmailIDByTitle",
"(",
"$",
"request",
"->",
"input",
"(",
"'email'",
")",
")",
";",
"if",
"(",
"!",
"$",
"emailID",
")",
"{",
"// The email address does NOT exist in the \"emails\" db table.",
"// So, create the email address in the \"emails\" db table",
"// (i) prep the data",
"$",
"data",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"prepareEmailDataForInsert",
"(",
"$",
"request",
")",
";",
"// (ii) create the new record",
"$",
"emailID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"createNewEmailRecord",
"(",
"$",
"data",
")",
";",
"}",
"// if the INSERT to the \"emails\" db table failed, then try the subscribe all over again",
"if",
"(",
"!",
"$",
"emailID",
")",
"{",
"$",
"message",
"=",
"\"Something did not quite go right in the processing. Please try again.\"",
";",
"Session",
"::",
"flash",
"(",
"'message'",
",",
"$",
"message",
")",
";",
"return",
"redirect",
"(",
"'list/subscribe/'",
".",
"$",
"request",
"->",
"input",
"(",
"'listID'",
")",
")",
"->",
"withInput",
"(",
")",
";",
"}",
"// INSERT INTO list_email",
"// consolidate POST vars and processed data into one array",
"$",
"input",
"=",
"array_merge",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'emailID'",
"=>",
"$",
"emailID",
"]",
")",
";",
"// prep the data for the INSERT",
"$",
"data",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"prepareList_emailDataForInsert",
"(",
"$",
"input",
")",
";",
"// INSERT record",
"$",
"list_emailID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"createNewList_emailRecord",
"(",
"$",
"data",
")",
";",
"// if the INSERT into the \"list_email\" db table failed, then try the subscribe all over again",
"if",
"(",
"!",
"$",
"list_emailID",
")",
"{",
"$",
"message",
"=",
"\"Something did not go quite right in the processing. Please try again.\"",
";",
"Session",
"::",
"flash",
"(",
"'message'",
",",
"$",
"message",
")",
";",
"return",
"redirect",
"(",
"'list/subscribe/'",
".",
"$",
"request",
"->",
"input",
"(",
"'listID'",
")",
")",
"->",
"withInput",
"(",
")",
";",
"}",
"if",
"(",
"$",
"request",
"->",
"has",
"(",
"'surname'",
")",
")",
"{",
"$",
"peopleID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"isFirstnameSurname",
"(",
"$",
"request",
"->",
"input",
"(",
"'first_name'",
")",
",",
"$",
"request",
"->",
"input",
"(",
"'surname'",
")",
")",
";",
"if",
"(",
"!",
"$",
"peopleID",
")",
"{",
"// prep the data for the INSERT",
"$",
"data",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"preparePeoplesDataForInsert",
"(",
"$",
"input",
")",
";",
"// INSERT record",
"$",
"peopleID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"createNewPeoplesRecord",
"(",
"$",
"data",
")",
";",
"}",
"if",
"(",
"$",
"peopleID",
")",
"{",
"// INSERT INTO people_email",
"$",
"people_emailID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"createNewPeople_emailRecord",
"(",
"[",
"'people_id'",
"=>",
"$",
"peopleID",
",",
"'email_id'",
"=>",
"$",
"emailID",
"]",
")",
";",
"}",
"if",
"(",
"!",
"$",
"people_emailID",
")",
"{",
"// whaddaya mean the INSERT INTO \"people_email\" failed?! try again...",
"$",
"people_emailID",
"=",
"$",
"this",
"->",
"subscribeToList",
"->",
"createNewPeople_emailRecord",
"(",
"[",
"'people_id'",
"=>",
"$",
"peopleID",
",",
"'email_id'",
"=>",
"$",
"emailID",
"]",
")",
";",
"}",
"}",
"return",
"view",
"(",
"'lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_success'",
",",
"[",
"'title'",
"=>",
"$",
"this",
"->",
"subscribeToList",
"->",
"getListnameByListId",
"(",
"$",
"request",
"->",
"input",
"(",
"'listID'",
")",
")",
",",
"'email'",
"=>",
"$",
"request",
"->",
"input",
"(",
"'email'",
")",
"]",
")",
";",
"}"
] | Subscribe someone to a LaSalleCRM email list from the filled in subscribe form
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response | [
"Subscribe",
"someone",
"to",
"a",
"LaSalleCRM",
"email",
"list",
"from",
"the",
"filled",
"in",
"subscribe",
"form"
] | 4b5da1af5d25d5fb4be5199f3cf22da313d475f3 | https://github.com/lasallecrm/lasallecrm-l5-listmanagement-pkg/blob/4b5da1af5d25d5fb4be5199f3cf22da313d475f3/src/Http/Controllers/FrontendListSubscribeController.php#L101-L196 |
Subsets and Splits