repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
josegonzalez/cakephp-sanction | View/Helper/ClearanceHelper.php | ClearanceHelper.parse | public function parse($currentRoute, $permit) {
$route = $permit['route'];
$count = count($route);
if ($count == 0) {
return false;
}
foreach ($route as $key => $value) {
if (isset($currentRoute[$key])) {
$values = (is_array($value)) ? $value : array($value);
foreach ($values as $k => $v) {
... | php | public function parse($currentRoute, $permit) {
$route = $permit['route'];
$count = count($route);
if ($count == 0) {
return false;
}
foreach ($route as $key => $value) {
if (isset($currentRoute[$key])) {
$values = (is_array($value)) ? $value : array($value);
foreach ($values as $k => $v) {
... | [
"public",
"function",
"parse",
"(",
"$",
"currentRoute",
",",
"$",
"permit",
")",
"{",
"$",
"route",
"=",
"$",
"permit",
"[",
"'route'",
"]",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"route",
")",
";",
"if",
"(",
"$",
"count",
"==",
"0",
")",
... | Parses the passed route against a rule
@param string $currentRoute route being testing
@param string $permit Permit variable that contains a route being tested against
@return void
@author Jose Diaz-Gonzalez | [
"Parses",
"the",
"passed",
"route",
"against",
"a",
"rule"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/View/Helper/ClearanceHelper.php#L128-L147 |
josegonzalez/cakephp-sanction | View/Helper/ClearanceHelper.php | ClearanceHelper.execute | public function execute($route, $title, $url = null, $options = array(), $confirmMessage = false) {
if (empty($route['rules'])) {
return $this->Html->link($title, $url, $options, $confirmMessage);
}
if (isset($route['rules']['deny'])) {
return ($route['rules']['deny'] == true) ? null : $this->Html->link($t... | php | public function execute($route, $title, $url = null, $options = array(), $confirmMessage = false) {
if (empty($route['rules'])) {
return $this->Html->link($title, $url, $options, $confirmMessage);
}
if (isset($route['rules']['deny'])) {
return ($route['rules']['deny'] == true) ? null : $this->Html->link($t... | [
"public",
"function",
"execute",
"(",
"$",
"route",
",",
"$",
"title",
",",
"$",
"url",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"confirmMessage",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"route",
"[",
"'ru... | Executes the route based on it's rules
@param string $route route being executed
@param string $title The content to be wrapped by <a> tags.
@param mixed $url Cake-relative URL or array of URL parameters, or external URL (starts with http://)
@param array $options Array of HTML attributes.
@param string $confirmMessag... | [
"Executes",
"the",
"route",
"based",
"on",
"it",
"s",
"rules"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/View/Helper/ClearanceHelper.php#L160-L214 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.store | public function store( $id, $data, $attributes = array() )
{
$metaStorage = $this->getMetaDataStorage();
$metaStorage->lock();
$metaData = $this->getMetaData( $metaStorage );
foreach( $this->storageStack as $storageConf )
{
call_user_func(
... | php | public function store( $id, $data, $attributes = array() )
{
$metaStorage = $this->getMetaDataStorage();
$metaStorage->lock();
$metaData = $this->getMetaData( $metaStorage );
foreach( $this->storageStack as $storageConf )
{
call_user_func(
... | [
"public",
"function",
"store",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"metaStorage",
"=",
"$",
"this",
"->",
"getMetaDataStorage",
"(",
")",
";",
"$",
"metaStorage",
"->",
"lock",
"(",
")",
... | Stores data in the cache stack.
This method will store the given data across the complete stack. It can
afterwards be restored using the {@link ezcCacheStack::restore()} method
and be deleted through the {@link ezcCacheStack::delete()} method.
The data that can be stored in the cache depends on the configured
storage... | [
"Stores",
"data",
"in",
"the",
"cache",
"stack",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L207-L231 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.getMetaData | private function getMetaData( ezcCacheStackMetaDataStorage $metaStorage )
{
$metaData = $metaStorage->restoreMetaData();
if ( $metaData === null )
{
$metaData = call_user_func(
array(
$this->properties['options']->replacementStrategy,
... | php | private function getMetaData( ezcCacheStackMetaDataStorage $metaStorage )
{
$metaData = $metaStorage->restoreMetaData();
if ( $metaData === null )
{
$metaData = call_user_func(
array(
$this->properties['options']->replacementStrategy,
... | [
"private",
"function",
"getMetaData",
"(",
"ezcCacheStackMetaDataStorage",
"$",
"metaStorage",
")",
"{",
"$",
"metaData",
"=",
"$",
"metaStorage",
"->",
"restoreMetaData",
"(",
")",
";",
"if",
"(",
"$",
"metaData",
"===",
"null",
")",
"{",
"$",
"metaData",
"... | Returns the meta data to use.
Returns the meta data to use with the configured {@link
ezcCacheStackStackReplacementStrategy}.
@param ezcCacheStackMetaDataStorage $metaStorage
@return ezcCacheMetaData | [
"Returns",
"the",
"meta",
"data",
"to",
"use",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L242-L257 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.restore | public function restore( $id, $attributes = array(), $search = false )
{
$metaStorage = $this->getMetaDataStorage();
$metaStorage->lock();
$metaData = $this->getMetaData( $metaStorage );
$item = false;
foreach ( $this->storageStack as $storageConf )
{
$i... | php | public function restore( $id, $attributes = array(), $search = false )
{
$metaStorage = $this->getMetaDataStorage();
$metaStorage->lock();
$metaData = $this->getMetaData( $metaStorage );
$item = false;
foreach ( $this->storageStack as $storageConf )
{
$i... | [
"public",
"function",
"restore",
"(",
"$",
"id",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"search",
"=",
"false",
")",
"{",
"$",
"metaStorage",
"=",
"$",
"this",
"->",
"getMetaDataStorage",
"(",
")",
";",
"$",
"metaStorage",
"->",
"l... | Restores an item from the stack.
This method tries to restore an item from the cache stack and returns
the found data, if any. If no data is found, boolean false is returned.
Given the ID of an object will restore exactly the desired object. If
additional $attributes are given, this may speed up the restore process
fo... | [
"Restores",
"an",
"item",
"from",
"the",
"stack",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L277-L313 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.bubbleUp | private function bubbleUp( $id, array $attributes, $item, ezcCacheStackStorageConfiguration $foundStorageConf, ezcCacheStackMetaData $metaData )
{
foreach( $this->storageStack as $storageConf )
{
if ( $storageConf === $foundStorageConf )
{
// This was the stor... | php | private function bubbleUp( $id, array $attributes, $item, ezcCacheStackStorageConfiguration $foundStorageConf, ezcCacheStackMetaData $metaData )
{
foreach( $this->storageStack as $storageConf )
{
if ( $storageConf === $foundStorageConf )
{
// This was the stor... | [
"private",
"function",
"bubbleUp",
"(",
"$",
"id",
",",
"array",
"$",
"attributes",
",",
"$",
"item",
",",
"ezcCacheStackStorageConfiguration",
"$",
"foundStorageConf",
",",
"ezcCacheStackMetaData",
"$",
"metaData",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
... | Bubbles a restored $item up to all storages above $foundStorageConf.
@param string $id
@param array $attributes
@param mixed $item
@param ezcCacheStackStorageConfiguration $foundStorageConf
@param ezcCacheStackMetaData $metaData | [
"Bubbles",
"a",
"restored",
"$item",
"up",
"to",
"all",
"storages",
"above",
"$foundStorageConf",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L324-L345 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.delete | public function delete( $id = null, $attributes = array(), $search = false )
{
$metaStorage = $this->getMetaDataStorage();
$metaStorage->lock();
$metaData = $metaStorage->restoreMetaData();
$deletedIds = array();
foreach ( $this->storageStack as $storageConf )
{
... | php | public function delete( $id = null, $attributes = array(), $search = false )
{
$metaStorage = $this->getMetaDataStorage();
$metaStorage->lock();
$metaData = $metaStorage->restoreMetaData();
$deletedIds = array();
foreach ( $this->storageStack as $storageConf )
{
... | [
"public",
"function",
"delete",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"search",
"=",
"false",
")",
"{",
"$",
"metaStorage",
"=",
"$",
"this",
"->",
"getMetaDataStorage",
"(",
")",
";",
"$",
"metaStorag... | Deletes an item from the stack.
This method deletes an item from the cache stack. The item will
afterwards no more be stored in any of the inner cache storages. Giving
the ID of the cache item will delete exactly 1 desired item. Giving an
attribute array, describing the desired item in more detail, can speed
up the de... | [
"Deletes",
"an",
"item",
"from",
"the",
"stack",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L372-L402 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.getMetaDataStorage | private function getMetaDataStorage()
{
$metaStorage = $this->options->metaStorage;
if ( $metaStorage === null )
{
$metaStorage = reset( $this->storageStack )->storage;
if ( !( $metaStorage instanceof ezcCacheStackMetaDataStorage ) )
{
thro... | php | private function getMetaDataStorage()
{
$metaStorage = $this->options->metaStorage;
if ( $metaStorage === null )
{
$metaStorage = reset( $this->storageStack )->storage;
if ( !( $metaStorage instanceof ezcCacheStackMetaDataStorage ) )
{
thro... | [
"private",
"function",
"getMetaDataStorage",
"(",
")",
"{",
"$",
"metaStorage",
"=",
"$",
"this",
"->",
"options",
"->",
"metaStorage",
";",
"if",
"(",
"$",
"metaStorage",
"===",
"null",
")",
"{",
"$",
"metaStorage",
"=",
"reset",
"(",
"$",
"this",
"->",... | Returns the meta data storage to be used.
Determines the meta data storage to be used by the stack and returns it.
@return ezcCacheStackMetaData | [
"Returns",
"the",
"meta",
"data",
"storage",
"to",
"be",
"used",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L411-L428 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.countDataItems | public function countDataItems( $id = null, $attributes = array() )
{
$sum = 0;
foreach( $this->storageStack as $storageConf )
{
$sum += $storageConf->storage->countDataItems( $id, $attributes );
}
return $sum;
} | php | public function countDataItems( $id = null, $attributes = array() )
{
$sum = 0;
foreach( $this->storageStack as $storageConf )
{
$sum += $storageConf->storage->countDataItems( $id, $attributes );
}
return $sum;
} | [
"public",
"function",
"countDataItems",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sum",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"storageStack",
"as",
"$",
"storageConf",
")",
"{",
"$",
"s... | Counts how many items are stored, fulfilling certain criteria.
This method counts how many data items fulfilling the given criteria are
stored overall. Note: The items of all contained storages are counted
independantly and summarized.
@param string $id
@param array $attributes
@return int | [
"Counts",
"how",
"many",
"items",
"are",
"stored",
"fulfilling",
"certain",
"criteria",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L441-L449 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.getRemainingLifetime | public function getRemainingLifetime( $id, $attributes = array() )
{
foreach ( $this->storageStack as $storageConf )
{
$lifetime = $storageConf->storage->getRemainingLifetime(
$id,
$attributes
);
if ( $lifetime > 0 )
{
... | php | public function getRemainingLifetime( $id, $attributes = array() )
{
foreach ( $this->storageStack as $storageConf )
{
$lifetime = $storageConf->storage->getRemainingLifetime(
$id,
$attributes
);
if ( $lifetime > 0 )
{
... | [
"public",
"function",
"getRemainingLifetime",
"(",
"$",
"id",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"storageStack",
"as",
"$",
"storageConf",
")",
"{",
"$",
"lifetime",
"=",
"$",
"storageConf",
"->",... | Returns the remaining lifetime for the given item ID.
This method returns the lifetime in seconds for the item identified by $item
and optionally described by $attributes. Definining the $attributes
might lead to faster results with some caches.
The first internal storage that is found for the data item is chosen to
... | [
"Returns",
"the",
"remaining",
"lifetime",
"for",
"the",
"given",
"item",
"ID",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L466-L480 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.pushStorage | public function pushStorage( ezcCacheStackStorageConfiguration $storageConf )
{
if ( isset( $this->storageIdMap[$storageConf->id] ) )
{
throw new ezcCacheStackIdAlreadyUsedException(
$storageConf->id
);
}
if ( in_array( $storageConf->storage, $... | php | public function pushStorage( ezcCacheStackStorageConfiguration $storageConf )
{
if ( isset( $this->storageIdMap[$storageConf->id] ) )
{
throw new ezcCacheStackIdAlreadyUsedException(
$storageConf->id
);
}
if ( in_array( $storageConf->storage, $... | [
"public",
"function",
"pushStorage",
"(",
"ezcCacheStackStorageConfiguration",
"$",
"storageConf",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"storageIdMap",
"[",
"$",
"storageConf",
"->",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"ezcCacheStackIdAl... | Add a storage to the top of the stack.
This method is used to add a new storage to the top of the cache. The
$storageConf of type {@link ezcCacheStackStorageConfiguration} consists
of the actual {@link ezcCacheStackableStorage} and other information.
Most importantly, the configuration object contains an ID, which mu... | [
"Add",
"a",
"storage",
"to",
"the",
"top",
"of",
"the",
"stack",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L498-L514 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php | ezcCacheStack.popStorage | public function popStorage()
{
if ( count( $this->storageStack ) === 0 )
{
throw new ezcCacheStackUnderflowException();
}
$storageConf = array_shift( $this->storageStack );
unset( $this->storageIdMap[$storageConf->id] );
return $storageConf;
} | php | public function popStorage()
{
if ( count( $this->storageStack ) === 0 )
{
throw new ezcCacheStackUnderflowException();
}
$storageConf = array_shift( $this->storageStack );
unset( $this->storageIdMap[$storageConf->id] );
return $storageConf;
} | [
"public",
"function",
"popStorage",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"storageStack",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ezcCacheStackUnderflowException",
"(",
")",
";",
"}",
"$",
"storageConf",
"=",
"array_shift",
"(",
... | Removes a storage from the top of the stack.
This method can be used to remove the top most {@link
ezcCacheStackableStorage} from the stack. This is commonly done to
remove caches or to insert new ones into lower positions. In both cases,
it is recommended to {@link ezcCacheStack::reset()} the whole cache
afterwards t... | [
"Removes",
"a",
"storage",
"from",
"the",
"top",
"of",
"the",
"stack",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/stack.php#L530-L539 |
oroinc/OroLayoutComponent | Extension/Theme/ResourceProvider/ThemeResourceProvider.php | ThemeResourceProvider.getResources | public function getResources()
{
if (!$this->resources) {
if ($this->cache instanceof Cache && $this->cache->contains(self::CACHE_KEY)) {
$this->resources = $this->cache->fetch(self::CACHE_KEY);
} else {
$this->loadResources();
}
}
... | php | public function getResources()
{
if (!$this->resources) {
if ($this->cache instanceof Cache && $this->cache->contains(self::CACHE_KEY)) {
$this->resources = $this->cache->fetch(self::CACHE_KEY);
} else {
$this->loadResources();
}
}
... | [
"public",
"function",
"getResources",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"resources",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cache",
"instanceof",
"Cache",
"&&",
"$",
"this",
"->",
"cache",
"->",
"contains",
"(",
"self",
"::",
"CACHE... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/ResourceProvider/ThemeResourceProvider.php#L62-L73 |
oroinc/OroLayoutComponent | Extension/Theme/ResourceProvider/ThemeResourceProvider.php | ThemeResourceProvider.loadResources | public function loadResources(ContainerBuilder $container = null, array $resources = [])
{
$resources = array_merge($resources, $this->getConfigLoader()->load($container));
foreach ($resources as $resource) {
/**
* $resource->data contains data in following format
... | php | public function loadResources(ContainerBuilder $container = null, array $resources = [])
{
$resources = array_merge($resources, $this->getConfigLoader()->load($container));
foreach ($resources as $resource) {
/**
* $resource->data contains data in following format
... | [
"public",
"function",
"loadResources",
"(",
"ContainerBuilder",
"$",
"container",
"=",
"null",
",",
"array",
"$",
"resources",
"=",
"[",
"]",
")",
"{",
"$",
"resources",
"=",
"array_merge",
"(",
"$",
"resources",
",",
"$",
"this",
"->",
"getConfigLoader",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/ResourceProvider/ThemeResourceProvider.php#L78-L105 |
oroinc/OroLayoutComponent | Extension/Theme/ResourceProvider/ThemeResourceProvider.php | ThemeResourceProvider.findApplicableResources | public function findApplicableResources(array $paths)
{
$result = [];
foreach ($paths as $path) {
$pathArray = explode(DIRECTORY_SEPARATOR, $path);
$value = $this->getResources();
for ($i = 0, $length = count($pathArray); $i < $length; ++$i) {
$v... | php | public function findApplicableResources(array $paths)
{
$result = [];
foreach ($paths as $path) {
$pathArray = explode(DIRECTORY_SEPARATOR, $path);
$value = $this->getResources();
for ($i = 0, $length = count($pathArray); $i < $length; ++$i) {
$v... | [
"public",
"function",
"findApplicableResources",
"(",
"array",
"$",
"paths",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"pathArray",
"=",
"explode",
"(",
"DIRECTORY_SEPARATOR",
",",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/ResourceProvider/ThemeResourceProvider.php#L110-L132 |
oroinc/OroLayoutComponent | Extension/Theme/ResourceProvider/ThemeResourceProvider.php | ThemeResourceProvider.filterThemeLayoutUpdates | private function filterThemeLayoutUpdates(array $existThemePaths, array $themes)
{
foreach ($themes as $theme => $themePaths) {
foreach ($themePaths as $pathIndex => $path) {
if (is_string($path) && isset($existThemePaths[$path])) {
unset($themePaths[$pathInde... | php | private function filterThemeLayoutUpdates(array $existThemePaths, array $themes)
{
foreach ($themes as $theme => $themePaths) {
foreach ($themePaths as $pathIndex => $path) {
if (is_string($path) && isset($existThemePaths[$path])) {
unset($themePaths[$pathInde... | [
"private",
"function",
"filterThemeLayoutUpdates",
"(",
"array",
"$",
"existThemePaths",
",",
"array",
"$",
"themes",
")",
"{",
"foreach",
"(",
"$",
"themes",
"as",
"$",
"theme",
"=>",
"$",
"themePaths",
")",
"{",
"foreach",
"(",
"$",
"themePaths",
"as",
"... | @param array $existThemePaths
@param array $themes
@return array | [
"@param",
"array",
"$existThemePaths",
"@param",
"array",
"$themes"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/ResourceProvider/ThemeResourceProvider.php#L154-L170 |
oroinc/OroLayoutComponent | Extension/Theme/ResourceProvider/ThemeResourceProvider.php | ThemeResourceProvider.sortThemeLayoutUpdates | private function sortThemeLayoutUpdates(array $updates)
{
$directories = [];
$files = [];
foreach ($updates as $key => $update) {
if (is_array($update)) {
$update = $this->sortThemeLayoutUpdates($update);
$directories[$key] = $update;
}... | php | private function sortThemeLayoutUpdates(array $updates)
{
$directories = [];
$files = [];
foreach ($updates as $key => $update) {
if (is_array($update)) {
$update = $this->sortThemeLayoutUpdates($update);
$directories[$key] = $update;
}... | [
"private",
"function",
"sortThemeLayoutUpdates",
"(",
"array",
"$",
"updates",
")",
"{",
"$",
"directories",
"=",
"[",
"]",
";",
"$",
"files",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"updates",
"as",
"$",
"key",
"=>",
"$",
"update",
")",
"{",
"if",
... | @param array $updates
@return array | [
"@param",
"array",
"$updates"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/ResourceProvider/ThemeResourceProvider.php#L178-L196 |
zhouyl/mellivora | Mellivora/Http/Cookies.php | Cookies.setCookie | protected function setCookie($key, $value = null, $expire = 0)
{
if ($value === null) {
Arr::forget($_COOKIE, $key);
} else {
if ($this->defaults['encrypt']) {
$value = $this->getEncryption()->encryptBase64($value);
}
Arr::set($_COOKIE... | php | protected function setCookie($key, $value = null, $expire = 0)
{
if ($value === null) {
Arr::forget($_COOKIE, $key);
} else {
if ($this->defaults['encrypt']) {
$value = $this->getEncryption()->encryptBase64($value);
}
Arr::set($_COOKIE... | [
"protected",
"function",
"setCookie",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
",",
"$",
"expire",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"Arr",
"::",
"forget",
"(",
"$",
"_COOKIE",
",",
"$",
"key",
")",
"... | ookie 设置
@param string $key
@param mixed $value
@param int $expire | [
"ookie",
"设置"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Cookies.php#L93-L114 |
zhouyl/mellivora | Mellivora/Http/Cookies.php | Cookies.set | public function set($key, $value = null, $minutes = null)
{
if ($minutes === null) {
$minutes = $this->defaults['lifetime'];
}
$data = is_array($key) ? $key : [$key => $value];
foreach ($data as $key => $value) {
$this->setCookie($key, $value, time() + $minu... | php | public function set($key, $value = null, $minutes = null)
{
if ($minutes === null) {
$minutes = $this->defaults['lifetime'];
}
$data = is_array($key) ? $key : [$key => $value];
foreach ($data as $key => $value) {
$this->setCookie($key, $value, time() + $minu... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
",",
"$",
"minutes",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"minutes",
"===",
"null",
")",
"{",
"$",
"minutes",
"=",
"$",
"this",
"->",
"defaults",
"[",
"'lifetime'",
"... | 设置 cookie 值
@param string $key
@param mixed $value
@param int $minutes
@return \Mellivora\Http\Cookies | [
"设置",
"cookie",
"值"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Cookies.php#L125-L138 |
zhouyl/mellivora | Mellivora/Http/Cookies.php | Cookies.get | public function get($key, $default = null)
{
$value = Arr::get($_COOKIE, $key);
if ($value === null) {
return $default;
}
return $this->defaults['encrypt']
? $this->getEncryption()->decryptBase64($value)
: $value;
} | php | public function get($key, $default = null)
{
$value = Arr::get($_COOKIE, $key);
if ($value === null) {
return $default;
}
return $this->defaults['encrypt']
? $this->getEncryption()->decryptBase64($value)
: $value;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"Arr",
"::",
"get",
"(",
"$",
"_COOKIE",
",",
"$",
"key",
")",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
... | 获取 cookie 值
@param array $key
@param mixed $default
@return mixed | [
"获取",
"cookie",
"值"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/Cookies.php#L148-L159 |
fccn/oai-pmh-core | src/libs/xml_creater.php | ANDS_XML.addChild | public function addChild($mom_node, $name, $value='')
{
$added_node = $this->doc->createElement($name, $value);
$added_node = $mom_node->appendChild($added_node);
return $added_node;
} | php | public function addChild($mom_node, $name, $value='')
{
$added_node = $this->doc->createElement($name, $value);
$added_node = $mom_node->appendChild($added_node);
return $added_node;
} | [
"public",
"function",
"addChild",
"(",
"$",
"mom_node",
",",
"$",
"name",
",",
"$",
"value",
"=",
"''",
")",
"{",
"$",
"added_node",
"=",
"$",
"this",
"->",
"doc",
"->",
"createElement",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"$",
"added_no... | Add a child node to a parent node on a XML Doc: a worker function.
@param $mom_node
Type: DOMNode. The target node.
@param $name
Type: string. The name of child nade is being added
@param $value
Type: string. Text for the adding node if it is a text node.
@return DOMElement $added_node
The newly created node, can b... | [
"Add",
"a",
"child",
"node",
"to",
"a",
"parent",
"node",
"on",
"a",
"XML",
"Doc",
":",
"a",
"worker",
"function",
"."
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/xml_creater.php#L237-L242 |
fccn/oai-pmh-core | src/libs/xml_creater.php | ANDS_XML.create_request | public function create_request($par_array)
{
//debug_var_dump('par_array', $par_array);
$request = $this->addChild($this->doc->documentElement, "request", $this->request_url());
foreach ($par_array as $key => $value) {
$request->setAttribute($key, $value);
}
} | php | public function create_request($par_array)
{
//debug_var_dump('par_array', $par_array);
$request = $this->addChild($this->doc->documentElement, "request", $this->request_url());
foreach ($par_array as $key => $value) {
$request->setAttribute($key, $value);
}
} | [
"public",
"function",
"create_request",
"(",
"$",
"par_array",
")",
"{",
"//debug_var_dump('par_array', $par_array);",
"$",
"request",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"doc",
"->",
"documentElement",
",",
"\"request\"",
",",
"$",
"this... | Create an OAI request node.
@param $par_array Type: array
The attributes of a request node. They describe the verb of the request and other associated parameters used in the request.
Keys of the array define attributes, and values are their content. | [
"Create",
"an",
"OAI",
"request",
"node",
"."
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/xml_creater.php#L253-L260 |
fccn/oai-pmh-core | src/libs/xml_creater.php | ANDS_Response_XML.add2_verbNode | public function add2_verbNode($nodeName, $value=null)
{
return $this->addChild($this->verbNode, $nodeName, $value);
} | php | public function add2_verbNode($nodeName, $value=null)
{
return $this->addChild($this->verbNode, $nodeName, $value);
} | [
"public",
"function",
"add2_verbNode",
"(",
"$",
"nodeName",
",",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"verbNode",
",",
"$",
"nodeName",
",",
"$",
"value",
")",
";",
"}"
] | Add direct child nodes to verb node (OAI-PMH), e.g. response to ListMetadataFormats.
Different verbs can have different required child nodes.
\see create_record, create_header
\see http://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm.
\param $nodeName Type: string. The name of appending node.
\param $value Typ... | [
"Add",
"direct",
"child",
"nodes",
"to",
"verb",
"node",
"(",
"OAI",
"-",
"PMH",
")",
"e",
".",
"g",
".",
"response",
"to",
"ListMetadataFormats",
".",
"Different",
"verbs",
"can",
"have",
"different",
"required",
"child",
"nodes",
".",
"\\",
"see",
"cre... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/xml_creater.php#L334-L337 |
fccn/oai-pmh-core | src/libs/xml_creater.php | ANDS_Response_XML.create_header | public function create_header($identifier, $timestamp, $ands_class, $add_to_node=null)
{
if (is_null($add_to_node)) {
$header_node = $this->add2_verbNode("header");
} else {
$header_node = $this->addChild($add_to_node, "header");
}
$this->addChild($header_node... | php | public function create_header($identifier, $timestamp, $ands_class, $add_to_node=null)
{
if (is_null($add_to_node)) {
$header_node = $this->add2_verbNode("header");
} else {
$header_node = $this->addChild($add_to_node, "header");
}
$this->addChild($header_node... | [
"public",
"function",
"create_header",
"(",
"$",
"identifier",
",",
"$",
"timestamp",
",",
"$",
"ands_class",
",",
"$",
"add_to_node",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"add_to_node",
")",
")",
"{",
"$",
"header_node",
"=",
"$",
"t... | Headers are enclosed inside of \<record\> to the query of ListRecords, ListIdentifiers and etc.
\param $identifier Type: string. The identifier string for node \<identifier\>.
\param $timestamp Type: timestamp. Timestapme in UTC format for node \<datastamp\>.
\param $ands_class Type: mix. Can be an array or just a str... | [
"Headers",
"are",
"enclosed",
"inside",
"of",
"\\",
"<record",
"\\",
">",
"to",
"the",
"query",
"of",
"ListRecords",
"ListIdentifiers",
"and",
"etc",
"."
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/xml_creater.php#L356-L373 |
fccn/oai-pmh-core | src/libs/xml_creater.php | ANDS_Response_XML.create_metadata | public function create_metadata($mom_record_node)
{
debug_message('****** In '.__FILE__.' function '.__FUNCTION__.' was called.');
$meta_node = $this->addChild($mom_record_node, "metadata");
return $meta_node;
} | php | public function create_metadata($mom_record_node)
{
debug_message('****** In '.__FILE__.' function '.__FUNCTION__.' was called.');
$meta_node = $this->addChild($mom_record_node, "metadata");
return $meta_node;
} | [
"public",
"function",
"create_metadata",
"(",
"$",
"mom_record_node",
")",
"{",
"debug_message",
"(",
"'****** In '",
".",
"__FILE__",
".",
"' function '",
".",
"__FUNCTION__",
".",
"' was called.'",
")",
";",
"$",
"meta_node",
"=",
"$",
"this",
"->",
"addChild"... | Create metadata node for holding metadata. This is always added to \<record\> node.
\param $mom_record_node DOMElement. A node acts as the parent node.
@return $meta_node Type: DOMElement.
The newly created registryObject node which will be used for further expansion.
metadata node itself is maintained by internally ... | [
"Create",
"metadata",
"node",
"for",
"holding",
"metadata",
".",
"This",
"is",
"always",
"added",
"to",
"\\",
"<record",
"\\",
">",
"node",
"."
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/xml_creater.php#L383-L388 |
fccn/oai-pmh-core | src/libs/xml_creater.php | ANDS_Response_XML.create_resumpToken | public function create_resumpToken($token, $expirationdatetime, $num_rows, $cursor=null)
{
$resump_node = $this->addChild($this->verbNode, "resumptionToken", $token);
if (isset($expirationdatetime)) {
$resump_node->setAttribute("expirationDate", $expirationdatetime);
}
$r... | php | public function create_resumpToken($token, $expirationdatetime, $num_rows, $cursor=null)
{
$resump_node = $this->addChild($this->verbNode, "resumptionToken", $token);
if (isset($expirationdatetime)) {
$resump_node->setAttribute("expirationDate", $expirationdatetime);
}
$r... | [
"public",
"function",
"create_resumpToken",
"(",
"$",
"token",
",",
"$",
"expirationdatetime",
",",
"$",
"num_rows",
",",
"$",
"cursor",
"=",
"null",
")",
"{",
"$",
"resump_node",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"verbNode",
",... | If there are too many records request could not finished a resumpToken is generated to let harvester know
\param $token Type: string. A random number created somewhere?
\param $expirationdatetime Type: string. A string representing time.
\param $num_rows Type: integer. Number of records retrieved.
\param $cursor Type:... | [
"If",
"there",
"are",
"too",
"many",
"records",
"request",
"could",
"not",
"finished",
"a",
"resumpToken",
"is",
"generated",
"to",
"let",
"harvester",
"know"
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/xml_creater.php#L397-L405 |
uniondrug/http | src/ServerRequest.php | ServerRequest.createServerRequestFromGlobals | public static function createServerRequestFromGlobals()
{
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$headers = function_exists('getallheaders') ? getallheaders() : [];
return new static($method, static::createUriFromGlobal($_SERVER), $headers, new Php... | php | public static function createServerRequestFromGlobals()
{
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$headers = function_exists('getallheaders') ? getallheaders() : [];
return new static($method, static::createUriFromGlobal($_SERVER), $headers, new Php... | [
"public",
"static",
"function",
"createServerRequestFromGlobals",
"(",
")",
"{",
"$",
"method",
"=",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
"?",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
":",
"'GET'",
";",
"$",
"headers",
"=",
... | Create a new server request from PHP globals.
@return ServerRequestInterface | [
"Create",
"a",
"new",
"server",
"request",
"from",
"PHP",
"globals",
"."
] | train | https://github.com/uniondrug/http/blob/d650af25bd4587499befa76081a8fe8275431320/src/ServerRequest.php#L534-L540 |
SporkCode/Spork | src/Mvc/Listener/AccessDeniedStrategy.php | AccessDeniedStrategy.attach | public function attach(EventManagerInterface $events)
{
$sharedEvents = $events->getSharedManager();
// check for 403 at beginning of route and dispatch events
$this->listeners[] = $events->attach(
array(MvcEvent::EVENT_ROUTE, MvcEvent::EVENT_DISPATCH),
array... | php | public function attach(EventManagerInterface $events)
{
$sharedEvents = $events->getSharedManager();
// check for 403 at beginning of route and dispatch events
$this->listeners[] = $events->attach(
array(MvcEvent::EVENT_ROUTE, MvcEvent::EVENT_DISPATCH),
array... | [
"public",
"function",
"attach",
"(",
"EventManagerInterface",
"$",
"events",
")",
"{",
"$",
"sharedEvents",
"=",
"$",
"events",
"->",
"getSharedManager",
"(",
")",
";",
"// check for 403 at beginning of route and dispatch events",
"$",
"this",
"->",
"listeners",
"[",
... | Attach event
@see \Zend\EventManager\ListenerAggregateInterface::attach()
@param EventManagerInterface $events | [
"Attach",
"event"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/AccessDeniedStrategy.php#L60-L82 |
SporkCode/Spork | src/Mvc/Listener/AccessDeniedStrategy.php | AccessDeniedStrategy.detectAccessDenied | public function detectAccessDenied(MvcEvent $event)
{
$response = $event->getResponse();
if ($response->getStatusCode() == 403) {
$event->setError('Access Denied');
$event->stopPropagation(true);
}
} | php | public function detectAccessDenied(MvcEvent $event)
{
$response = $event->getResponse();
if ($response->getStatusCode() == 403) {
$event->setError('Access Denied');
$event->stopPropagation(true);
}
} | [
"public",
"function",
"detectAccessDenied",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
"==",
"403",
")",
"{",
"$",
"event... | If response status code is 403 set error state and stop event propagation
@param MvcEvent $event | [
"If",
"response",
"status",
"code",
"is",
"403",
"set",
"error",
"state",
"and",
"stop",
"event",
"propagation"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/AccessDeniedStrategy.php#L133-L140 |
SporkCode/Spork | src/Mvc/Listener/AccessDeniedStrategy.php | AccessDeniedStrategy.injectAccessDeniedViewModel | public function injectAccessDeniedViewModel(MvcEvent $event)
{
$this->config($event);
$result = $event->getResult();
if ($result instanceof ResponseInterface) {
return;
}
$response = $event->getResponse();
if ($response-... | php | public function injectAccessDeniedViewModel(MvcEvent $event)
{
$this->config($event);
$result = $event->getResult();
if ($result instanceof ResponseInterface) {
return;
}
$response = $event->getResponse();
if ($response-... | [
"public",
"function",
"injectAccessDeniedViewModel",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"config",
"(",
"$",
"event",
")",
";",
"$",
"result",
"=",
"$",
"event",
"->",
"getResult",
"(",
")",
";",
"if",
"(",
"$",
"result",
"insta... | Inject access denied View Model is response status is 403
@param MvcEvent $event | [
"Inject",
"access",
"denied",
"View",
"Model",
"is",
"response",
"status",
"is",
"403"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/AccessDeniedStrategy.php#L147-L173 |
SporkCode/Spork | src/Mvc/Listener/AccessDeniedStrategy.php | AccessDeniedStrategy.config | protected function config(MvcEvent $event)
{
$appConfig = $event->getApplication()->getServiceManager()->get('config');
$config = array_key_exists(self::CONFIG_KEY, $appConfig) ? $appConfig[self::CONFIG_KEY] : array();
if (array_key_exists('template', $config)) {
$this->... | php | protected function config(MvcEvent $event)
{
$appConfig = $event->getApplication()->getServiceManager()->get('config');
$config = array_key_exists(self::CONFIG_KEY, $appConfig) ? $appConfig[self::CONFIG_KEY] : array();
if (array_key_exists('template', $config)) {
$this->... | [
"protected",
"function",
"config",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"appConfig",
"=",
"$",
"event",
"->",
"getApplication",
"(",
")",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"'config'",
")",
";",
"$",
"config",
"=",
"array_key... | Set configuration options from application configuration
@param MvcEvent $event | [
"Set",
"configuration",
"options",
"from",
"application",
"configuration"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/AccessDeniedStrategy.php#L180-L192 |
shabbyrobe/amiss | src/Functions.php | Functions.keyValue | public static function keyValue($list, $keyProperty=null, $valueProperty=null)
{
$index = array();
foreach ($list as $i) {
if ($keyProperty) {
if (!$valueProperty) {
throw new \InvalidArgumentException("Must set value property if setting key property"... | php | public static function keyValue($list, $keyProperty=null, $valueProperty=null)
{
$index = array();
foreach ($list as $i) {
if ($keyProperty) {
if (!$valueProperty) {
throw new \InvalidArgumentException("Must set value property if setting key property"... | [
"public",
"static",
"function",
"keyValue",
"(",
"$",
"list",
",",
"$",
"keyProperty",
"=",
"null",
",",
"$",
"valueProperty",
"=",
"null",
")",
"{",
"$",
"index",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"i",
")",
"{",
... | Create a one-dimensional associative array from a list of objects, or a list of 2-tuples.
@param object[]|array $list
@param string $keyProperty
@param string $valueProperty
@return array | [
"Create",
"a",
"one",
"-",
"dimensional",
"associative",
"array",
"from",
"a",
"list",
"of",
"objects",
"or",
"a",
"list",
"of",
"2",
"-",
"tuples",
"."
] | train | https://github.com/shabbyrobe/amiss/blob/ba261f0d1f985ed36e9fd2903ac0df86c5b9498d/src/Functions.php#L14-L32 |
nabab/bbn | src/bbn/user/session.php | session._get_value | private function _get_value($args){
if ( $this->id ){
$var =& $this->data;
foreach ( $args as $a ){
if ( !isset($var[$a]) ){
return null;
}
$var =& $var[$a];
}
return $var;
}
} | php | private function _get_value($args){
if ( $this->id ){
$var =& $this->data;
foreach ( $args as $a ){
if ( !isset($var[$a]) ){
return null;
}
$var =& $var[$a];
}
return $var;
}
} | [
"private",
"function",
"_get_value",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"{",
"$",
"var",
"=",
"&",
"$",
"this",
"->",
"data",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"a",
")",
"{",
"if",
"(",
"!",
"isset... | Gets a reference to the part of the data corresponding to an array of indexes
```php
$this->_get_value(['index1', 'index2'])
// Will return the content of $this->data['index1']['index2']
```
@param $args
@return null | [
"Gets",
"a",
"reference",
"to",
"the",
"part",
"of",
"the",
"data",
"corresponding",
"to",
"an",
"array",
"of",
"indexes"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/session.php#L54-L65 |
hametuha/wpametu | src/WPametu/File/Path.php | Path.remove_dir | private function remove_dir($path){
if( is_dir($path) ){
foreach( scandir($path) as $file ){
if( $file != '.' && $file != '..' ){
if( is_dir("{$path}/{$file}") ){
$this->remove_dir("{$path}/{$file}");
}else{
... | php | private function remove_dir($path){
if( is_dir($path) ){
foreach( scandir($path) as $file ){
if( $file != '.' && $file != '..' ){
if( is_dir("{$path}/{$file}") ){
$this->remove_dir("{$path}/{$file}");
}else{
... | [
"private",
"function",
"remove_dir",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"foreach",
"(",
"scandir",
"(",
"$",
"path",
")",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"!=",
"'.'",
"&&",
"$"... | Remove directory recursively
@param string $path | [
"Remove",
"directory",
"recursively"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Path.php#L90-L103 |
zicht/z | src/Zicht/Tool/Container/Declaration.php | Declaration.compileBody | protected function compileBody(Buffer $buffer)
{
$buffer->write('return ');
$this->expr->compile($buffer);
$buffer->raw(';');
} | php | protected function compileBody(Buffer $buffer)
{
$buffer->write('return ');
$this->expr->compile($buffer);
$buffer->raw(';');
} | [
"protected",
"function",
"compileBody",
"(",
"Buffer",
"$",
"buffer",
")",
"{",
"$",
"buffer",
"->",
"write",
"(",
"'return '",
")",
";",
"$",
"this",
"->",
"expr",
"->",
"compile",
"(",
"$",
"buffer",
")",
";",
"$",
"buffer",
"->",
"raw",
"(",
"';'"... | Compiles the definition body
@param \Zicht\Tool\Script\Buffer $buffer
@return void | [
"Compiles",
"the",
"definition",
"body"
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/Declaration.php#L53-L58 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.useEncryption | public function useEncryption($key)
{
$this->encryptor = new \sb\Encryption\ForTransmission($key);
$this->encryption_key = $key;
//decrypt cookies if sent
foreach (\sb\Gateway::$cookie as $k => $v) {
\sb\Gateway::$cookie[$k] = $this->encryptor->decrypt($v);
}
... | php | public function useEncryption($key)
{
$this->encryptor = new \sb\Encryption\ForTransmission($key);
$this->encryption_key = $key;
//decrypt cookies if sent
foreach (\sb\Gateway::$cookie as $k => $v) {
\sb\Gateway::$cookie[$k] = $this->encryptor->decrypt($v);
}
... | [
"public",
"function",
"useEncryption",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"encryptor",
"=",
"new",
"\\",
"sb",
"\\",
"Encryption",
"\\",
"ForTransmission",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"encryption_key",
"=",
"$",
"key",
";",... | Sets the key that data is encrypted with and turns on encryption,
the client must use the same key
@param $key String | [
"Sets",
"the",
"key",
"that",
"data",
"is",
"encrypted",
"with",
"and",
"turns",
"on",
"encryption",
"the",
"client",
"must",
"use",
"the",
"same",
"key"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L86-L95 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.getMethods | public function getMethods($html = true)
{
$arr = Array();
foreach($this->served_classes as $class){
foreach (\get_class_methods($class) as $method) {
$reflect = new \ReflectionMethod($class, $method);
if ($reflect) {
... | php | public function getMethods($html = true)
{
$arr = Array();
foreach($this->served_classes as $class){
foreach (\get_class_methods($class) as $method) {
$reflect = new \ReflectionMethod($class, $method);
if ($reflect) {
... | [
"public",
"function",
"getMethods",
"(",
"$",
"html",
"=",
"true",
")",
"{",
"$",
"arr",
"=",
"Array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"served_classes",
"as",
"$",
"class",
")",
"{",
"foreach",
"(",
"\\",
"get_class_methods",
"(",
"... | Get the methods available for this \sb\JSON\RPC2_Server instance
@return Array - Object once json_encoded
@servable true | [
"Get",
"the",
"methods",
"available",
"for",
"this",
"\\",
"sb",
"\\",
"JSON",
"\\",
"RPC2_Server",
"instance"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L102-L149 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.getPhpdoc | protected function getPhpdoc($method)
{
$reflect = false;
foreach($this->served_classes as $class){
if (\method_exists($class, $method)) {
$reflect = new \ReflectionMethod($class, $method);
break;
}
}
... | php | protected function getPhpdoc($method)
{
$reflect = false;
foreach($this->served_classes as $class){
if (\method_exists($class, $method)) {
$reflect = new \ReflectionMethod($class, $method);
break;
}
}
... | [
"protected",
"function",
"getPhpdoc",
"(",
"$",
"method",
")",
"{",
"$",
"reflect",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"served_classes",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"\\",
"method_exists",
"(",
"$",
"class",
",",
"$",
"... | Get php doc and return_type for method by name
@param string $name The name of the method to grab the docs for
@return Object with return_type and phpdoc property | [
"Get",
"php",
"doc",
"and",
"return_type",
"for",
"method",
"by",
"name"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L156-L187 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.methodsToHtml | protected function methodsToHtml($methods)
{
$html = '<style type="text/css">
li{background-color:#c8c8d4;}
h1{
font-size:1.0em;
padding:3px 0 3px 10px;
color:white;
background-color:#8181bd;
}
pre{
... | php | protected function methodsToHtml($methods)
{
$html = '<style type="text/css">
li{background-color:#c8c8d4;}
h1{
font-size:1.0em;
padding:3px 0 3px 10px;
color:white;
background-color:#8181bd;
}
pre{
... | [
"protected",
"function",
"methodsToHtml",
"(",
"$",
"methods",
")",
"{",
"$",
"html",
"=",
"'<style type=\"text/css\">\n li{background-color:#c8c8d4;}\n\n h1{\n font-size:1.0em;\n padding:3px 0 3px 10px;\n color:white;\n backgro... | Coverts the methods served into an HTML string
@param $arr
@return string HTML | [
"Coverts",
"the",
"methods",
"served",
"into",
"an",
"HTML",
"string"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L194-L221 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.getResponse | protected function getResponse($json_request_str = '')
{
$response = new \sb\JSON\RPC2\Response();
$request = null;
if (empty($json_request_str)) {
if (isset(\sb\Gateway::$cmd_options) && isset(\sb\Gateway::$cmd_options['json_request'])) {
$json_request_str = ... | php | protected function getResponse($json_request_str = '')
{
$response = new \sb\JSON\RPC2\Response();
$request = null;
if (empty($json_request_str)) {
if (isset(\sb\Gateway::$cmd_options) && isset(\sb\Gateway::$cmd_options['json_request'])) {
$json_request_str = ... | [
"protected",
"function",
"getResponse",
"(",
"$",
"json_request_str",
"=",
"''",
")",
"{",
"$",
"response",
"=",
"new",
"\\",
"sb",
"\\",
"JSON",
"\\",
"RPC2",
"\\",
"Response",
"(",
")",
";",
"$",
"request",
"=",
"null",
";",
"if",
"(",
"empty",
"("... | Parses the request
@param $json_request_str | [
"Parses",
"the",
"request"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L243-L367 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.render | public function render()
{
$args = \func_get_args();
$json_request_str = isset($args[0]) ? $args[0] : '';
if ($this->onBeforeRender() !== false) {
$response = $this->getResponse($json_request_str);
$message = 'OK';
$status = 200;
//headers ... | php | public function render()
{
$args = \func_get_args();
$json_request_str = isset($args[0]) ? $args[0] : '';
if ($this->onBeforeRender() !== false) {
$response = $this->getResponse($json_request_str);
$message = 'OK';
$status = 200;
//headers ... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"$",
"json_request_str",
"=",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
"?",
"$",
"args",
"[",
"0",
"]",
":",
"''",
";",
"if",
"(",
"$",... | Serves data based on the json_request if set, otherwise based on
\sb\Gateway::$cmd_options['json_request']
Had to remove default args being listed to prevent
"should be compatible with that of" when using autoload,
kept them in phpdoc to make it known which exist
@param $json_request_str String This optional argument ... | [
"Serves",
"data",
"based",
"on",
"the",
"json_request",
"if",
"set",
"otherwise",
"based",
"on",
"\\",
"sb",
"\\",
"Gateway",
"::",
"$cmd_options",
"[",
"json_request",
"]",
"Had",
"to",
"remove",
"default",
"args",
"being",
"listed",
"to",
"prevent",
"shoul... | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L381-L437 |
surebert/surebert-framework | src/sb/Controller/JSON/RPC2/Server.php | Server.notFound | public function notFound()
{
if (isset($this->request->path_array[1])) {
switch ($this->request->path_array[1]) {
case 'methods':
return $this->getMethods(true);
break;
}
}
return null;
} | php | public function notFound()
{
if (isset($this->request->path_array[1])) {
switch ($this->request->path_array[1]) {
case 'methods':
return $this->getMethods(true);
break;
}
}
return null;
} | [
"public",
"function",
"notFound",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"request",
"->",
"path_array",
"[",
"1",
"]",
")",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"request",
"->",
"path_array",
"[",
"1",
"]",
")",
"{",
"c... | If this returns null when method not found, then deault JSON error object
is returned. Otherwise, the string or object returned from notFound is returned.
Will also server get_methods/methods as HTML list of available calls
@return type | [
"If",
"this",
"returns",
"null",
"when",
"method",
"not",
"found",
"then",
"deault",
"JSON",
"error",
"object",
"is",
"returned",
".",
"Otherwise",
"the",
"string",
"or",
"object",
"returned",
"from",
"notFound",
"is",
"returned",
".",
"Will",
"also",
"serve... | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/JSON/RPC2/Server.php#L445-L456 |
primipilus/fileinfo | src/BaseInfo.php | BaseInfo.init | private function init(string $path)
{
$this->_path = $path;
if (!file_exists($this->_path)) {
throw new FileNotExistsException('file ' . $this->_path . ' not exists');
}
$type = FileTool::type($this->_path);
if ('file' !== $type) {
throw new NotFileE... | php | private function init(string $path)
{
$this->_path = $path;
if (!file_exists($this->_path)) {
throw new FileNotExistsException('file ' . $this->_path . ' not exists');
}
$type = FileTool::type($this->_path);
if ('file' !== $type) {
throw new NotFileE... | [
"private",
"function",
"init",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"_path",
"=",
"$",
"path",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"_path",
")",
")",
"{",
"throw",
"new",
"FileNotExistsException",
"(",
"'fi... | @param string $path
@throws FileNotExistsException
@throws NotFileException | [
"@param",
"string",
"$path"
] | train | https://github.com/primipilus/fileinfo/blob/734fd25b3dfd3b0706f9ef07499663578c0fa56e/src/BaseInfo.php#L49-L61 |
ClementIV/yii-rest-rbac2.0 | controllers/AssignmentController.php | AssignmentController.actionIndex | public function actionIndex()
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['index']);
}
try{
if ($this->searchClass === null) {
$searchModel = new AssignmentSearch;
... | php | public function actionIndex()
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['index']);
}
try{
if ($this->searchClass === null) {
$searchModel = new AssignmentSearch;
... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"request",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
";",
"if",
"(",
"$",
"request",
"->",
"getIsOptions",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"ResponseOptions",
"(",
"$... | Lists all Assignment models.
@return mixed | [
"Lists",
"all",
"Assignment",
"models",
"."
] | train | https://github.com/ClementIV/yii-rest-rbac2.0/blob/435ffceca8d51b4d369182db3a06c20f336e9ac4/controllers/AssignmentController.php#L66-L89 |
ClementIV/yii-rest-rbac2.0 | controllers/AssignmentController.php | AssignmentController.actionAssign | public function actionAssign($id)
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['assign']);
}
try{
$items = Yii::$app->getRequest()->post('items', []);
$model = new Assignment($id);
... | php | public function actionAssign($id)
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['assign']);
}
try{
$items = Yii::$app->getRequest()->post('items', []);
$model = new Assignment($id);
... | [
"public",
"function",
"actionAssign",
"(",
"$",
"id",
")",
"{",
"$",
"request",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
";",
"if",
"(",
"$",
"request",
"->",
"getIsOptions",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"ResponseOptio... | Assign items
@param string $id
@return array | [
"Assign",
"items"
] | train | https://github.com/ClementIV/yii-rest-rbac2.0/blob/435ffceca8d51b4d369182db3a06c20f336e9ac4/controllers/AssignmentController.php#L140-L156 |
ShaoZeMing/laravel-merchant | src/Controllers/MenuController.php | MenuController.form | public function form()
{
return Menu::form(function (Form $form) {
$form->display('id', 'ID');
$form->select('parent_id', trans('merchant.parent_id'))->options(Menu::selectOptions());
$form->text('title', trans('merchant.title'))->rules('required');
$form->ic... | php | public function form()
{
return Menu::form(function (Form $form) {
$form->display('id', 'ID');
$form->select('parent_id', trans('merchant.parent_id'))->options(Menu::selectOptions());
$form->text('title', trans('merchant.title'))->rules('required');
$form->ic... | [
"public",
"function",
"form",
"(",
")",
"{",
"return",
"Menu",
"::",
"form",
"(",
"function",
"(",
"Form",
"$",
"form",
")",
"{",
"$",
"form",
"->",
"display",
"(",
"'id'",
",",
"'ID'",
")",
";",
"$",
"form",
"->",
"select",
"(",
"'parent_id'",
","... | Make a form builder.
@return Form | [
"Make",
"a",
"form",
"builder",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Controllers/MenuController.php#L110-L124 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.type2format | private function type2format( $type ) {
if ( ! isset( self::$_type2format[ $type ] ) ) {
$format = '%s';
switch ( true ) {
case stristr( $type, 'INT' ) !== false:
$format = '%d';
break;
case stristr( $type, 'BIT' ) !== false:
$format = '%d';
break;
case stristr( $type, 'BOOLEAN' ... | php | private function type2format( $type ) {
if ( ! isset( self::$_type2format[ $type ] ) ) {
$format = '%s';
switch ( true ) {
case stristr( $type, 'INT' ) !== false:
$format = '%d';
break;
case stristr( $type, 'BIT' ) !== false:
$format = '%d';
break;
case stristr( $type, 'BOOLEAN' ... | [
"private",
"function",
"type2format",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_type2format",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"format",
"=",
"'%s'",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"st... | @since 2.0.0 Added: Feature to cache result of conversion type format
@param string $type
@return string | [
"@since",
"2",
".",
"0",
".",
"0",
"Added",
":",
"Feature",
"to",
"cache",
"result",
"of",
"conversion",
"type",
"format"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L78-L108 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.load_table_defines | private function load_table_defines() {
if ( ! $this->need_to_update() ) {
$cache = $this->app->get_option( 'table_defines_cache' );
if ( is_array( $cache ) ) {
$this->table_defines = $cache;
return;
}
}
$this->table_defines = $this->app->config->load( 'db' );
empty( $this->table_defines ) an... | php | private function load_table_defines() {
if ( ! $this->need_to_update() ) {
$cache = $this->app->get_option( 'table_defines_cache' );
if ( is_array( $cache ) ) {
$this->table_defines = $cache;
return;
}
}
$this->table_defines = $this->app->config->load( 'db' );
empty( $this->table_defines ) an... | [
"private",
"function",
"load_table_defines",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"need_to_update",
"(",
")",
")",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"app",
"->",
"get_option",
"(",
"'table_defines_cache'",
")",
";",
"if",
"(",
"is... | load | [
"load"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L113-L139 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.setup_table_columns | protected function setup_table_columns( $table, $define ) {
if ( empty( $define['columns'] ) ) {
return [ false, false ];
}
$id = $table . '_id';
if ( ! empty( $define['id'] ) ) {
$id = $define['id'];
}
$columns = [];
$columns['id'] = [
'name' => $id,
'type' => 'bigint(20)',
... | php | protected function setup_table_columns( $table, $define ) {
if ( empty( $define['columns'] ) ) {
return [ false, false ];
}
$id = $table . '_id';
if ( ! empty( $define['id'] ) ) {
$id = $define['id'];
}
$columns = [];
$columns['id'] = [
'name' => $id,
'type' => 'bigint(20)',
... | [
"protected",
"function",
"setup_table_columns",
"(",
"$",
"table",
",",
"$",
"define",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"define",
"[",
"'columns'",
"]",
")",
")",
"{",
"return",
"[",
"false",
",",
"false",
"]",
";",
"}",
"$",
"id",
"=",
"$",... | @param string $table
@param array $define
@return array | [
"@param",
"string",
"$table",
"@param",
"array",
"$define"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L223-L315 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.get_table | public function get_table( $table ) {
if (
! isset( $this->table_defines[ $table ] ) ||
! empty( $this->table_defines[ $table ]['wordpress'] ) ||
! empty( $this->table_defines[ $table ]['global'] )
) {
return $table;
}
return $this->get_table_prefix() . $table;
} | php | public function get_table( $table ) {
if (
! isset( $this->table_defines[ $table ] ) ||
! empty( $this->table_defines[ $table ]['wordpress'] ) ||
! empty( $this->table_defines[ $table ]['global'] )
) {
return $table;
}
return $this->get_table_prefix() . $table;
} | [
"public",
"function",
"get_table",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
"[",... | @param $table
@return string | [
"@param",
"$table"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L331-L341 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.get_field | public function get_field( $table, $key ) {
return $this->app->utility->array_get( $this->app->utility->array_get( $this->get_columns( $table ), $key, [] ), 'name', $key );
} | php | public function get_field( $table, $key ) {
return $this->app->utility->array_get( $this->app->utility->array_get( $this->get_columns( $table ), $key, [] ), 'name', $key );
} | [
"public",
"function",
"get_field",
"(",
"$",
"table",
",",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"->",
"utility",
"->",
"array_get",
"(",
"$",
"this",
"->",
"app",
"->",
"utility",
"->",
"array_get",
"(",
"$",
"this",
"->",
"get_c... | @param string $table
@param string $key
@return string | [
"@param",
"string",
"$table",
"@param",
"string",
"$key"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L349-L351 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.db_update | private function db_update() {
if ( ! $this->need_to_update() ) {
return;
}
$this->update_db_version();
if ( empty( $this->table_defines ) ) {
return;
}
set_time_limit( 60 * 5 );
foreach ( $this->table_defines as $table => $define ) {
$results = $this->table_update( $table, $define );
if ( ... | php | private function db_update() {
if ( ! $this->need_to_update() ) {
return;
}
$this->update_db_version();
if ( empty( $this->table_defines ) ) {
return;
}
set_time_limit( 60 * 5 );
foreach ( $this->table_defines as $table => $define ) {
$results = $this->table_update( $table, $define );
if ( ... | [
"private",
"function",
"db_update",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"need_to_update",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"update_db_version",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"tabl... | db update | [
"db",
"update"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L369-L394 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.table_update | protected function table_update( $table, $define ) {
require_once ABSPATH . "wp-admin" . DS . "includes" . DS . "upgrade.php";
$char = $this->app->utility->definedv( 'DB_CHARSET', 'utf8' );
if ( empty( $define['id'] ) ) {
$define['id'] = $table . '_id';
}
$table = $this->get_table( $table );
$sql = "C... | php | protected function table_update( $table, $define ) {
require_once ABSPATH . "wp-admin" . DS . "includes" . DS . "upgrade.php";
$char = $this->app->utility->definedv( 'DB_CHARSET', 'utf8' );
if ( empty( $define['id'] ) ) {
$define['id'] = $table . '_id';
}
$table = $this->get_table( $table );
$sql = "C... | [
"protected",
"function",
"table_update",
"(",
"$",
"table",
",",
"$",
"define",
")",
"{",
"require_once",
"ABSPATH",
".",
"\"wp-admin\"",
".",
"DS",
".",
"\"includes\"",
".",
"DS",
".",
"\"upgrade.php\"",
";",
"$",
"char",
"=",
"$",
"this",
"->",
"app",
... | @param string $table
@param array $define
@return array | [
"@param",
"string",
"$table",
"@param",
"array",
"$define"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L402-L470 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.is_logical | private function is_logical( $define ) {
return $this->apply_filters( 'is_logical', 'physical' !== $this->app->utility->array_get( $define, 'delete', $this->app->get_config( 'config', 'default_delete_rule' ) ), $define );
} | php | private function is_logical( $define ) {
return $this->apply_filters( 'is_logical', 'physical' !== $this->app->utility->array_get( $define, 'delete', $this->app->get_config( 'config', 'default_delete_rule' ) ), $define );
} | [
"private",
"function",
"is_logical",
"(",
"$",
"define",
")",
"{",
"return",
"$",
"this",
"->",
"apply_filters",
"(",
"'is_logical'",
",",
"'physical'",
"!==",
"$",
"this",
"->",
"app",
"->",
"utility",
"->",
"array_get",
"(",
"$",
"define",
",",
"'delete'... | @param array $define
@return bool | [
"@param",
"array",
"$define"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L509-L511 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.filter | private function filter( $data, $columns ) {
$_format = [];
$_data = [];
$_columns = $columns;
foreach ( $data as $k => $v ) {
$columns = $_columns;
list( $name, $columns ) = $this->get_field_data( $k, $columns );
if ( isset( $columns[ $k ] ) ) {
$_format[] = $columns[ $k ]['format'];
} else... | php | private function filter( $data, $columns ) {
$_format = [];
$_data = [];
$_columns = $columns;
foreach ( $data as $k => $v ) {
$columns = $_columns;
list( $name, $columns ) = $this->get_field_data( $k, $columns );
if ( isset( $columns[ $k ] ) ) {
$_format[] = $columns[ $k ]['format'];
} else... | [
"private",
"function",
"filter",
"(",
"$",
"data",
",",
"$",
"columns",
")",
"{",
"$",
"_format",
"=",
"[",
"]",
";",
"$",
"_data",
"=",
"[",
"]",
";",
"$",
"_columns",
"=",
"$",
"columns",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"k",
"=>"... | @param $data
@param $columns
@return array | [
"@param",
"$data",
"@param",
"$columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L519-L535 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.get_field_data | private function get_field_data( $k, $columns ) {
$table = null;
if ( strpos( $k, '.' ) !== false && strpos( $k, '(' ) === false ) {
$exploded = explode( '.', $k );
$table = trim( $exploded[0], '`' );
$k = trim( $exploded[1], '`' );
if ( isset( $this->table_defines[ $table ]['columns'][ $k ] )... | php | private function get_field_data( $k, $columns ) {
$table = null;
if ( strpos( $k, '.' ) !== false && strpos( $k, '(' ) === false ) {
$exploded = explode( '.', $k );
$table = trim( $exploded[0], '`' );
$k = trim( $exploded[1], '`' );
if ( isset( $this->table_defines[ $table ]['columns'][ $k ] )... | [
"private",
"function",
"get_field_data",
"(",
"$",
"k",
",",
"$",
"columns",
")",
"{",
"$",
"table",
"=",
"null",
";",
"if",
"(",
"strpos",
"(",
"$",
"k",
",",
"'.'",
")",
"!==",
"false",
"&&",
"strpos",
"(",
"$",
"k",
",",
"'('",
")",
"===",
"... | @param string $k
@param array|null $columns
@return array | [
"@param",
"string",
"$k",
"@param",
"array|null",
"$columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L543-L572 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.set_update_params | private function set_update_params( $data, $create, $update, $delete ) {
$now = $this->apply_filters( 'set_update_params_date', date_i18n( 'Y-m-d H:i:s' ), $data, $create, $update, $delete );
$user = $this->apply_filters( 'set_update_params_user', substr( $this->app->user->user_name, 0, 32 ), $data, $create, $upda... | php | private function set_update_params( $data, $create, $update, $delete ) {
$now = $this->apply_filters( 'set_update_params_date', date_i18n( 'Y-m-d H:i:s' ), $data, $create, $update, $delete );
$user = $this->apply_filters( 'set_update_params_user', substr( $this->app->user->user_name, 0, 32 ), $data, $create, $upda... | [
"private",
"function",
"set_update_params",
"(",
"$",
"data",
",",
"$",
"create",
",",
"$",
"update",
",",
"$",
"delete",
")",
"{",
"$",
"now",
"=",
"$",
"this",
"->",
"apply_filters",
"(",
"'set_update_params_date'",
",",
"date_i18n",
"(",
"'Y-m-d H:i:s'",
... | @since 2.0.0 Changed: return $data
@since 2.9.14 Fixed: prevent cache
@param array $data
@param bool $create
@param bool $update
@param bool $delete
@return array | [
"@since",
"2",
".",
"0",
".",
"0",
"Changed",
":",
"return",
"$data",
"@since",
"2",
".",
"9",
".",
"14",
"Fixed",
":",
"prevent",
"cache"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L595-L613 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.build_fields | private function build_fields( $fields, $columns ) {
if ( ! isset( $fields ) ) {
$fields = [ '*' ];
}
if ( is_string( $fields ) ) {
$fields = [ $fields ];
}
if ( ! empty( $fields ) ) {
foreach ( $fields as $k => $option ) {
$key = $k;
if ( is_int( $key ) ) {
$key = $option;
$opti... | php | private function build_fields( $fields, $columns ) {
if ( ! isset( $fields ) ) {
$fields = [ '*' ];
}
if ( is_string( $fields ) ) {
$fields = [ $fields ];
}
if ( ! empty( $fields ) ) {
foreach ( $fields as $k => $option ) {
$key = $k;
if ( is_int( $key ) ) {
$key = $option;
$opti... | [
"private",
"function",
"build_fields",
"(",
"$",
"fields",
",",
"$",
"columns",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"[",
"'*'",
"]",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"fields",
")",
... | @param null|array|string $fields
@param array $columns
@return array | [
"@param",
"null|array|string",
"$fields",
"@param",
"array",
"$columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L621-L689 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.build_conditions | private function build_conditions( $where, $columns, $glue = 'AND' ) {
list ( $_where, $_where_format ) = $this->filter( $where, $columns );
$conditions = $values = [];
$index = 0;
foreach ( $_where as $field => $value ) {
$field = trim( $field );
$format = $_where_format[ $index ++ ];
if ( is_nu... | php | private function build_conditions( $where, $columns, $glue = 'AND' ) {
list ( $_where, $_where_format ) = $this->filter( $where, $columns );
$conditions = $values = [];
$index = 0;
foreach ( $_where as $field => $value ) {
$field = trim( $field );
$format = $_where_format[ $index ++ ];
if ( is_nu... | [
"private",
"function",
"build_conditions",
"(",
"$",
"where",
",",
"$",
"columns",
",",
"$",
"glue",
"=",
"'AND'",
")",
"{",
"list",
"(",
"$",
"_where",
",",
"$",
"_where_format",
")",
"=",
"$",
"this",
"->",
"filter",
"(",
"$",
"where",
",",
"$",
... | @param array $where
@param array $columns
@param string $glue
@return array | [
"@param",
"array",
"$where",
"@param",
"array",
"$columns",
"@param",
"string",
"$glue"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L698-L776 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.build_group_by | private function build_group_by( $group_by, $columns ) {
$sql = '';
if ( ! empty( $group_by ) ) {
$items = [];
foreach ( $group_by as $k ) {
$items[] = $this->get_field_name( $k, $columns );
}
if ( ! empty( $items ) ) {
$sql .= ' GROUP BY ' . implode( ', ', $items );
}
}
return $sql;
} | php | private function build_group_by( $group_by, $columns ) {
$sql = '';
if ( ! empty( $group_by ) ) {
$items = [];
foreach ( $group_by as $k ) {
$items[] = $this->get_field_name( $k, $columns );
}
if ( ! empty( $items ) ) {
$sql .= ' GROUP BY ' . implode( ', ', $items );
}
}
return $sql;
} | [
"private",
"function",
"build_group_by",
"(",
"$",
"group_by",
",",
"$",
"columns",
")",
"{",
"$",
"sql",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"group_by",
")",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"group_... | @param null|array $group_by
@param array $columns
@return string | [
"@param",
"null|array",
"$group_by",
"@param",
"array",
"$columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L784-L797 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.build_order_by | private function build_order_by( $order_by, $columns ) {
$sql = '';
if ( ! empty( $order_by ) ) {
$items = [];
foreach ( $order_by as $k => $order ) {
if ( is_int( $k ) ) {
$k = $order;
$order = 'ASC';
} else {
$order = trim( strtoupper( $order ) );
}
if ( $order !== 'DESC' ... | php | private function build_order_by( $order_by, $columns ) {
$sql = '';
if ( ! empty( $order_by ) ) {
$items = [];
foreach ( $order_by as $k => $order ) {
if ( is_int( $k ) ) {
$k = $order;
$order = 'ASC';
} else {
$order = trim( strtoupper( $order ) );
}
if ( $order !== 'DESC' ... | [
"private",
"function",
"build_order_by",
"(",
"$",
"order_by",
",",
"$",
"columns",
")",
"{",
"$",
"sql",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"order_by",
")",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"order_... | @param null|array $order_by
@param array $columns
@return string | [
"@param",
"null|array",
"$order_by",
"@param",
"array",
"$columns"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L805-L828 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.build_join | private function build_join( $join ) {
$sql = '';
if ( ! empty( $join ) ) {
$items = [];
foreach ( $join as $data ) {
if ( ! is_array( $data ) || count( $data ) < 3 ) {
continue;
}
$table = $data[0];
$rule = $data[1];
$rule = strtoupper( $rule );
if ( ! in_array( $rule, [
'... | php | private function build_join( $join ) {
$sql = '';
if ( ! empty( $join ) ) {
$items = [];
foreach ( $join as $data ) {
if ( ! is_array( $data ) || count( $data ) < 3 ) {
continue;
}
$table = $data[0];
$rule = $data[1];
$rule = strtoupper( $rule );
if ( ! in_array( $rule, [
'... | [
"private",
"function",
"build_join",
"(",
"$",
"join",
")",
"{",
"$",
"sql",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"join",
")",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"join",
"as",
"$",
"data",
")",
"{",... | @param null|array $join
@return string | [
"@param",
"null|array",
"$join"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L835-L888 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.build_limit | private function build_limit( $limit, $offset ) {
$sql = '';
if ( isset( $limit ) && $limit > 0 ) {
if ( isset( $offset ) && $offset > 0 ) {
$sql .= " LIMIT {$offset}, {$limit}";
} else {
$sql .= " LIMIT {$limit}";
}
}
return $sql;
} | php | private function build_limit( $limit, $offset ) {
$sql = '';
if ( isset( $limit ) && $limit > 0 ) {
if ( isset( $offset ) && $offset > 0 ) {
$sql .= " LIMIT {$offset}, {$limit}";
} else {
$sql .= " LIMIT {$limit}";
}
}
return $sql;
} | [
"private",
"function",
"build_limit",
"(",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"$",
"sql",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"limit",
")",
"&&",
"$",
"limit",
">",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"offset",
")",
... | @param null|int $limit
@param null|int $offset
@return string | [
"@param",
"null|int",
"$limit",
"@param",
"null|int",
"$offset"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L896-L907 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.get_select_sql | public function get_select_sql( $tables, $where = null, $fields = null, $limit = null, $offset = null, $order_by = null, $group_by = null, $for_update = false ) {
$as = null;
if ( is_array( $tables ) ) {
if ( empty( $tables ) ) {
return false;
}
$table = array_shift( $tables );
$join = $tables;
... | php | public function get_select_sql( $tables, $where = null, $fields = null, $limit = null, $offset = null, $order_by = null, $group_by = null, $for_update = false ) {
$as = null;
if ( is_array( $tables ) ) {
if ( empty( $tables ) ) {
return false;
}
$table = array_shift( $tables );
$join = $tables;
... | [
"public",
"function",
"get_select_sql",
"(",
"$",
"tables",
",",
"$",
"where",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
",",
"$",
"order_by",
"=",
"null",
",",
"$",
"group_by",
"... | @param array|string $tables
@param null|array $where
@param null|array|string $fields
@param null|int $limit
@param null|int $offset
@param null|array $order_by
@param null|array $group_by
@param bool $for_update
@return string|false | [
"@param",
"array|string",
"$tables",
"@param",
"null|array",
"$where",
"@param",
"null|array|string",
"$fields",
"@param",
"null|int",
"$limit",
"@param",
"null|int",
"$offset",
"@param",
"null|array",
"$order_by",
"@param",
"null|array",
"$group_by",
"@param",
"bool",
... | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L921-L967 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.select | public function select( $tables, $where = [], $fields = null, $limit = null, $offset = null, $order_by = null, $group_by = null, $output = null, $for_update = false ) {
$sql = $this->get_select_sql( $tables, $where, $fields, $limit, $offset, $order_by, $group_by, $for_update );
if ( false === $sql ) {
return fal... | php | public function select( $tables, $where = [], $fields = null, $limit = null, $offset = null, $order_by = null, $group_by = null, $output = null, $for_update = false ) {
$sql = $this->get_select_sql( $tables, $where, $fields, $limit, $offset, $order_by, $group_by, $for_update );
if ( false === $sql ) {
return fal... | [
"public",
"function",
"select",
"(",
"$",
"tables",
",",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
",",
"$",
"order_by",
"=",
"null",
",",
"$",
"group_by",
"=",
... | @since 2.0.0 Changed: default value of $output
@param array|string $tables
@param array $where
@param null|array|string $fields
@param null|int $limit
@param null|int $offset
@param null|array $order_by
@param null|array $group_by
@param null|string $output
@param bool $for_update
@return array|bool|null | [
"@since",
"2",
".",
"0",
".",
"0",
"Changed",
":",
"default",
"value",
"of",
"$output"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L984-L995 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.select_row | public function select_row( $tables, $where = [], $fields = null, $offset = null, $order_by = null, $group_by = null, $output = null, $for_update = false ) {
$sql = $this->get_select_sql( $tables, $where, $fields, 1, $offset, $order_by, $group_by, $for_update );
if ( false === $sql ) {
return false;
}
/** @... | php | public function select_row( $tables, $where = [], $fields = null, $offset = null, $order_by = null, $group_by = null, $output = null, $for_update = false ) {
$sql = $this->get_select_sql( $tables, $where, $fields, 1, $offset, $order_by, $group_by, $for_update );
if ( false === $sql ) {
return false;
}
/** @... | [
"public",
"function",
"select_row",
"(",
"$",
"tables",
",",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
",",
"$",
"order_by",
"=",
"null",
",",
"$",
"group_by",
"=",
"null",
",",
"$",
"output",
... | @since 2.0.0 Changed: default value of $output
@param array|string $tables
@param array $where
@param null|array|string $fields
@param null|int $offset
@param null|array $order_by
@param null|array $group_by
@param null|string $output
@param bool $for_update
@return array|bool|null | [
"@since",
"2",
".",
"0",
".",
"0",
"Changed",
":",
"default",
"value",
"of",
"$output"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1011-L1022 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.select_count | public function select_count( $table, $field = '*', $where = [], $limit = null, $offset = null, $order_by = null, $group_by = null, $for_update = false ) {
empty( $field ) and $field = '*';
$result = $this->select( $table, $where, [
$field => [
'COUNT',
'num',
],
], $limit, $offset, $order_by, $grou... | php | public function select_count( $table, $field = '*', $where = [], $limit = null, $offset = null, $order_by = null, $group_by = null, $for_update = false ) {
empty( $field ) and $field = '*';
$result = $this->select( $table, $where, [
$field => [
'COUNT',
'num',
],
], $limit, $offset, $order_by, $grou... | [
"public",
"function",
"select_count",
"(",
"$",
"table",
",",
"$",
"field",
"=",
"'*'",
",",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
",",
"$",
"order_by",
"=",
"null",
",",
"$",
"group_by",
"=... | @since 2.0.0 Changed: default values of $offset, $order_by, $group_by
@param $table
@param string $field
@param array $where
@param null|int $limit
@param null|int $offset
@param null|array $order_by
@param null|array $group_by
@param bool $for_update
@return int | [
"@since",
"2",
".",
"0",
".",
"0",
"Changed",
":",
"default",
"values",
"of",
"$offset",
"$order_by",
"$group_by"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1038-L1051 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db._insert_replace | private function _insert_replace( $table, $data, $method ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $method !== 'insert' && $method !== 'replace' ) {
return false;
}
if ( $method === 'replace' && ! isset( $data['id'] ) ) {
return false;
}
/** @var \wpdb $wpdb */
... | php | private function _insert_replace( $table, $data, $method ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $method !== 'insert' && $method !== 'replace' ) {
return false;
}
if ( $method === 'replace' && ! isset( $data['id'] ) ) {
return false;
}
/** @var \wpdb $wpdb */
... | [
"private",
"function",
"_insert_replace",
"(",
"$",
"table",
",",
"$",
"data",
",",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",... | @param string $table
@param array $data
@param string $method
@return false|int | [
"@param",
"string",
"$table",
"@param",
"array",
"$data",
"@param",
"string",
"$method"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1060-L1079 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.bulk_insert | public function bulk_insert( $table, $fields, $data_list ) {
if ( ! isset( $this->table_defines[ $table ] ) || empty( $fields ) || empty( $data_list ) ) {
return false;
}
$columns = $this->table_defines[ $table ]['columns'];
$table = $this->get_table( $table );
$sql = "INSERT INTO {$table... | php | public function bulk_insert( $table, $fields, $data_list ) {
if ( ! isset( $this->table_defines[ $table ] ) || empty( $fields ) || empty( $data_list ) ) {
return false;
}
$columns = $this->table_defines[ $table ]['columns'];
$table = $this->get_table( $table );
$sql = "INSERT INTO {$table... | [
"public",
"function",
"bulk_insert",
"(",
"$",
"table",
",",
"$",
"fields",
",",
"$",
"data_list",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
"||",
"empty",
"(",
"$",
"fields",
")",
"||"... | @param string $table
@param array $fields
@param array $data_list
@return false|int | [
"@param",
"string",
"$table",
"@param",
"array",
"$fields",
"@param",
"array",
"$data_list"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1127-L1163 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.insert_or_update | public function insert_or_update( $table, $data, $where ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
$where['deleted_at'] = null;
}
$row = $this->select_row( $table, $where, 'id' );
if ( empty( $row ) ) {
$this... | php | public function insert_or_update( $table, $data, $where ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
$where['deleted_at'] = null;
}
$row = $this->select_row( $table, $where, 'id' );
if ( empty( $row ) ) {
$this... | [
"public",
"function",
"insert_or_update",
"(",
"$",
"table",
",",
"$",
"data",
",",
"$",
"where",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | @param $table
@param $data
@param $where
@return int|false | [
"@param",
"$table",
"@param",
"$data",
"@param",
"$where"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1209-L1234 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.delete | public function delete( $table, $where ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
$data = $this->set_update_params( [], false, false, true );
return $this->update( $table, $data, $where );
}
/** @var \wpdb $wp... | php | public function delete( $table, $where ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
$data = $this->set_update_params( [], false, false, true );
return $this->update( $table, $data, $where );
}
/** @var \wpdb $wp... | [
"public",
"function",
"delete",
"(",
"$",
"table",
",",
"$",
"where",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
... | @param string $table
@param array $where
@return bool|false|int | [
"@param",
"string",
"$table",
"@param",
"array",
"$where"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1242-L1260 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.truncate | public function truncate( $table ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
return $this->delete( $table, [] );
}
$sql = 'TRUNCATE TABLE `' . $this->get_table( $table ) . '`';
return $this->query( $sql );
} | php | public function truncate( $table ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
return $this->delete( $table, [] );
}
$sql = 'TRUNCATE TABLE `' . $this->get_table( $table ) . '`';
return $this->query( $sql );
} | [
"public",
"function",
"truncate",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"is_logical",
"(",
... | @param $table
@return bool|false|int | [
"@param",
"$table"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1267-L1279 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.prepare | public function prepare( $sql, $values ) {
/** @var \wpdb $wpdb */
global $wpdb;
return empty( $values ) ? $sql : $wpdb->prepare( $sql, $values );
} | php | public function prepare( $sql, $values ) {
/** @var \wpdb $wpdb */
global $wpdb;
return empty( $values ) ? $sql : $wpdb->prepare( $sql, $values );
} | [
"public",
"function",
"prepare",
"(",
"$",
"sql",
",",
"$",
"values",
")",
"{",
"/** @var \\wpdb $wpdb */",
"global",
"$",
"wpdb",
";",
"return",
"empty",
"(",
"$",
"values",
")",
"?",
"$",
"sql",
":",
"$",
"wpdb",
"->",
"prepare",
"(",
"$",
"sql",
"... | @param string $sql
@param array $values
@return string | [
"@param",
"string",
"$sql",
"@param",
"array",
"$values"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1299-L1304 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.lock | public function lock( $table, $write ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
return $this->query( 'LOCK TABLES `' . $this->get_table( $table ) ) . '` ' . ( $write ? 'WRITE' : 'READ' );
} | php | public function lock( $table, $write ) {
if ( ! isset( $this->table_defines[ $table ] ) ) {
return false;
}
return $this->query( 'LOCK TABLES `' . $this->get_table( $table ) ) . '` ' . ( $write ? 'WRITE' : 'READ' );
} | [
"public",
"function",
"lock",
"(",
"$",
"table",
",",
"$",
"write",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"table_defines",
"[",
"$",
"table",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"quer... | @param string $table
@param bool $write
@return false|int | [
"@param",
"string",
"$table",
"@param",
"bool",
"$write"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1319-L1325 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.transaction | public function transaction( $func ) {
$level = $this->_transaction_level;
$this->_transaction_level ++;
if ( $level === 0 ) {
$this->_error = null;
try {
$this->begin();
$func();
$this->commit();
return true;
} catch ( \Exception $e ) {
$this->rollback();
$this->app->log( $e );
... | php | public function transaction( $func ) {
$level = $this->_transaction_level;
$this->_transaction_level ++;
if ( $level === 0 ) {
$this->_error = null;
try {
$this->begin();
$func();
$this->commit();
return true;
} catch ( \Exception $e ) {
$this->rollback();
$this->app->log( $e );
... | [
"public",
"function",
"transaction",
"(",
"$",
"func",
")",
"{",
"$",
"level",
"=",
"$",
"this",
"->",
"_transaction_level",
";",
"$",
"this",
"->",
"_transaction_level",
"++",
";",
"if",
"(",
"$",
"level",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"_... | @param callable $func
@return bool | [
"@param",
"callable",
"$func"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1353-L1382 |
technote-space/wordpress-plugin-base | src/classes/models/lib/db.php | Db.uninstall | public function uninstall() {
foreach ( $this->table_defines as $table => $define ) {
if ( ! empty( $define['is_added'] ) ) {
$sql = 'DROP TABLE IF EXISTS `' . $this->get_table( $table ) . '`';
$this->query( $sql );
}
}
} | php | public function uninstall() {
foreach ( $this->table_defines as $table => $define ) {
if ( ! empty( $define['is_added'] ) ) {
$sql = 'DROP TABLE IF EXISTS `' . $this->get_table( $table ) . '`';
$this->query( $sql );
}
}
} | [
"public",
"function",
"uninstall",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"table_defines",
"as",
"$",
"table",
"=>",
"$",
"define",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"define",
"[",
"'is_added'",
"]",
")",
")",
"{",
"$",
"sql",... | uninstall | [
"uninstall"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/db.php#L1387-L1394 |
mekras/atompub | src/Element/Collection.php | Collection.getAcceptedTypes | public function getAcceptedTypes()
{
return $this->getCachedProperty(
'accept',
function () {
$result = [];
/** @var \DOMNodeList $nodes */
// No REQUIRED — no exception.
$nodes = $this->query('app:accept');
... | php | public function getAcceptedTypes()
{
return $this->getCachedProperty(
'accept',
function () {
$result = [];
/** @var \DOMNodeList $nodes */
// No REQUIRED — no exception.
$nodes = $this->query('app:accept');
... | [
"public",
"function",
"getAcceptedTypes",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getCachedProperty",
"(",
"'accept'",
",",
"function",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"/** @var \\DOMNodeList $nodes */",
"// No REQUIRED — no exception.",
"$"... | Return types of representations accepted by the Collection.
@return string[]
@since 1.0 | [
"Return",
"types",
"of",
"representations",
"accepted",
"by",
"the",
"Collection",
"."
] | train | https://github.com/mekras/atompub/blob/cfc9aab97cff7a822b720e1dd84ef16733183dbb/src/Element/Collection.php#L56-L72 |
mekras/atompub | src/Element/Collection.php | Collection.setAcceptedTypes | public function setAcceptedTypes(array $types)
{
/** @var \DOMNodeList $nodes */
// No REQUIRED — no exception.
$nodes = $this->query('app:accept');
foreach ($nodes as $node) {
$this->getDomElement()->removeChild($node);
}
foreach ($types as $type) {
... | php | public function setAcceptedTypes(array $types)
{
/** @var \DOMNodeList $nodes */
// No REQUIRED — no exception.
$nodes = $this->query('app:accept');
foreach ($nodes as $node) {
$this->getDomElement()->removeChild($node);
}
foreach ($types as $type) {
... | [
"public",
"function",
"setAcceptedTypes",
"(",
"array",
"$",
"types",
")",
"{",
"/** @var \\DOMNodeList $nodes */",
"// No REQUIRED — no exception.",
"$",
"nodes",
"=",
"$",
"this",
"->",
"query",
"(",
"'app:accept'",
")",
";",
"foreach",
"(",
"$",
"nodes",
"as",
... | Set types of representations accepted by the Collection.
@param string[] $types
@since 1.0 | [
"Set",
"types",
"of",
"representations",
"accepted",
"by",
"the",
"Collection",
"."
] | train | https://github.com/mekras/atompub/blob/cfc9aab97cff7a822b720e1dd84ef16733183dbb/src/Element/Collection.php#L81-L95 |
netzmacht/contao-leaflet-geocode-widget | src/Widget/RadiusWidget.php | RadiusWidget.validator | protected function validator($varInput)
{
if (is_numeric($varInput) && $this->steps > 0) {
$steps = (int) $this->steps;
$varInput = (int) $varInput;
$varInput = ($steps * round($varInput / $steps));
}
return parent::validator($varInput);
} | php | protected function validator($varInput)
{
if (is_numeric($varInput) && $this->steps > 0) {
$steps = (int) $this->steps;
$varInput = (int) $varInput;
$varInput = ($steps * round($varInput / $steps));
}
return parent::validator($varInput);
} | [
"protected",
"function",
"validator",
"(",
"$",
"varInput",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"varInput",
")",
"&&",
"$",
"this",
"->",
"steps",
">",
"0",
")",
"{",
"$",
"steps",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"steps",
";",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/08acfbc473696f385d7c6aed6148e51c91443e12/src/Widget/RadiusWidget.php#L89-L98 |
WellCommerce/AppBundle | Controller/RedirectingController.php | RedirectingController.removeTrailingSlashAction | public function removeTrailingSlashAction(Request $request)
{
$pathInfo = $request->getPathInfo();
$requestUri = $request->getRequestUri();
$url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri);
return $this->redirect($url, 301);
} | php | public function removeTrailingSlashAction(Request $request)
{
$pathInfo = $request->getPathInfo();
$requestUri = $request->getRequestUri();
$url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri);
return $this->redirect($url, 301);
} | [
"public",
"function",
"removeTrailingSlashAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"pathInfo",
"=",
"$",
"request",
"->",
"getPathInfo",
"(",
")",
";",
"$",
"requestUri",
"=",
"$",
"request",
"->",
"getRequestUri",
"(",
")",
";",
"$",
"url",... | Action used to remove trailing slash in url
@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Action",
"used",
"to",
"remove",
"trailing",
"slash",
"in",
"url"
] | train | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Controller/RedirectingController.php#L32-L40 |
SergioMadness/query-builder | src/abstraction/InsertBuilder.php | InsertBuilder.generate | public function generate()
{
$result = '';
$table = $this->buildTable();
$fields = $this->buildFields();
$result.='INSERT INTO '.$table.' '.$fields;
return $result;
} | php | public function generate()
{
$result = '';
$table = $this->buildTable();
$fields = $this->buildFields();
$result.='INSERT INTO '.$table.' '.$fields;
return $result;
} | [
"public",
"function",
"generate",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"table",
"=",
"$",
"this",
"->",
"buildTable",
"(",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"buildFields",
"(",
")",
";",
"$",
"result",
".=",
"'INSERT IN... | Generate query
@return string | [
"Generate",
"query"
] | train | https://github.com/SergioMadness/query-builder/blob/95b7a46bba4c4d369101c6f0d37f133fecb3956d/src/abstraction/InsertBuilder.php#L27-L37 |
antaresproject/notifications | src/Http/Presenters/IndexPresenter.php | IndexPresenter.table | public function table($type = null)
{
$this->breadcrumb->onTable($type);
return $this->datatables->render('antares/notifications::admin.index.index');
} | php | public function table($type = null)
{
$this->breadcrumb->onTable($type);
return $this->datatables->render('antares/notifications::admin.index.index');
} | [
"public",
"function",
"table",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"breadcrumb",
"->",
"onTable",
"(",
"$",
"type",
")",
";",
"return",
"$",
"this",
"->",
"datatables",
"->",
"render",
"(",
"'antares/notifications::admin.index.index'"... | Table View Generator
@param String $type
@return View | [
"Table",
"View",
"Generator"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Presenters/IndexPresenter.php#L69-L73 |
antaresproject/notifications | src/Http/Presenters/IndexPresenter.php | IndexPresenter.edit | public function edit($eloquent, $locale)
{
$this->breadcrumb->onEdit($eloquent);
$form = $this->getForm($eloquent);
return $this->view('edit', compact('form'));
} | php | public function edit($eloquent, $locale)
{
$this->breadcrumb->onEdit($eloquent);
$form = $this->getForm($eloquent);
return $this->view('edit', compact('form'));
} | [
"public",
"function",
"edit",
"(",
"$",
"eloquent",
",",
"$",
"locale",
")",
"{",
"$",
"this",
"->",
"breadcrumb",
"->",
"onEdit",
"(",
"$",
"eloquent",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"getForm",
"(",
"$",
"eloquent",
")",
";",
"retu... | shows form edit job
@param Model $eloquent
@param String $locale
@return View | [
"shows",
"form",
"edit",
"job"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Presenters/IndexPresenter.php#L82-L87 |
antaresproject/notifications | src/Http/Presenters/IndexPresenter.php | IndexPresenter.getForm | public function getForm($eloquent, $type = null)
{
$classname = $eloquent->classname;
$model = $eloquent->contents->first();
$configuration = [
'content' => $model !== null ? $model->content : null,
'title' => $model !== null ? $model->title ... | php | public function getForm($eloquent, $type = null)
{
$classname = $eloquent->classname;
$model = $eloquent->contents->first();
$configuration = [
'content' => $model !== null ? $model->content : null,
'title' => $model !== null ? $model->title ... | [
"public",
"function",
"getForm",
"(",
"$",
"eloquent",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"classname",
"=",
"$",
"eloquent",
"->",
"classname",
";",
"$",
"model",
"=",
"$",
"eloquent",
"->",
"contents",
"->",
"first",
"(",
")",
";",
"$",
... | gets form instance
@param Model $eloquent
@return FormBuilder
@throws Exception | [
"gets",
"form",
"instance"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Presenters/IndexPresenter.php#L96-L114 |
antaresproject/notifications | src/Http/Presenters/IndexPresenter.php | IndexPresenter.form | protected function form(Fluent $fluent, $notification = null)
{
publish('notifications', 'scripts.resources-default');
Event::fire('antares.forms', 'notification.' . $fluent->form_name);
$fluent->type = $fluent->type === '' ? 'email' : $fluent->type;
return new Form($notification, $... | php | protected function form(Fluent $fluent, $notification = null)
{
publish('notifications', 'scripts.resources-default');
Event::fire('antares.forms', 'notification.' . $fluent->form_name);
$fluent->type = $fluent->type === '' ? 'email' : $fluent->type;
return new Form($notification, $... | [
"protected",
"function",
"form",
"(",
"Fluent",
"$",
"fluent",
",",
"$",
"notification",
"=",
"null",
")",
"{",
"publish",
"(",
"'notifications'",
",",
"'scripts.resources-default'",
")",
";",
"Event",
"::",
"fire",
"(",
"'antares.forms'",
",",
"'notification.'"... | gets instance of command form
@param Fluent $fluent
@param mixed $notification
@return FormBuilder | [
"gets",
"instance",
"of",
"command",
"form"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Presenters/IndexPresenter.php#L123-L130 |
antaresproject/notifications | src/Http/Presenters/IndexPresenter.php | IndexPresenter.create | public function create(Model $model, $type = null)
{
$this->breadcrumb->onCreate($type);
$form = $this->getForm($model, $type)->onCreate();
return $this->view('create', ['form' => $form]);
} | php | public function create(Model $model, $type = null)
{
$this->breadcrumb->onCreate($type);
$form = $this->getForm($model, $type)->onCreate();
return $this->view('create', ['form' => $form]);
} | [
"public",
"function",
"create",
"(",
"Model",
"$",
"model",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"breadcrumb",
"->",
"onCreate",
"(",
"$",
"type",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"getForm",
"(",
"$",
"model",
... | create new notification notification
@param Model $model
@param String $type
@return View | [
"create",
"new",
"notification",
"notification"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Presenters/IndexPresenter.php#L150-L156 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.edit | public function edit($id, $locale, IndexListener $listener)
{
app('antares.asset')->container('antares/foundation::application')->add('ckeditor', '/packages/ckeditor/ckeditor.js', ['webpack_forms_basic']);
$model = $this->repository->findByLocale($id, $locale);
if (is_null($model)) {
... | php | public function edit($id, $locale, IndexListener $listener)
{
app('antares.asset')->container('antares/foundation::application')->add('ckeditor', '/packages/ckeditor/ckeditor.js', ['webpack_forms_basic']);
$model = $this->repository->findByLocale($id, $locale);
if (is_null($model)) {
... | [
"public",
"function",
"edit",
"(",
"$",
"id",
",",
"$",
"locale",
",",
"IndexListener",
"$",
"listener",
")",
"{",
"app",
"(",
"'antares.asset'",
")",
"->",
"container",
"(",
"'antares/foundation::application'",
")",
"->",
"add",
"(",
"'ckeditor'",
",",
"'/p... | shows edit form
@param mixed $id
@param String $locale
@param IndexListener $listener
@return View | [
"shows",
"edit",
"form"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L89-L97 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.update | public function update(IndexListener $listener)
{
$id = Input::get('id');
$model = $this->repository->find($id);
$form = $this->presenter->getForm($model);
if (!$form->isValid()) {
return $listener->updateValidationFailed($id, $form->getMessageBag());
}
... | php | public function update(IndexListener $listener)
{
$id = Input::get('id');
$model = $this->repository->find($id);
$form = $this->presenter->getForm($model);
if (!$form->isValid()) {
return $listener->updateValidationFailed($id, $form->getMessageBag());
}
... | [
"public",
"function",
"update",
"(",
"IndexListener",
"$",
"listener",
")",
"{",
"$",
"id",
"=",
"Input",
"::",
"get",
"(",
"'id'",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"repository",
"->",
"find",
"(",
"$",
"id",
")",
";",
"$",
"form",
... | updates notification notification
@param IndexListener $listener
@return RedirectResponse | [
"updates",
"notification",
"notification"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L105-L120 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.preview | public function preview()
{
$inputs = Input::all();
$content = str_replace("'", '"', $inputs['content']);
$content = $this->variablesAdapter->get($content);
if( isset($inputs['subject']) ) {
$subject = str_replace("'", '"', $inputs['subject']);
$subj... | php | public function preview()
{
$inputs = Input::all();
$content = str_replace("'", '"', $inputs['content']);
$content = $this->variablesAdapter->get($content);
if( isset($inputs['subject']) ) {
$subject = str_replace("'", '"', $inputs['subject']);
$subj... | [
"public",
"function",
"preview",
"(",
")",
"{",
"$",
"inputs",
"=",
"Input",
"::",
"all",
"(",
")",
";",
"$",
"content",
"=",
"str_replace",
"(",
"\"'\"",
",",
"'\"'",
",",
"$",
"inputs",
"[",
"'content'",
"]",
")",
";",
"$",
"content",
"=",
"$... | preview notification notification
@return View | [
"preview",
"notification",
"notification"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L180-L207 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.changeStatus | public function changeStatus(IndexListener $listener, $id)
{
$model = $this->repository->find($id);
if (is_null($model)) {
return $listener->changeStatusFailed();
}
$model->active = $model->active ? 0 : 1;
$model->save();
return $listener->changeStatusSucc... | php | public function changeStatus(IndexListener $listener, $id)
{
$model = $this->repository->find($id);
if (is_null($model)) {
return $listener->changeStatusFailed();
}
$model->active = $model->active ? 0 : 1;
$model->save();
return $listener->changeStatusSucc... | [
"public",
"function",
"changeStatus",
"(",
"IndexListener",
"$",
"listener",
",",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"repository",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"model",
")",
")",
"{... | change notification notification status
@param IndexListener $listener
@param mixed $id
@return RedirectResponse | [
"change",
"notification",
"notification",
"status"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L216-L225 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.create | public function create($type = null)
{
app('antares.asset')->container('antares/foundation::application')->add('ckeditor', '/packages/ckeditor/ckeditor.js', ['webpack_forms_basic']);
return $this->presenter->create($this->repository->makeModel()->getModel(), $type);
} | php | public function create($type = null)
{
app('antares.asset')->container('antares/foundation::application')->add('ckeditor', '/packages/ckeditor/ckeditor.js', ['webpack_forms_basic']);
return $this->presenter->create($this->repository->makeModel()->getModel(), $type);
} | [
"public",
"function",
"create",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"app",
"(",
"'antares.asset'",
")",
"->",
"container",
"(",
"'antares/foundation::application'",
")",
"->",
"add",
"(",
"'ckeditor'",
",",
"'/packages/ckeditor/ckeditor.js'",
",",
"[",
"'we... | Create notification notification form
@param String $type
@return View | [
"Create",
"notification",
"notification",
"form"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L233-L237 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.store | public function store(IndexListener $listener)
{
$model = $this->repository->makeModel()->getModel();
$form = $this->presenter->getForm($model)->onCreate();
if (!$form->isValid()) {
return $listener->storeValidationFailed($form->getMessageBag());
}
try {
... | php | public function store(IndexListener $listener)
{
$model = $this->repository->makeModel()->getModel();
$form = $this->presenter->getForm($model)->onCreate();
if (!$form->isValid()) {
return $listener->storeValidationFailed($form->getMessageBag());
}
try {
... | [
"public",
"function",
"store",
"(",
"IndexListener",
"$",
"listener",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"repository",
"->",
"makeModel",
"(",
")",
"->",
"getModel",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"presenter",
"->",
... | store new notification notification
@param IndexListener $listener
@return RedirectResponse | [
"store",
"new",
"notification",
"notification"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L245-L258 |
antaresproject/notifications | src/Processor/IndexProcessor.php | IndexProcessor.delete | public function delete($id, IndexListener $listener)
{
try {
$model = $this->repository->makeModel()->findOrFail($id);
$model->delete();
return $listener->deleteSuccess();
} catch (Exception $ex) {
return $listener->deleteFailed();
}
} | php | public function delete($id, IndexListener $listener)
{
try {
$model = $this->repository->makeModel()->findOrFail($id);
$model->delete();
return $listener->deleteSuccess();
} catch (Exception $ex) {
return $listener->deleteFailed();
}
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
",",
"IndexListener",
"$",
"listener",
")",
"{",
"try",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"repository",
"->",
"makeModel",
"(",
")",
"->",
"findOrFail",
"(",
"$",
"id",
")",
";",
"$",
"model",
... | deletes custom notification
@param mixed $id
@param IndexListener $listener
@return RedirectResponse | [
"deletes",
"custom",
"notification"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Processor/IndexProcessor.php#L267-L276 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.getSnippets | public function getSnippets()
{
$snippets = ArrayList::create();
// Setup any model admin plus snippets
foreach ($this->config()->registered_snippets as $snippet) {
$snippet = Injector::inst()->create($snippet);
$snippet->setParent($this);
$snippets->add(... | php | public function getSnippets()
{
$snippets = ArrayList::create();
// Setup any model admin plus snippets
foreach ($this->config()->registered_snippets as $snippet) {
$snippet = Injector::inst()->create($snippet);
$snippet->setParent($this);
$snippets->add(... | [
"public",
"function",
"getSnippets",
"(",
")",
"{",
"$",
"snippets",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"// Setup any model admin plus snippets",
"foreach",
"(",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"registered_snippets",
"as",
"$",
"snip... | Setup | [
"Setup"
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L72-L88 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.getExportFields | public function getExportFields()
{
$export_fields = Config::inst()->get(
$this->modelClass,
self::EXPORT_FIELDS
);
if (isset($export_fields) && is_array($export_fields)) {
$fields = $export_fields;
} else {
$fields = parent::getExport... | php | public function getExportFields()
{
$export_fields = Config::inst()->get(
$this->modelClass,
self::EXPORT_FIELDS
);
if (isset($export_fields) && is_array($export_fields)) {
$fields = $export_fields;
} else {
$fields = parent::getExport... | [
"public",
"function",
"getExportFields",
"(",
")",
"{",
"$",
"export_fields",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"modelClass",
",",
"self",
"::",
"EXPORT_FIELDS",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"export_... | Get the default export fields for the current model.
First this checks if there is an `export_fields` config variable set on
the model class, if not, it reverts to the default behaviour.
@return array | [
"Get",
"the",
"default",
"export",
"fields",
"for",
"the",
"current",
"model",
"."
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L118-L134 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.getSearchSessionName | public function getSearchSessionName()
{
$curr = $this->sanitiseClassName(self::class);
$model = $this->sanitiseClassName($this->modelClass);
return $curr . "." . $model;
} | php | public function getSearchSessionName()
{
$curr = $this->sanitiseClassName(self::class);
$model = $this->sanitiseClassName($this->modelClass);
return $curr . "." . $model;
} | [
"public",
"function",
"getSearchSessionName",
"(",
")",
"{",
"$",
"curr",
"=",
"$",
"this",
"->",
"sanitiseClassName",
"(",
"self",
"::",
"class",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"sanitiseClassName",
"(",
"$",
"this",
"->",
"modelClass",
... | Get the name of the session to be useed by this model admin's search
form.
@return string | [
"Get",
"the",
"name",
"of",
"the",
"session",
"to",
"be",
"useed",
"by",
"this",
"model",
"admin",
"s",
"search",
"form",
"."
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L142-L147 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.setSearchSession | public function setSearchSession($data)
{
$session = $this->getRequest()->getSession();
return $session->set($this->getSearchSessionName(), $data);
} | php | public function setSearchSession($data)
{
$session = $this->getRequest()->getSession();
return $session->set($this->getSearchSessionName(), $data);
} | [
"public",
"function",
"setSearchSession",
"(",
"$",
"data",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getSession",
"(",
")",
";",
"return",
"$",
"session",
"->",
"set",
"(",
"$",
"this",
"->",
"getSearchSessionName"... | Set some data to a search session. This needs to be an array of
data (like the data submitted by a form).
@param array $data An array of data to store in the session
@return self | [
"Set",
"some",
"data",
"to",
"a",
"search",
"session",
".",
"This",
"needs",
"to",
"be",
"an",
"array",
"of",
"data",
"(",
"like",
"the",
"data",
"submitted",
"by",
"a",
"form",
")",
"."
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L179-L183 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.getSearchData | public function getSearchData()
{
$data = $this->getSearchSession();
if (!$data || $data && !is_array($data)) {
$data = [];
}
return $data;
} | php | public function getSearchData()
{
$data = $this->getSearchSession();
if (!$data || $data && !is_array($data)) {
$data = [];
}
return $data;
} | [
"public",
"function",
"getSearchData",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getSearchSession",
"(",
")",
";",
"if",
"(",
"!",
"$",
"data",
"||",
"$",
"data",
"&&",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"="... | Get the current search results, combined with any saved
search results and resturn (as an array).
@return array | [
"Get",
"the",
"current",
"search",
"results",
"combined",
"with",
"any",
"saved",
"search",
"results",
"and",
"resturn",
"(",
"as",
"an",
"array",
")",
"."
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L191-L200 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.getEditForm | public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$grid_field = $form
->Fields()
->fieldByName($this->sanitiseClassName($this->modelClass));
// Add bulk editing to gridfield
$manager = new BulkManager();
... | php | public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
$grid_field = $form
->Fields()
->fieldByName($this->sanitiseClassName($this->modelClass));
// Add bulk editing to gridfield
$manager = new BulkManager();
... | [
"public",
"function",
"getEditForm",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
")",
"{",
"$",
"form",
"=",
"parent",
"::",
"getEditForm",
"(",
"$",
"id",
",",
"$",
"fields",
")",
";",
"$",
"grid_field",
"=",
"$",
"form",
"->",
... | Add bulk editor to Edit Form
@param int|null $id
@param FieldList $fields
@return Form A Form object | [
"Add",
"bulk",
"editor",
"to",
"Edit",
"Form"
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L210-L252 |
i-lateral/silverstripe-modeladminplus | src/ModelAdminPlus.php | ModelAdminPlus.search | public function search($data, $form)
{
foreach ($data as $key => $value) {
// Ensure we clear any null values
// so they don't mess up the list
if (empty($data[$key])) {
unset($data[$key]);
}
// Ensure we clear any null values
... | php | public function search($data, $form)
{
foreach ($data as $key => $value) {
// Ensure we clear any null values
// so they don't mess up the list
if (empty($data[$key])) {
unset($data[$key]);
}
// Ensure we clear any null values
... | [
"public",
"function",
"search",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"// Ensure we clear any null values",
"// so they don't mess up the list",
"if",
"(",
"empty",
"(",
"$"... | Set the session from the submitted form data (and redirect back)
@param array $data Submitted form
@param Form $form The current form
@return HTTPResponse | [
"Set",
"the",
"session",
"from",
"the",
"submitted",
"form",
"data",
"(",
"and",
"redirect",
"back",
")"
] | train | https://github.com/i-lateral/silverstripe-modeladminplus/blob/c5209d9610cdb36ddc7b9231fad342df7e75ffc0/src/ModelAdminPlus.php#L262-L281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.