repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
hnhdigital-os/laravel-frontend-assets
src/FontAwesome.php
FontAwesome.version4
private function version4($version = false) { if (!env('APP_CDN', true)) { FrontendAsset::add('vendor/font-awesome/css/font-awesome.min.css'); return; } $version = FrontendAsset::version(class_basename(__CLASS__), $version); FrontendAsset::add('https://maxcdn.bootstrapcdn.com/font-awesome/'.$version.'/css/font-awesome.min.css'); }
php
private function version4($version = false) { if (!env('APP_CDN', true)) { FrontendAsset::add('vendor/font-awesome/css/font-awesome.min.css'); return; } $version = FrontendAsset::version(class_basename(__CLASS__), $version); FrontendAsset::add('https://maxcdn.bootstrapcdn.com/font-awesome/'.$version.'/css/font-awesome.min.css'); }
[ "private", "function", "version4", "(", "$", "version", "=", "false", ")", "{", "if", "(", "!", "env", "(", "'APP_CDN'", ",", "true", ")", ")", "{", "FrontendAsset", "::", "add", "(", "'vendor/font-awesome/css/font-awesome.min.css'", ")", ";", "return", ";",...
Using version 4. @return void @SuppressWarnings(PHPMD.BooleanArgumentFlag)
[ "Using", "version", "4", "." ]
242f605bf0c052f4d82421a8b95f227d46162e34
https://github.com/hnhdigital-os/laravel-frontend-assets/blob/242f605bf0c052f4d82421a8b95f227d46162e34/src/FontAwesome.php#L36-L46
train
ajcastro/fk-adder
src/Fk.php
Fk.add
public function add($fk, $column = null, $keyName = null, $onDelete = null, $onUpdate = null) { $baseFk = $this->baseFk($fk); $column = $column ?: $baseFk->defaultColumn(); static::$foreignKeys[] = [ 'column' => $column ?: $this->column, 'key_name' => $keyName ?: $this->keyName, 'table' => $this->table->getTable(), 'reference_table' => $baseFk->referenceTable(), 'primary_key' => $baseFk->primaryKey, 'on_delete' => $onDelete ?: $this->onDelete ?: $baseFk->onDelete, 'on_update' => $onUpdate ?: $this->onUpdate ?: $baseFk->onUpdate, ]; return $baseFk->createFkColumn($column); }
php
public function add($fk, $column = null, $keyName = null, $onDelete = null, $onUpdate = null) { $baseFk = $this->baseFk($fk); $column = $column ?: $baseFk->defaultColumn(); static::$foreignKeys[] = [ 'column' => $column ?: $this->column, 'key_name' => $keyName ?: $this->keyName, 'table' => $this->table->getTable(), 'reference_table' => $baseFk->referenceTable(), 'primary_key' => $baseFk->primaryKey, 'on_delete' => $onDelete ?: $this->onDelete ?: $baseFk->onDelete, 'on_update' => $onUpdate ?: $this->onUpdate ?: $baseFk->onUpdate, ]; return $baseFk->createFkColumn($column); }
[ "public", "function", "add", "(", "$", "fk", ",", "$", "column", "=", "null", ",", "$", "keyName", "=", "null", ",", "$", "onDelete", "=", "null", ",", "$", "onUpdate", "=", "null", ")", "{", "$", "baseFk", "=", "$", "this", "->", "baseFk", "(", ...
Add a foreign key to table and defer its foreign key creation. @param string $fk @param string $column @param string $keyName @param string $onDelete @param string $onUpdate @return \Illuminate\Support\Fluent
[ "Add", "a", "foreign", "key", "to", "table", "and", "defer", "its", "foreign", "key", "creation", "." ]
a79200d8333e1bf897c9069c3a1b575af868b188
https://github.com/ajcastro/fk-adder/blob/a79200d8333e1bf897c9069c3a1b575af868b188/src/Fk.php#L113-L130
train
ajcastro/fk-adder
src/Fk.php
Fk.migrate
public static function migrate() { foreach (static::$foreignKeys as $foreignKey) { Schema::table($foreignKey['table'], function (Blueprint $table) use ($foreignKey) { $table->foreign($foreignKey['column'], $foreignKey['key_name']) ->references($foreignKey['primary_key']) ->on($foreignKey['reference_table']) ->onDelete($foreignKey['on_delete']) ->onUpdate($foreignKey['on_update']); }); } static::$foreignKeys = []; }
php
public static function migrate() { foreach (static::$foreignKeys as $foreignKey) { Schema::table($foreignKey['table'], function (Blueprint $table) use ($foreignKey) { $table->foreign($foreignKey['column'], $foreignKey['key_name']) ->references($foreignKey['primary_key']) ->on($foreignKey['reference_table']) ->onDelete($foreignKey['on_delete']) ->onUpdate($foreignKey['on_update']); }); } static::$foreignKeys = []; }
[ "public", "static", "function", "migrate", "(", ")", "{", "foreach", "(", "static", "::", "$", "foreignKeys", "as", "$", "foreignKey", ")", "{", "Schema", "::", "table", "(", "$", "foreignKey", "[", "'table'", "]", ",", "function", "(", "Blueprint", "$",...
Migrate creation of foreign keys base from the fk calls. @return void
[ "Migrate", "creation", "of", "foreign", "keys", "base", "from", "the", "fk", "calls", "." ]
a79200d8333e1bf897c9069c3a1b575af868b188
https://github.com/ajcastro/fk-adder/blob/a79200d8333e1bf897c9069c3a1b575af868b188/src/Fk.php#L137-L150
train
ajcastro/fk-adder
src/Fk.php
Fk.baseFk
public function baseFk($fk) { if ($fkConfig = FkConfig::get($fk)) { return new BaseFk($this->table, $fk, $fkConfig['datatype'], $fkConfig['referenceTable']); } $class = Config::get('fk_adder.fk_namespace').'\\'.studly_case($fk); return new $class($this->table); }
php
public function baseFk($fk) { if ($fkConfig = FkConfig::get($fk)) { return new BaseFk($this->table, $fk, $fkConfig['datatype'], $fkConfig['referenceTable']); } $class = Config::get('fk_adder.fk_namespace').'\\'.studly_case($fk); return new $class($this->table); }
[ "public", "function", "baseFk", "(", "$", "fk", ")", "{", "if", "(", "$", "fkConfig", "=", "FkConfig", "::", "get", "(", "$", "fk", ")", ")", "{", "return", "new", "BaseFk", "(", "$", "this", "->", "table", ",", "$", "fk", ",", "$", "fkConfig", ...
Return the baseFk for foreign key column creation. @param string $fk @return \FkAdder\BaseFk
[ "Return", "the", "baseFk", "for", "foreign", "key", "column", "creation", "." ]
a79200d8333e1bf897c9069c3a1b575af868b188
https://github.com/ajcastro/fk-adder/blob/a79200d8333e1bf897c9069c3a1b575af868b188/src/Fk.php#L168-L177
train
fxpio/fxp-resource
Domain/AbstractDomain.php
AbstractDomain.disableFilters
protected function disableFilters() { $previous = SqlFilterUtil::findFilters($this->om, $this->disableFilters); SqlFilterUtil::disableFilters($this->om, $previous); return $previous; }
php
protected function disableFilters() { $previous = SqlFilterUtil::findFilters($this->om, $this->disableFilters); SqlFilterUtil::disableFilters($this->om, $previous); return $previous; }
[ "protected", "function", "disableFilters", "(", ")", "{", "$", "previous", "=", "SqlFilterUtil", "::", "findFilters", "(", "$", "this", "->", "om", ",", "$", "this", "->", "disableFilters", ")", ";", "SqlFilterUtil", "::", "disableFilters", "(", "$", "this",...
Disable the doctrine filters. @return array The previous values of filters
[ "Disable", "the", "doctrine", "filters", "." ]
cb786bdc04c67d242591fbde6d0723f7d6834f35
https://github.com/fxpio/fxp-resource/blob/cb786bdc04c67d242591fbde6d0723f7d6834f35/Domain/AbstractDomain.php#L259-L265
train
reisraff/phulp
src/Collection.php
Collection.checkType
protected function checkType($item) { $type = $this->getItemType($item); if (! $this->type) { $this->type = $type; return true; } if ($this->type != $type) { return false; } return true; }
php
protected function checkType($item) { $type = $this->getItemType($item); if (! $this->type) { $this->type = $type; return true; } if ($this->type != $type) { return false; } return true; }
[ "protected", "function", "checkType", "(", "$", "item", ")", "{", "$", "type", "=", "$", "this", "->", "getItemType", "(", "$", "item", ")", ";", "if", "(", "!", "$", "this", "->", "type", ")", "{", "$", "this", "->", "type", "=", "$", "type", ...
Checks the immutability of the elements type @return boolean
[ "Checks", "the", "immutability", "of", "the", "elements", "type" ]
5394ab3e20ef626b2399eb9c2a1b4601c232e58d
https://github.com/reisraff/phulp/blob/5394ab3e20ef626b2399eb9c2a1b4601c232e58d/src/Collection.php#L48-L62
train
reisraff/phulp
src/Source.php
Source.setDistFiles
public function setDistFiles(Collection $distFiles) { if ($distFiles->getType() !== DistFile::class) { throw new \UnexpectedValueException('The Collection is not of DistFile type'); } $this->distFiles = $distFiles; }
php
public function setDistFiles(Collection $distFiles) { if ($distFiles->getType() !== DistFile::class) { throw new \UnexpectedValueException('The Collection is not of DistFile type'); } $this->distFiles = $distFiles; }
[ "public", "function", "setDistFiles", "(", "Collection", "$", "distFiles", ")", "{", "if", "(", "$", "distFiles", "->", "getType", "(", ")", "!==", "DistFile", "::", "class", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "'The Collection is ...
Gets the value of distFiles. @param Collection|DistFile[] $distFiles @throws \UnexpectedValueException
[ "Gets", "the", "value", "of", "distFiles", "." ]
5394ab3e20ef626b2399eb9c2a1b4601c232e58d
https://github.com/reisraff/phulp/blob/5394ab3e20ef626b2399eb9c2a1b4601c232e58d/src/Source.php#L78-L85
train
reisraff/phulp
src/Output.php
Output.colorize
public static function colorize($string, $color) { if (isset(self::$colors[$color])) { return "\033[" . self::$colors[$color] . 'm' . $string . "\033[0m"; } return $string; }
php
public static function colorize($string, $color) { if (isset(self::$colors[$color])) { return "\033[" . self::$colors[$color] . 'm' . $string . "\033[0m"; } return $string; }
[ "public", "static", "function", "colorize", "(", "$", "string", ",", "$", "color", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "colors", "[", "$", "color", "]", ")", ")", "{", "return", "\"\\033[\"", ".", "self", "::", "$", "colors", "[",...
This method is used to colorize some text @param string $string the text to be colorized @param string $color the color to colorize your @return string
[ "This", "method", "is", "used", "to", "colorize", "some", "text" ]
5394ab3e20ef626b2399eb9c2a1b4601c232e58d
https://github.com/reisraff/phulp/blob/5394ab3e20ef626b2399eb9c2a1b4601c232e58d/src/Output.php#L93-L100
train
schmittjoh/php-stubs
res/php/mysqli/mysqli.php
mysqli.real_connect
public function real_connect($host = NULL, $username = NULL, $passwd = NULL, $dbname = NULL, $port = NULL, $socket = NULL, $flags = NULL, $link, $host = NULL, $username = NULL, $passwd = NULL, $dbname = NULL, $port = NULL, $socket = NULL, $flags = NULL) { }
php
public function real_connect($host = NULL, $username = NULL, $passwd = NULL, $dbname = NULL, $port = NULL, $socket = NULL, $flags = NULL, $link, $host = NULL, $username = NULL, $passwd = NULL, $dbname = NULL, $port = NULL, $socket = NULL, $flags = NULL) { }
[ "public", "function", "real_connect", "(", "$", "host", "=", "NULL", ",", "$", "username", "=", "NULL", ",", "$", "passwd", "=", "NULL", ",", "$", "dbname", "=", "NULL", ",", "$", "port", "=", "NULL", ",", "$", "socket", "=", "NULL", ",", "$", "f...
Opens a connection to a mysql server @param string $host @param string $username @param string $passwd @param string $dbname @param int $port @param string $socket @param int $flags @param mysqli $link @param string $host @param string $username @param string $passwd @param string $dbname @param int $port @param string $socket @param int $flags @return bool
[ "Opens", "a", "connection", "to", "a", "mysql", "server" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/mysqli/mysqli.php#L528-L530
train
schmittjoh/php-stubs
res/php/mysqli/mysqli.php
mysqli.ssl_set
public function ssl_set($key, $cert, $ca, $capath, $cipher, $link, $key, $cert, $ca, $capath, $cipher) { }
php
public function ssl_set($key, $cert, $ca, $capath, $cipher, $link, $key, $cert, $ca, $capath, $cipher) { }
[ "public", "function", "ssl_set", "(", "$", "key", ",", "$", "cert", ",", "$", "ca", ",", "$", "capath", ",", "$", "cipher", ",", "$", "link", ",", "$", "key", ",", "$", "cert", ",", "$", "ca", ",", "$", "capath", ",", "$", "cipher", ")", "{",...
Used for establishing secure connections using SSL @param string $key @param string $cert @param string $ca @param string $capath @param string $cipher @param mysqli $link @param string $key @param string $cert @param string $ca @param string $capath @param string $cipher @return bool This function always returns true value. If SSL setup is incorrect will return an error when you attempt to connect.
[ "Used", "for", "establishing", "secure", "connections", "using", "SSL" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/mysqli/mysqli.php#L690-L692
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.arc
public function arc($x, $y, $radius, $angle1, $angle2, $context, $x, $y, $radius, $angle1, $angle2) { }
php
public function arc($x, $y, $radius, $angle1, $angle2, $context, $x, $y, $radius, $angle1, $angle2) { }
[ "public", "function", "arc", "(", "$", "x", ",", "$", "y", ",", "$", "radius", ",", "$", "angle1", ",", "$", "angle2", ",", "$", "context", ",", "$", "x", ",", "$", "y", ",", "$", "radius", ",", "$", "angle1", ",", "$", "angle2", ")", "{", ...
Adds a circular arc @param float $x @param float $y @param float $radius @param float $angle1 @param float $angle2 @param CairoContext $context @param float $x @param float $y @param float $radius @param float $angle1 @param float $angle2 @return void
[ "Adds", "a", "circular", "arc" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L45-L47
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.arcNegative
public function arcNegative($x, $y, $radius, $angle1, $angle2, $context, $x, $y, $radius, $angle1, $angle2) { }
php
public function arcNegative($x, $y, $radius, $angle1, $angle2, $context, $x, $y, $radius, $angle1, $angle2) { }
[ "public", "function", "arcNegative", "(", "$", "x", ",", "$", "y", ",", "$", "radius", ",", "$", "angle1", ",", "$", "angle2", ",", "$", "context", ",", "$", "x", ",", "$", "y", ",", "$", "radius", ",", "$", "angle1", ",", "$", "angle2", ")", ...
Adds a negative arc @param float $x @param float $y @param float $radius @param float $angle1 @param float $angle2 @param CairoContext $context @param float $x @param float $y @param float $radius @param float $angle1 @param float $angle2 @return void
[ "Adds", "a", "negative", "arc" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L66-L68
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.curveTo
public function curveTo($x1, $y1, $x2, $y2, $x3, $y3, $context, $x1, $y1, $x2, $y2, $x3, $y3) { }
php
public function curveTo($x1, $y1, $x2, $y2, $x3, $y3, $context, $x1, $y1, $x2, $y2, $x3, $y3) { }
[ "public", "function", "curveTo", "(", "$", "x1", ",", "$", "y1", ",", "$", "x2", ",", "$", "y2", ",", "$", "x3", ",", "$", "y3", ",", "$", "context", ",", "$", "x1", ",", "$", "y1", ",", "$", "x2", ",", "$", "y2", ",", "$", "x3", ",", "...
Adds a curve @param float $x1 @param float $y1 @param float $x2 @param float $y2 @param float $x3 @param float $y3 @param CairoContext $context @param float $x1 @param float $y1 @param float $x2 @param float $y2 @param float $x3 @param float $y3 @return void
[ "Adds", "a", "curve" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L177-L179
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.maskSurface
public function maskSurface($surface, $x = NULL, $y = NULL, $context, $surface, $x = NULL, $y = NULL) { }
php
public function maskSurface($surface, $x = NULL, $y = NULL, $context, $surface, $x = NULL, $y = NULL) { }
[ "public", "function", "maskSurface", "(", "$", "surface", ",", "$", "x", "=", "NULL", ",", "$", "y", "=", "NULL", ",", "$", "context", ",", "$", "surface", ",", "$", "x", "=", "NULL", ",", "$", "y", "=", "NULL", ")", "{", "}" ]
The maskSurface purpose @param string $surface @param string $x @param string $y @param CairoContext $context @param CairoSurface $surface @param string $x @param string $y @return void Description...
[ "The", "maskSurface", "purpose" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L570-L572
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.rectangle
public function rectangle($x, $y, $width, $height, $context, $x, $y, $width, $height) { }
php
public function rectangle($x, $y, $width, $height, $context, $x, $y, $width, $height) { }
[ "public", "function", "rectangle", "(", "$", "x", ",", "$", "y", ",", "$", "width", ",", "$", "height", ",", "$", "context", ",", "$", "x", ",", "$", "y", ",", "$", "width", ",", "$", "height", ")", "{", "}" ]
The rectangle purpose @param string $x @param string $y @param string $width @param string $height @param CairoContext $context @param string $x @param string $y @param string $width @param string $height @return void Description...
[ "The", "rectangle", "purpose" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L707-L709
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.relCurveTo
public function relCurveTo($x1, $y1, $x2, $y2, $x3, $y3, $context, $x1, $y1, $x2, $y2, $x3, $y3) { }
php
public function relCurveTo($x1, $y1, $x2, $y2, $x3, $y3, $context, $x1, $y1, $x2, $y2, $x3, $y3) { }
[ "public", "function", "relCurveTo", "(", "$", "x1", ",", "$", "y1", ",", "$", "x2", ",", "$", "y2", ",", "$", "x3", ",", "$", "y3", ",", "$", "context", ",", "$", "x1", ",", "$", "y1", ",", "$", "x2", ",", "$", "y2", ",", "$", "x3", ",", ...
The relCurveTo purpose @param string $x1 @param string $y1 @param string $x2 @param string $y2 @param string $x3 @param string $y3 @param CairoContext $context @param string $x1 @param string $y1 @param string $x2 @param string $y2 @param string $x3 @param string $y3 @return void Description...
[ "The", "relCurveTo", "purpose" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L730-L732
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.selectFontFace
public function selectFontFace($family, $slant = NULL, $weight = NULL, $context, $family, $slant = NULL, $weight = NULL) { }
php
public function selectFontFace($family, $slant = NULL, $weight = NULL, $context, $family, $slant = NULL, $weight = NULL) { }
[ "public", "function", "selectFontFace", "(", "$", "family", ",", "$", "slant", "=", "NULL", ",", "$", "weight", "=", "NULL", ",", "$", "context", ",", "$", "family", ",", "$", "slant", "=", "NULL", ",", "$", "weight", "=", "NULL", ")", "{", "}" ]
The selectFontFace purpose @param string $family @param string $slant @param string $weight @param CairoContext $context @param string $family @param string $slant @param string $weight @return void Description...
[ "The", "selectFontFace", "purpose" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L838-L840
train
schmittjoh/php-stubs
res/php/cairo/cairocontext.php
CairoContext.setSourceSurface
public function setSourceSurface($surface, $x = NULL, $y = NULL, $context, $surface, $x = NULL, $y = NULL) { }
php
public function setSourceSurface($surface, $x = NULL, $y = NULL, $context, $surface, $x = NULL, $y = NULL) { }
[ "public", "function", "setSourceSurface", "(", "$", "surface", ",", "$", "x", "=", "NULL", ",", "$", "y", "=", "NULL", ",", "$", "context", ",", "$", "surface", ",", "$", "x", "=", "NULL", ",", "$", "y", "=", "NULL", ")", "{", "}" ]
The setSourceSurface purpose @param string $surface @param string $x @param string $y @param CairoContext $context @param CairoSurface $surface @param string $x @param string $y @return void Description...
[ "The", "setSourceSurface", "purpose" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/cairo/cairocontext.php#L1083-L1085
train
schmittjoh/php-stubs
res/php/intl/dateformatter.php
IntlDateFormatter.create
public function create($locale, $datetype, $timetype, $timezone = NULL, $calendar = NULL, $pattern = NULL, $locale, $datetype, $timetype, $timezone = NULL, $calendar = NULL, $pattern = NULL) { }
php
public function create($locale, $datetype, $timetype, $timezone = NULL, $calendar = NULL, $pattern = NULL, $locale, $datetype, $timetype, $timezone = NULL, $calendar = NULL, $pattern = NULL) { }
[ "public", "function", "create", "(", "$", "locale", ",", "$", "datetype", ",", "$", "timetype", ",", "$", "timezone", "=", "NULL", ",", "$", "calendar", "=", "NULL", ",", "$", "pattern", "=", "NULL", ",", "$", "locale", ",", "$", "datetype", ",", "...
Create a date formatter @param string $locale @param int $datetype @param int $timetype @param string $timezone @param int $calendar @param string $pattern @param string $locale @param int $datetype @param int $timetype @param string $timezone @param int $calendar @param string $pattern @return IntlDateFormatter
[ "Create", "a", "date", "formatter" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/intl/dateformatter.php#L32-L34
train
schmittjoh/php-stubs
res/php/mysqli/mysqli_stmt.php
mysqli_stmt.bind_param
public function bind_param($types, &$var1, &$_ = NULL, $stmt, $types, &$var1, &$_ = NULL) { }
php
public function bind_param($types, &$var1, &$_ = NULL, $stmt, $types, &$var1, &$_ = NULL) { }
[ "public", "function", "bind_param", "(", "$", "types", ",", "&", "$", "var1", ",", "&", "$", "_", "=", "NULL", ",", "$", "stmt", ",", "$", "types", ",", "&", "$", "var1", ",", "&", "$", "_", "=", "NULL", ")", "{", "}" ]
Binds variables to a prepared statement as parameters @phpstub-variable-parameters @param string $types @param mixed $var1 @param mixed $_ @param mysqli_stmt $stmt @param string $types @param mixed $var1 @param mixed $_ @return bool
[ "Binds", "variables", "to", "a", "prepared", "statement", "as", "parameters" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/mysqli/mysqli_stmt.php#L157-L159
train
schmittjoh/php-stubs
res/php/haru/harudoc.php
HaruDoc.setInfoDateAttr
public function setInfoDateAttr($type, $year, $month, $day, $hour, $min, $sec, $ind, $off_hour, $off_min) { }
php
public function setInfoDateAttr($type, $year, $month, $day, $hour, $min, $sec, $ind, $off_hour, $off_min) { }
[ "public", "function", "setInfoDateAttr", "(", "$", "type", ",", "$", "year", ",", "$", "month", ",", "$", "day", ",", "$", "hour", ",", "$", "min", ",", "$", "sec", ",", "$", "ind", ",", "$", "off_hour", ",", "$", "off_min", ")", "{", "}" ]
Set the datetime info attributes of the document @param int $type @param int $year @param int $month @param int $day @param int $hour @param int $min @param int $sec @param string $ind @param int $off_hour @param int $off_min @return bool Returns true on success.
[ "Set", "the", "datetime", "info", "attributes", "of", "the", "document" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/haru/harudoc.php#L342-L344
train
schmittjoh/php-stubs
src/PHPStubs/TypeRefiner.php
TypeRefiner.inferArrayElementTypeFromDesc
private function inferArrayElementTypeFromDesc($desc) { if (preg_match_all('#array\s+of\s+``([^`]+)``#', $desc, $matches)) { $types = array(); foreach ($matches[1] as $m) { $types[] = $m.'[]'; } return implode('|', $types); } return null; }
php
private function inferArrayElementTypeFromDesc($desc) { if (preg_match_all('#array\s+of\s+``([^`]+)``#', $desc, $matches)) { $types = array(); foreach ($matches[1] as $m) { $types[] = $m.'[]'; } return implode('|', $types); } return null; }
[ "private", "function", "inferArrayElementTypeFromDesc", "(", "$", "desc", ")", "{", "if", "(", "preg_match_all", "(", "'#array\\s+of\\s+``([^`]+)``#'", ",", "$", "desc", ",", "$", "matches", ")", ")", "{", "$", "types", "=", "array", "(", ")", ";", "foreach"...
Infers the element type of an array from the description. @param string $desc @return string|null
[ "Infers", "the", "element", "type", "of", "an", "array", "from", "the", "description", "." ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/src/PHPStubs/TypeRefiner.php#L289-L301
train
schmittjoh/php-stubs
res/php/datetime/datetimezone.php
DateTimeZone.getTransitions
public function getTransitions($timestamp_begin = NULL, $timestamp_end = NULL, $object, $timestamp_begin = NULL, $timestamp_end = NULL) { }
php
public function getTransitions($timestamp_begin = NULL, $timestamp_end = NULL, $object, $timestamp_begin = NULL, $timestamp_end = NULL) { }
[ "public", "function", "getTransitions", "(", "$", "timestamp_begin", "=", "NULL", ",", "$", "timestamp_end", "=", "NULL", ",", "$", "object", ",", "$", "timestamp_begin", "=", "NULL", ",", "$", "timestamp_end", "=", "NULL", ")", "{", "}" ]
Returns all transitions for the timezone @param int $timestamp_begin @param int $timestamp_end @param DateTimeZone $object @param int $timestamp_begin @param int $timestamp_end @return array Returns numerically indexed array containing associative array with all transitions on success.
[ "Returns", "all", "transitions", "for", "the", "timezone" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/datetime/datetimezone.php#L80-L82
train
schmittjoh/php-stubs
res/php/memcache/memcache.php
Memcache.addServer
public function addServer($host, $port = 11211, $persistent = NULL, $weight = NULL, $timeout = NULL, $retry_interval = NULL, $status = NULL, $failure_callback = NULL, $timeoutms = NULL) { }
php
public function addServer($host, $port = 11211, $persistent = NULL, $weight = NULL, $timeout = NULL, $retry_interval = NULL, $status = NULL, $failure_callback = NULL, $timeoutms = NULL) { }
[ "public", "function", "addServer", "(", "$", "host", ",", "$", "port", "=", "11211", ",", "$", "persistent", "=", "NULL", ",", "$", "weight", "=", "NULL", ",", "$", "timeout", "=", "NULL", ",", "$", "retry_interval", "=", "NULL", ",", "$", "status", ...
Add a memcached server to connection pool @param string $host @param int $port @param bool $persistent @param int $weight @param int $timeout @param int $retry_interval @param bool $status @param callable $failure_callback @param int $timeoutms @return bool
[ "Add", "a", "memcached", "server", "to", "connection", "pool" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/memcache/memcache.php#L37-L39
train
schmittjoh/php-stubs
res/php/memcache/memcache.php
Memcache.setServerParams
public function setServerParams($host, $port = 11211, $timeout = NULL, $retry_interval = false, $status = NULL, $failure_callback = NULL) { }
php
public function setServerParams($host, $port = 11211, $timeout = NULL, $retry_interval = false, $status = NULL, $failure_callback = NULL) { }
[ "public", "function", "setServerParams", "(", "$", "host", ",", "$", "port", "=", "11211", ",", "$", "timeout", "=", "NULL", ",", "$", "retry_interval", "=", "false", ",", "$", "status", "=", "NULL", ",", "$", "failure_callback", "=", "NULL", ")", "{",...
Changes server parameters and status at runtime @param string $host @param int $port @param int $timeout @param int $retry_interval @param bool $status @param callable $failure_callback @return bool
[ "Changes", "server", "parameters", "and", "status", "at", "runtime" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/memcache/memcache.php#L238-L240
train
schmittjoh/php-stubs
res/php/datetime/datetime.php
DateTime.setTime
public function setTime($hour, $minute, $second = false, $object, $hour, $minute, $second = false) { }
php
public function setTime($hour, $minute, $second = false, $object, $hour, $minute, $second = false) { }
[ "public", "function", "setTime", "(", "$", "hour", ",", "$", "minute", ",", "$", "second", "=", "false", ",", "$", "object", ",", "$", "hour", ",", "$", "minute", ",", "$", "second", "=", "false", ")", "{", "}" ]
Sets the time @param int $hour @param int $minute @param int $second @param DateTime $object @param int $hour @param int $minute @param int $second @return DateTime
[ "Sets", "the", "time" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/datetime/datetime.php#L215-L217
train
schmittjoh/php-stubs
src/PHPStubs/Generator.php
Generator.getConstantValue
private function getConstantValue(\CG\Generator\PhpConstant $constant) { if (null !== $value = $constant->getValue()) { return $value; } if ($constant->hasAttribute('type')) { switch ($constant->getAttribute('type')) { case 'int': case 'integer': return 0; case 'double': case 'float': return 0.1; case 'bool': case 'boolean': return true; case 'string': return 'dummy'; case 'int/float/bool/enum': case '': return null; default: throw new \RuntimeException(sprintf('Unknown constant type "%s".', $constant->getAttribute('type'))); } } return null; }
php
private function getConstantValue(\CG\Generator\PhpConstant $constant) { if (null !== $value = $constant->getValue()) { return $value; } if ($constant->hasAttribute('type')) { switch ($constant->getAttribute('type')) { case 'int': case 'integer': return 0; case 'double': case 'float': return 0.1; case 'bool': case 'boolean': return true; case 'string': return 'dummy'; case 'int/float/bool/enum': case '': return null; default: throw new \RuntimeException(sprintf('Unknown constant type "%s".', $constant->getAttribute('type'))); } } return null; }
[ "private", "function", "getConstantValue", "(", "\\", "CG", "\\", "Generator", "\\", "PhpConstant", "$", "constant", ")", "{", "if", "(", "null", "!==", "$", "value", "=", "$", "constant", "->", "getValue", "(", ")", ")", "{", "return", "$", "value", "...
Returns the value of a constant, or makes up an arbitrary value that matches the type of the constant. The reasoning behind generating an arbitrary value is that for type inference, the actual value is not important as long as we can infer the correct type. For other types of data flow analysis it might be interesting though; we can re-visit it then. @param \CG\Generator\PhpConstant $constant @return int|real|boolean|string|null
[ "Returns", "the", "value", "of", "a", "constant", "or", "makes", "up", "an", "arbitrary", "value", "that", "matches", "the", "type", "of", "the", "constant", "." ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/src/PHPStubs/Generator.php#L111-L144
train
schmittjoh/php-stubs
res/php/ming/swfshape.php
SWFShape.addFill
public function addFill($red, $green, $blue, $alpha = 255, $bitmap, $flags = NULL, $gradient, $flags = NULL) { }
php
public function addFill($red, $green, $blue, $alpha = 255, $bitmap, $flags = NULL, $gradient, $flags = NULL) { }
[ "public", "function", "addFill", "(", "$", "red", ",", "$", "green", ",", "$", "blue", ",", "$", "alpha", "=", "255", ",", "$", "bitmap", ",", "$", "flags", "=", "NULL", ",", "$", "gradient", ",", "$", "flags", "=", "NULL", ")", "{", "}" ]
Adds a solid fill to the shape @param int $red @param int $green @param int $blue @param int $alpha @param SWFBitmap $bitmap @param int $flags @param SWFGradient $gradient @param int $flags @return SWFFill
[ "Adds", "a", "solid", "fill", "to", "the", "shape" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/ming/swfshape.php#L27-L29
train
schmittjoh/php-stubs
res/php/tidy/tidy.php
tidy.parseFile
public function parseFile($filename, $config = NULL, $encoding = NULL, $use_include_path = false, $filename, $config = NULL, $encoding = NULL, $use_include_path = false) { }
php
public function parseFile($filename, $config = NULL, $encoding = NULL, $use_include_path = false, $filename, $config = NULL, $encoding = NULL, $use_include_path = false) { }
[ "public", "function", "parseFile", "(", "$", "filename", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", "NULL", ",", "$", "use_include_path", "=", "false", ",", "$", "filename", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", ...
Parse markup in file or URI @param string $filename @param mixed $config @param string $encoding @param bool $use_include_path @param string $filename @param mixed $config @param string $encoding @param bool $use_include_path @return tidy
[ "Parse", "markup", "in", "file", "or", "URI" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/tidy/tidy.php#L196-L198
train
schmittjoh/php-stubs
res/php/tidy/tidy.php
tidy.parseString
public function parseString($input, $config = NULL, $encoding = NULL, $input, $config = NULL, $encoding = NULL) { }
php
public function parseString($input, $config = NULL, $encoding = NULL, $input, $config = NULL, $encoding = NULL) { }
[ "public", "function", "parseString", "(", "$", "input", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", "NULL", ",", "$", "input", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", "NULL", ")", "{", "}" ]
Parse a document stored in a string @param string $input @param mixed $config @param string $encoding @param string $input @param mixed $config @param string $encoding @return tidy Returns a new ``tidy`` instance.
[ "Parse", "a", "document", "stored", "in", "a", "string" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/tidy/tidy.php#L212-L214
train
schmittjoh/php-stubs
res/php/tidy/tidy.php
tidy.repairFile
public function repairFile($filename, $config = NULL, $encoding = NULL, $use_include_path = false, $filename, $config = NULL, $encoding = NULL, $use_include_path = false) { }
php
public function repairFile($filename, $config = NULL, $encoding = NULL, $use_include_path = false, $filename, $config = NULL, $encoding = NULL, $use_include_path = false) { }
[ "public", "function", "repairFile", "(", "$", "filename", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", "NULL", ",", "$", "use_include_path", "=", "false", ",", "$", "filename", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", ...
Repair a file and return it as a string @param string $filename @param mixed $config @param string $encoding @param bool $use_include_path @param string $filename @param mixed $config @param string $encoding @param bool $use_include_path @return string Returns the repaired contents as a string.
[ "Repair", "a", "file", "and", "return", "it", "as", "a", "string" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/tidy/tidy.php#L230-L232
train
schmittjoh/php-stubs
res/php/tidy/tidy.php
tidy.repairString
public function repairString($data, $config = NULL, $encoding = NULL, $data, $config = NULL, $encoding = NULL) { }
php
public function repairString($data, $config = NULL, $encoding = NULL, $data, $config = NULL, $encoding = NULL) { }
[ "public", "function", "repairString", "(", "$", "data", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", "NULL", ",", "$", "data", ",", "$", "config", "=", "NULL", ",", "$", "encoding", "=", "NULL", ")", "{", "}" ]
Repair a string using an optionally provided configuration file @param string $data @param mixed $config @param string $encoding @param string $data @param mixed $config @param string $encoding @return string Returns the repaired string.
[ "Repair", "a", "string", "using", "an", "optionally", "provided", "configuration", "file" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/tidy/tidy.php#L246-L248
train
schmittjoh/php-stubs
res/php/intl/locale.php
Locale.lookup
public function lookup($langtag, $locale, $canonicalize = false, $default = NULL, $langtag, $locale, $canonicalize = false, $default = NULL) { }
php
public function lookup($langtag, $locale, $canonicalize = false, $default = NULL, $langtag, $locale, $canonicalize = false, $default = NULL) { }
[ "public", "function", "lookup", "(", "$", "langtag", ",", "$", "locale", ",", "$", "canonicalize", "=", "false", ",", "$", "default", "=", "NULL", ",", "$", "langtag", ",", "$", "locale", ",", "$", "canonicalize", "=", "false", ",", "$", "default", "...
Searches the language tag list for the best match to the language @param array $langtag @param string $locale @param bool $canonicalize @param string $default @param array $langtag @param string $locale @param bool $canonicalize @param string $default @return string The closest matching language tag or default value.
[ "Searches", "the", "language", "tag", "list", "for", "the", "best", "match", "to", "the", "language" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/intl/locale.php#L215-L217
train
schmittjoh/php-stubs
res/php/intl/numberformatter.php
NumberFormatter.parse
public function parse($value, $type = NULL, &$position = NULL, $fmt, $value, $type = NULL, &$position = NULL) { }
php
public function parse($value, $type = NULL, &$position = NULL, $fmt, $value, $type = NULL, &$position = NULL) { }
[ "public", "function", "parse", "(", "$", "value", ",", "$", "type", "=", "NULL", ",", "&", "$", "position", "=", "NULL", ",", "$", "fmt", ",", "$", "value", ",", "$", "type", "=", "NULL", ",", "&", "$", "position", "=", "NULL", ")", "{", "}" ]
Parse a number @param string $value @param int $type @param int $position @param NumberFormatter $fmt @param string $value @param int $type @param int $position @return mixed The value of the parsed number or false on error.
[ "Parse", "a", "number" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/intl/numberformatter.php#L224-L226
train
schmittjoh/php-stubs
res/php/intl/numberformatter.php
NumberFormatter.parseCurrency
public function parseCurrency($value, &$currency, &$position = NULL, $fmt, $value, &$currency, &$position = NULL) { }
php
public function parseCurrency($value, &$currency, &$position = NULL, $fmt, $value, &$currency, &$position = NULL) { }
[ "public", "function", "parseCurrency", "(", "$", "value", ",", "&", "$", "currency", ",", "&", "$", "position", "=", "NULL", ",", "$", "fmt", ",", "$", "value", ",", "&", "$", "currency", ",", "&", "$", "position", "=", "NULL", ")", "{", "}" ]
Parse a currency number @param string $value @param string $currency @param int $position @param NumberFormatter $fmt @param string $value @param string $currency @param int $position @return float The parsed numeric value or false on error.
[ "Parse", "a", "currency", "number" ]
df0ec337be4baabc76dcdf696855df061f84306d
https://github.com/schmittjoh/php-stubs/blob/df0ec337be4baabc76dcdf696855df061f84306d/res/php/intl/numberformatter.php#L241-L243
train
andreausu/CodiceFiscale
src/CodiceFiscale/Checker.php
Checker.resetProperties
private function resetProperties() { $this->isValid = false; $this->sex = null; $this->countryBirth = null; $this->dayBirth = null; $this->monthBirth = null; $this->yearBirth = null; $this->error = null; }
php
private function resetProperties() { $this->isValid = false; $this->sex = null; $this->countryBirth = null; $this->dayBirth = null; $this->monthBirth = null; $this->yearBirth = null; $this->error = null; }
[ "private", "function", "resetProperties", "(", ")", "{", "$", "this", "->", "isValid", "=", "false", ";", "$", "this", "->", "sex", "=", "null", ";", "$", "this", "->", "countryBirth", "=", "null", ";", "$", "this", "->", "dayBirth", "=", "null", ";"...
Reset Class Properties @return void
[ "Reset", "Class", "Properties" ]
92a9a9accd388744813043683cff5652838956dc
https://github.com/andreausu/CodiceFiscale/blob/92a9a9accd388744813043683cff5652838956dc/src/CodiceFiscale/Checker.php#L268-L277
train
sheadawson/silverstripe-quickaddnew
code/extensions/QuickAddNewExtension.php
QuickAddNewExtension.useAddNew
public function useAddNew( $class, $sourceCallback, FieldList $fields = null, RequiredFields $required = null, $isFrontend = false ) { if (!is_callable($sourceCallback)) { throw new Exception( 'the useAddNew method must be passed a callable $sourceCallback parameter, ' . gettype($sourceCallback) . ' passed.' ); } // if the user can't create this object type, don't modify the form if (!singleton($class)->canCreate()) { return $this->owner; } Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(QUICKADDNEW_MODULE . '/javascript/quickaddnew.js'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::css(QUICKADDNEW_MODULE . '/css/quickaddnew.css'); Requirements::add_i18n_javascript(QUICKADDNEW_MODULE . '/javascript/lang'); if (!$fields) { if (singleton($class)->hasMethod('getAddNewFields')) { $fields = singleton($class)->getAddNewFields(); } else { $fields = singleton($class)->getCMSFields(); } } if (!$required) { if (singleton($class)->hasMethod('getAddNewValidator')) { $required = singleton($class)->getAddNewValidator(); } } $this->owner->addExtraClass('quickaddnew-field'); $this->addNewEnabled = true; $this->sourceCallback = $sourceCallback; $this->isFrontend = $isFrontend; $this->addNewClass = $class; $this->addNewFields = $fields; $this->addNewRequiredFields = $required; return $this->owner; }
php
public function useAddNew( $class, $sourceCallback, FieldList $fields = null, RequiredFields $required = null, $isFrontend = false ) { if (!is_callable($sourceCallback)) { throw new Exception( 'the useAddNew method must be passed a callable $sourceCallback parameter, ' . gettype($sourceCallback) . ' passed.' ); } // if the user can't create this object type, don't modify the form if (!singleton($class)->canCreate()) { return $this->owner; } Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(QUICKADDNEW_MODULE . '/javascript/quickaddnew.js'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::css(QUICKADDNEW_MODULE . '/css/quickaddnew.css'); Requirements::add_i18n_javascript(QUICKADDNEW_MODULE . '/javascript/lang'); if (!$fields) { if (singleton($class)->hasMethod('getAddNewFields')) { $fields = singleton($class)->getAddNewFields(); } else { $fields = singleton($class)->getCMSFields(); } } if (!$required) { if (singleton($class)->hasMethod('getAddNewValidator')) { $required = singleton($class)->getAddNewValidator(); } } $this->owner->addExtraClass('quickaddnew-field'); $this->addNewEnabled = true; $this->sourceCallback = $sourceCallback; $this->isFrontend = $isFrontend; $this->addNewClass = $class; $this->addNewFields = $fields; $this->addNewRequiredFields = $required; return $this->owner; }
[ "public", "function", "useAddNew", "(", "$", "class", ",", "$", "sourceCallback", ",", "FieldList", "$", "fields", "=", "null", ",", "RequiredFields", "$", "required", "=", "null", ",", "$", "isFrontend", "=", "false", ")", "{", "if", "(", "!", "is_calla...
Tell this form field to apply the add new UI and fucntionality @param string $class - the class name of the object being managed on the relationship @param Function $sourceCallback - the function called to repopulate the field's source array @param FieldList $fields - Fields to create the object via dialog form - defaults to the object's getAddNewFields() method @param RequiredFields $required - to create the validator for the dialog form @param Boolean $isFrontend - If this is set to true, the css classes for the CMS ui will not be set of the form elements this also opens the opportunity to manipulate the form for Frontend uses via an extension @return FormField $this->owner
[ "Tell", "this", "form", "field", "to", "apply", "the", "add", "new", "UI", "and", "fucntionality" ]
fb969e1707954c85bd433a35b43dac981b774f45
https://github.com/sheadawson/silverstripe-quickaddnew/blob/fb969e1707954c85bd433a35b43dac981b774f45/code/extensions/QuickAddNewExtension.php#L63-L112
train
sheadawson/silverstripe-quickaddnew
code/extensions/QuickAddNewExtension.php
QuickAddNewExtension.AddNewForm
public function AddNewForm() { $action = FormAction::create('doAddNew', _t('QUICKADDNEW.Add', 'Add'))->setUseButtonTag('true'); if (!$this->isFrontend) { $action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'); } $actions = FieldList::create($action); $form = Form::create($this->owner, 'AddNewForm', $this->addNewFields, $actions, $this->addNewRequiredFields); $this->owner->extend('updateQuickAddNewForm', $form); return $form; }
php
public function AddNewForm() { $action = FormAction::create('doAddNew', _t('QUICKADDNEW.Add', 'Add'))->setUseButtonTag('true'); if (!$this->isFrontend) { $action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'); } $actions = FieldList::create($action); $form = Form::create($this->owner, 'AddNewForm', $this->addNewFields, $actions, $this->addNewRequiredFields); $this->owner->extend('updateQuickAddNewForm', $form); return $form; }
[ "public", "function", "AddNewForm", "(", ")", "{", "$", "action", "=", "FormAction", "::", "create", "(", "'doAddNew'", ",", "_t", "(", "'QUICKADDNEW.Add'", ",", "'Add'", ")", ")", "->", "setUseButtonTag", "(", "'true'", ")", ";", "if", "(", "!", "$", ...
The AddNewForm for the dialog window @return Form
[ "The", "AddNewForm", "for", "the", "dialog", "window" ]
fb969e1707954c85bd433a35b43dac981b774f45
https://github.com/sheadawson/silverstripe-quickaddnew/blob/fb969e1707954c85bd433a35b43dac981b774f45/code/extensions/QuickAddNewExtension.php#L147-L161
train
sheadawson/silverstripe-quickaddnew
code/extensions/QuickAddNewExtension.php
QuickAddNewExtension.doAddNew
public function doAddNew($data, $form) { $obj = Object::create($this->addNewClass); if (!$obj->canCreate()) { return Security::permissionFailure(Controller::curr(), "You don't have permission to create this object"); } $form->saveInto($obj); try { $obj->write(); } catch (Exception $e) { $form->setMessage($e->getMessage(), 'error'); return $form->forTemplate(); } $callback = $this->sourceCallback; $items = $callback($obj); $this->owner->setSource($items); // if this field is a multiselect field, we add the new Object ID to the existing // options that are selected on the field then set that as the value // otherwise we just set the new Object ID as the value if (isset($data['existing'])) { $existing = $data['existing']; $value = explode(',', $existing); $value[] = $obj->ID; } else { $value = $obj->ID; } $this->owner->setValue($value); // NOTE(Jake): Below line causes cyclic issues, I assume it's not necessary. //$this->owner->setForm($form); return $this->owner->FieldHolder(); }
php
public function doAddNew($data, $form) { $obj = Object::create($this->addNewClass); if (!$obj->canCreate()) { return Security::permissionFailure(Controller::curr(), "You don't have permission to create this object"); } $form->saveInto($obj); try { $obj->write(); } catch (Exception $e) { $form->setMessage($e->getMessage(), 'error'); return $form->forTemplate(); } $callback = $this->sourceCallback; $items = $callback($obj); $this->owner->setSource($items); // if this field is a multiselect field, we add the new Object ID to the existing // options that are selected on the field then set that as the value // otherwise we just set the new Object ID as the value if (isset($data['existing'])) { $existing = $data['existing']; $value = explode(',', $existing); $value[] = $obj->ID; } else { $value = $obj->ID; } $this->owner->setValue($value); // NOTE(Jake): Below line causes cyclic issues, I assume it's not necessary. //$this->owner->setForm($form); return $this->owner->FieldHolder(); }
[ "public", "function", "doAddNew", "(", "$", "data", ",", "$", "form", ")", "{", "$", "obj", "=", "Object", "::", "create", "(", "$", "this", "->", "addNewClass", ")", ";", "if", "(", "!", "$", "obj", "->", "canCreate", "(", ")", ")", "{", "return...
Handles adding the new object Returns the updated FieldHolder of this form to replace the existing one @return string
[ "Handles", "adding", "the", "new", "object", "Returns", "the", "updated", "FieldHolder", "of", "this", "form", "to", "replace", "the", "existing", "one" ]
fb969e1707954c85bd433a35b43dac981b774f45
https://github.com/sheadawson/silverstripe-quickaddnew/blob/fb969e1707954c85bd433a35b43dac981b774f45/code/extensions/QuickAddNewExtension.php#L181-L215
train
gizburdt/cuztom
src/Fields/Field.php
Field.output
public function output($value = null) { $value = is_null($value) ? $this->value : $value; return $this->isRepeatable() ? $this->outputRepeatable().$this->getExplanation() : $this->outputInput($value).$this->getExplanation(); }
php
public function output($value = null) { $value = is_null($value) ? $this->value : $value; return $this->isRepeatable() ? $this->outputRepeatable().$this->getExplanation() : $this->outputInput($value).$this->getExplanation(); }
[ "public", "function", "output", "(", "$", "value", "=", "null", ")", "{", "$", "value", "=", "is_null", "(", "$", "value", ")", "?", "$", "this", "->", "value", ":", "$", "value", ";", "return", "$", "this", "->", "isRepeatable", "(", ")", "?", "...
Output based on type. @param string|array $value @param string $value @return string
[ "Output", "based", "on", "type", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L129-L136
train
gizburdt/cuztom
src/Fields/Field.php
Field.outputInput
public function outputInput($value = null, $view = null) { $view = $view ? $view : $this->getView(); return Cuztom::view('fields/'.$view, [ 'field' => $this, 'value' => $value, ]); }
php
public function outputInput($value = null, $view = null) { $view = $view ? $view : $this->getView(); return Cuztom::view('fields/'.$view, [ 'field' => $this, 'value' => $value, ]); }
[ "public", "function", "outputInput", "(", "$", "value", "=", "null", ",", "$", "view", "=", "null", ")", "{", "$", "view", "=", "$", "view", "?", "$", "view", ":", "$", "this", "->", "getView", "(", ")", ";", "return", "Cuztom", "::", "view", "("...
Output field. @param string|array $value @param string $view @return string
[ "Output", "field", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L145-L153
train
gizburdt/cuztom
src/Fields/Field.php
Field.save
public function save($object, $values) { $value = isset($values[$this->id]) ? apply_filters('cuztom_field_save_value', $this->parseValue($values[$this->id]), $this) : false; // Do do_action('cuztom_field_save', $this); // Save to respective content-type switch ($this->metaType) { case 'user': return (bool) update_user_meta($object, $this->id, $value); case 'term': return (bool) update_term_meta($object, $this->id, $value); case 'post': return (bool) update_post_meta($object, $this->id, $value); } // Default return false; }
php
public function save($object, $values) { $value = isset($values[$this->id]) ? apply_filters('cuztom_field_save_value', $this->parseValue($values[$this->id]), $this) : false; // Do do_action('cuztom_field_save', $this); // Save to respective content-type switch ($this->metaType) { case 'user': return (bool) update_user_meta($object, $this->id, $value); case 'term': return (bool) update_term_meta($object, $this->id, $value); case 'post': return (bool) update_post_meta($object, $this->id, $value); } // Default return false; }
[ "public", "function", "save", "(", "$", "object", ",", "$", "values", ")", "{", "$", "value", "=", "isset", "(", "$", "values", "[", "$", "this", "->", "id", "]", ")", "?", "apply_filters", "(", "'cuztom_field_save_value'", ",", "$", "this", "->", "p...
Save meta. @param int $object @param mixed $value @return bool
[ "Save", "meta", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L199-L220
train
gizburdt/cuztom
src/Fields/Field.php
Field.getId
public function getId($extra = null) { $id = $this->beforeId.$this->id.$this->afterId; if (! Cuztom::isEmpty($extra)) { $id = $id.'_'.$extra; } return apply_filters('cuztom_field_id', $id, $this, $extra); }
php
public function getId($extra = null) { $id = $this->beforeId.$this->id.$this->afterId; if (! Cuztom::isEmpty($extra)) { $id = $id.'_'.$extra; } return apply_filters('cuztom_field_id', $id, $this, $extra); }
[ "public", "function", "getId", "(", "$", "extra", "=", "null", ")", "{", "$", "id", "=", "$", "this", "->", "beforeId", ".", "$", "this", "->", "id", ".", "$", "this", "->", "afterId", ";", "if", "(", "!", "Cuztom", "::", "isEmpty", "(", "$", "...
Get the complete id. @return string
[ "Get", "the", "complete", "id", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L247-L256
train
gizburdt/cuztom
src/Fields/Field.php
Field.getCssClass
public function getCssClass($extra = null) { $class = 'cuztom-input '.$this->css_class; if (! Cuztom::isEmpty($extra)) { $class = $class.' '.$extra; } return apply_filters('cuztom_field_css_class', $class, $this, $extra); }
php
public function getCssClass($extra = null) { $class = 'cuztom-input '.$this->css_class; if (! Cuztom::isEmpty($extra)) { $class = $class.' '.$extra; } return apply_filters('cuztom_field_css_class', $class, $this, $extra); }
[ "public", "function", "getCssClass", "(", "$", "extra", "=", "null", ")", "{", "$", "class", "=", "'cuztom-input '", ".", "$", "this", "->", "css_class", ";", "if", "(", "!", "Cuztom", "::", "isEmpty", "(", "$", "extra", ")", ")", "{", "$", "class", ...
Get the fields css classes. @param array $extra @return string
[ "Get", "the", "fields", "css", "classes", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L274-L283
train
gizburdt/cuztom
src/Fields/Field.php
Field.getDataAttributes
public function getDataAttributes($extra = []) { $output = ''; foreach (array_merge($this->html_attributes, $extra) as $attribute => $value) { if (! is_null($value)) { $output .= $attribute.'="'.$value.'"'; } elseif (! $value && isset($this->args[Cuztom::uglify($attribute)])) { $output .= $attribute.'="'.$this->args[Cuztom::uglify($attribute)].'"'; } } return apply_filters('cuztom_field_html_attributes', $output, $this, $extra); }
php
public function getDataAttributes($extra = []) { $output = ''; foreach (array_merge($this->html_attributes, $extra) as $attribute => $value) { if (! is_null($value)) { $output .= $attribute.'="'.$value.'"'; } elseif (! $value && isset($this->args[Cuztom::uglify($attribute)])) { $output .= $attribute.'="'.$this->args[Cuztom::uglify($attribute)].'"'; } } return apply_filters('cuztom_field_html_attributes', $output, $this, $extra); }
[ "public", "function", "getDataAttributes", "(", "$", "extra", "=", "[", "]", ")", "{", "$", "output", "=", "''", ";", "foreach", "(", "array_merge", "(", "$", "this", "->", "html_attributes", ",", "$", "extra", ")", "as", "$", "attribute", "=>", "$", ...
Outputs the fields data attributes. @param array $extra @return string
[ "Outputs", "the", "fields", "data", "attributes", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L315-L328
train
gizburdt/cuztom
src/Fields/Field.php
Field.outputColumnContent
public function outputColumnContent($id) { $meta = get_post_meta($id, $this->id, true); if (! empty($meta) && $this->isRepeatable()) { echo implode($meta, ', '); } else { echo $meta; } }
php
public function outputColumnContent($id) { $meta = get_post_meta($id, $this->id, true); if (! empty($meta) && $this->isRepeatable()) { echo implode($meta, ', '); } else { echo $meta; } }
[ "public", "function", "outputColumnContent", "(", "$", "id", ")", "{", "$", "meta", "=", "get_post_meta", "(", "$", "id", ",", "$", "this", "->", "id", ",", "true", ")", ";", "if", "(", "!", "empty", "(", "$", "meta", ")", "&&", "$", "this", "->"...
Outputs the fields column content. @param int $id
[ "Outputs", "the", "fields", "column", "content", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L335-L344
train
gizburdt/cuztom
src/Fields/Field.php
Field.substractValue
public function substractValue($values) { if (isset($values[$this->id]) && ! Cuztom::isEmpty($values[$this->id])) { if (is_array($values[$this->id])) { $value = isset($values[$this->id][0]) ? maybe_unserialize($values[$this->id][0]) : null; } else { $value = maybe_unserialize($values[$this->id]); } } else { $value = $this->default_value; } return apply_filters('cuztom_field_value', $value, $this); }
php
public function substractValue($values) { if (isset($values[$this->id]) && ! Cuztom::isEmpty($values[$this->id])) { if (is_array($values[$this->id])) { $value = isset($values[$this->id][0]) ? maybe_unserialize($values[$this->id][0]) : null; } else { $value = maybe_unserialize($values[$this->id]); } } else { $value = $this->default_value; } return apply_filters('cuztom_field_value', $value, $this); }
[ "public", "function", "substractValue", "(", "$", "values", ")", "{", "if", "(", "isset", "(", "$", "values", "[", "$", "this", "->", "id", "]", ")", "&&", "!", "Cuztom", "::", "isEmpty", "(", "$", "values", "[", "$", "this", "->", "id", "]", ")"...
Substract value of field from values array. @param array $values @return string
[ "Substract", "value", "of", "field", "from", "values", "array", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L393-L406
train
gizburdt/cuztom
src/Fields/Field.php
Field.create
public static function create($args, $values) { $type = is_array($args) ? $args['type'] : $args; $class = str_replace(' ', '', ucwords(str_replace('_', ' ', $type))); $class = "Gizburdt\\Cuztom\\Fields\\$class"; if (class_exists($class)) { $field = new $class($args, $values); Cuztom::addField($field); return $field; } return false; }
php
public static function create($args, $values) { $type = is_array($args) ? $args['type'] : $args; $class = str_replace(' ', '', ucwords(str_replace('_', ' ', $type))); $class = "Gizburdt\\Cuztom\\Fields\\$class"; if (class_exists($class)) { $field = new $class($args, $values); Cuztom::addField($field); return $field; } return false; }
[ "public", "static", "function", "create", "(", "$", "args", ",", "$", "values", ")", "{", "$", "type", "=", "is_array", "(", "$", "args", ")", "?", "$", "args", "[", "'type'", "]", ":", "$", "args", ";", "$", "class", "=", "str_replace", "(", "' ...
Creates and returns a field object. @param array $args @return object|bool
[ "Creates", "and", "returns", "a", "field", "object", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Field.php#L414-L429
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.run
public static function run() { if (! isset(self::$instance)) { self::$instance = new self(); self::$instance->setup(); self::$instance->execute(); self::$instance->hooks(); self::$instance->ajax(); } return self::$instance; }
php
public static function run() { if (! isset(self::$instance)) { self::$instance = new self(); self::$instance->setup(); self::$instance->execute(); self::$instance->hooks(); self::$instance->ajax(); } return self::$instance; }
[ "public", "static", "function", "run", "(", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "instance", ")", ")", "{", "self", "::", "$", "instance", "=", "new", "self", "(", ")", ";", "self", "::", "$", "instance", "->", "setup", "(",...
Public function to set the instance. @return object
[ "Public", "function", "to", "set", "the", "instance", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L76-L88
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.setup
private function setup() { self::$version = '3.1.7'; self::$src = dirname(__FILE__); self::$dir = dirname(dirname(__FILE__)); self::$url = $this->getCuztomUrl(self::$src); // Do do_action('cuztom_setup'); }
php
private function setup() { self::$version = '3.1.7'; self::$src = dirname(__FILE__); self::$dir = dirname(dirname(__FILE__)); self::$url = $this->getCuztomUrl(self::$src); // Do do_action('cuztom_setup'); }
[ "private", "function", "setup", "(", ")", "{", "self", "::", "$", "version", "=", "'3.1.7'", ";", "self", "::", "$", "src", "=", "dirname", "(", "__FILE__", ")", ";", "self", "::", "$", "dir", "=", "dirname", "(", "dirname", "(", "__FILE__", ")", "...
Setup all the constants.
[ "Setup", "all", "the", "constants", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L93-L102
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.registerStyles
public function registerStyles() { wp_register_style( 'cuztom-jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css', false, self::$version, 'screen' ); wp_register_style( 'cuztom', self::$url.'/assets/css/cuztom.min.css', false, self::$version, 'screen' ); // Do do_action('cuztom_register_styles'); }
php
public function registerStyles() { wp_register_style( 'cuztom-jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css', false, self::$version, 'screen' ); wp_register_style( 'cuztom', self::$url.'/assets/css/cuztom.min.css', false, self::$version, 'screen' ); // Do do_action('cuztom_register_styles'); }
[ "public", "function", "registerStyles", "(", ")", "{", "wp_register_style", "(", "'cuztom-jquery-ui'", ",", "'//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css'", ",", "false", ",", "self", "::", "$", "version", ",", "'screen'", ")", ";", "wp_regist...
Registers styles.
[ "Registers", "styles", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L145-L165
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.getCuztomUrl
public function getCuztomUrl($path = __FILE__, $url = []) { // Retun URL if defined if (defined('CUZTOM_URL')) { return CUZTOM_URL; } // Base vars $path = dirname($path); $path = str_replace('\\', '/', $path); $expath = explode('/', $path); $current = $expath[count($expath) - 1]; // Push to path array array_push($url, $current); // Check for current if (preg_match('/content|app/', $current)) { $path = ''; $directories = array_reverse($url); foreach ($directories as $dir) { if (! preg_match('/content|app/', $dir)) { $path = $path.'/'.$dir; } } return apply_filters('cuztom_url', WP_CONTENT_URL.$path); } else { return $this->getCuztomUrl($path, $url); } }
php
public function getCuztomUrl($path = __FILE__, $url = []) { // Retun URL if defined if (defined('CUZTOM_URL')) { return CUZTOM_URL; } // Base vars $path = dirname($path); $path = str_replace('\\', '/', $path); $expath = explode('/', $path); $current = $expath[count($expath) - 1]; // Push to path array array_push($url, $current); // Check for current if (preg_match('/content|app/', $current)) { $path = ''; $directories = array_reverse($url); foreach ($directories as $dir) { if (! preg_match('/content|app/', $dir)) { $path = $path.'/'.$dir; } } return apply_filters('cuztom_url', WP_CONTENT_URL.$path); } else { return $this->getCuztomUrl($path, $url); } }
[ "public", "function", "getCuztomUrl", "(", "$", "path", "=", "__FILE__", ",", "$", "url", "=", "[", "]", ")", "{", "// Retun URL if defined", "if", "(", "defined", "(", "'CUZTOM_URL'", ")", ")", "{", "return", "CUZTOM_URL", ";", "}", "// Base vars", "$", ...
Recursive method to determine the path to the Cuztom folder. @param string $path @param array $url @return string
[ "Recursive", "method", "to", "determine", "the", "path", "to", "the", "Cuztom", "folder", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L245-L276
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.getBox
public static function getBox($box) { return isset(self::$data[$box]) ? self::$data[$box] : null; }
php
public static function getBox($box) { return isset(self::$data[$box]) ? self::$data[$box] : null; }
[ "public", "static", "function", "getBox", "(", "$", "box", ")", "{", "return", "isset", "(", "self", "::", "$", "data", "[", "$", "box", "]", ")", "?", "self", "::", "$", "data", "[", "$", "box", "]", ":", "null", ";", "}" ]
Get a box from data. @param string $box @return object
[ "Get", "a", "box", "from", "data", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L284-L287
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.pluralize
public static function pluralize($string) { $specials = apply_filters('cuztom_plural', [ ['/(quiz)$/i', '$1zes'], ['/^(ox)$/i', '$1en'], ['/([m|l])ouse$/i', '$1ice'], ['/(matr|vert|ind)ix|ex$/i', '$1ices'], ['/(x|ch|ss|sh)$/i', '$1es'], ['/([^aeiouy]|qu)y$/i', '$1ies'], ['/([^aeiouy]|qu)ies$/i', '$1y'], ['/(hive)$/i', '$1s'], ['/(?:([^f])fe|([lr])f)$/i', '$1$2ves'], ['/sis$/i', 'ses'], ['/([ti])um$/i', '$1a'], ['/(buffal|tomat)o$/i', '$1oes'], ['/(bu)s$/i', '$1ses'], ['/(alias|status)$/i', '$1es'], ['/(octop|vir)us$/i', '$1i'], ['/(ax|test)is$/i', '$1es'], ['/s$/i', 's'], ['/$/', 's'], ]); $irregular = apply_filters('cuztom_irregular', [ ['move', 'moves'], ['sex', 'sexes'], ['child', 'children'], ['man', 'men'], ['person', 'people'], ]); $uncountable = apply_filters('cuztom_uncountable', [ 'sheep', 'fish', 'series', 'species', 'money', 'rice', 'information', 'equipment', 'pokemon', ]); // Save time if string in uncountable if (in_array(strtolower($string), $uncountable)) { return apply_filters('cuztom_pluralize', $string, 'uncountable'); } // Check for irregular words foreach ($irregular as $noun) { if (strtolower($string) == $noun[0]) { return apply_filters('cuztom_pluralize', ucwords($noun[1]), 'irregular'); } } // Check for plural forms foreach ($specials as $pattern) { if (preg_match($pattern[0], $string)) { return apply_filters( 'cuztom_pluralize', ucwords(preg_replace($pattern[0], $pattern[1], $string)), 'special' ); } } // Return if noting found return apply_filters('cuztom_pluralize', $string, null); }
php
public static function pluralize($string) { $specials = apply_filters('cuztom_plural', [ ['/(quiz)$/i', '$1zes'], ['/^(ox)$/i', '$1en'], ['/([m|l])ouse$/i', '$1ice'], ['/(matr|vert|ind)ix|ex$/i', '$1ices'], ['/(x|ch|ss|sh)$/i', '$1es'], ['/([^aeiouy]|qu)y$/i', '$1ies'], ['/([^aeiouy]|qu)ies$/i', '$1y'], ['/(hive)$/i', '$1s'], ['/(?:([^f])fe|([lr])f)$/i', '$1$2ves'], ['/sis$/i', 'ses'], ['/([ti])um$/i', '$1a'], ['/(buffal|tomat)o$/i', '$1oes'], ['/(bu)s$/i', '$1ses'], ['/(alias|status)$/i', '$1es'], ['/(octop|vir)us$/i', '$1i'], ['/(ax|test)is$/i', '$1es'], ['/s$/i', 's'], ['/$/', 's'], ]); $irregular = apply_filters('cuztom_irregular', [ ['move', 'moves'], ['sex', 'sexes'], ['child', 'children'], ['man', 'men'], ['person', 'people'], ]); $uncountable = apply_filters('cuztom_uncountable', [ 'sheep', 'fish', 'series', 'species', 'money', 'rice', 'information', 'equipment', 'pokemon', ]); // Save time if string in uncountable if (in_array(strtolower($string), $uncountable)) { return apply_filters('cuztom_pluralize', $string, 'uncountable'); } // Check for irregular words foreach ($irregular as $noun) { if (strtolower($string) == $noun[0]) { return apply_filters('cuztom_pluralize', ucwords($noun[1]), 'irregular'); } } // Check for plural forms foreach ($specials as $pattern) { if (preg_match($pattern[0], $string)) { return apply_filters( 'cuztom_pluralize', ucwords(preg_replace($pattern[0], $pattern[1], $string)), 'special' ); } } // Return if noting found return apply_filters('cuztom_pluralize', $string, null); }
[ "public", "static", "function", "pluralize", "(", "$", "string", ")", "{", "$", "specials", "=", "apply_filters", "(", "'cuztom_plural'", ",", "[", "[", "'/(quiz)$/i'", ",", "'$1zes'", "]", ",", "[", "'/^(ox)$/i'", ",", "'$1en'", "]", ",", "[", "'/([m|l])o...
Makes a word plural. @param string $string @return string
[ "Makes", "a", "word", "plural", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L358-L426
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.view
public static function view($view, $variables = []) { extract($variables); ob_start(); include dirname(dirname(__FILE__)).'/resources/views/'.$view.'.php'; return ob_get_clean(); }
php
public static function view($view, $variables = []) { extract($variables); ob_start(); include dirname(dirname(__FILE__)).'/resources/views/'.$view.'.php'; return ob_get_clean(); }
[ "public", "static", "function", "view", "(", "$", "view", ",", "$", "variables", "=", "[", "]", ")", "{", "extract", "(", "$", "variables", ")", ";", "ob_start", "(", ")", ";", "include", "dirname", "(", "dirname", "(", "__FILE__", ")", ")", ".", "...
Include view file. @param string $view @param array $variables
[ "Include", "view", "file", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L445-L454
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.isEmpty
public static function isEmpty($input, $result = true) { if (is_array($input) && count($input)) { foreach ($input as $value) { $result = $result && self::isEmpty($value); } return $result; } return empty($input); }
php
public static function isEmpty($input, $result = true) { if (is_array($input) && count($input)) { foreach ($input as $value) { $result = $result && self::isEmpty($value); } return $result; } return empty($input); }
[ "public", "static", "function", "isEmpty", "(", "$", "input", ",", "$", "result", "=", "true", ")", "{", "if", "(", "is_array", "(", "$", "input", ")", "&&", "count", "(", "$", "input", ")", ")", "{", "foreach", "(", "$", "input", "as", "$", "val...
Check if variable is empty. @param string|array $input @param bool $result @return bool
[ "Check", "if", "variable", "is", "empty", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L463-L474
train
gizburdt/cuztom
src/Cuztom.php
Cuztom.isReservedTerm
public static function isReservedTerm($term) { if (! in_array($term, apply_filters('cuztom_reserved_terms', self::$reserved))) { return false; } return new \WP_Error('cuztom_reserved_term_used', __('Use of a reserved term.', 'cuztom')); }
php
public static function isReservedTerm($term) { if (! in_array($term, apply_filters('cuztom_reserved_terms', self::$reserved))) { return false; } return new \WP_Error('cuztom_reserved_term_used', __('Use of a reserved term.', 'cuztom')); }
[ "public", "static", "function", "isReservedTerm", "(", "$", "term", ")", "{", "if", "(", "!", "in_array", "(", "$", "term", ",", "apply_filters", "(", "'cuztom_reserved_terms'", ",", "self", "::", "$", "reserved", ")", ")", ")", "{", "return", "false", "...
Check if the term is reserved by Wordpress. @param string $term @return bool
[ "Check", "if", "the", "term", "is", "reserved", "by", "Wordpress", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Cuztom.php#L536-L543
train
gizburdt/cuztom
src/Meta/User.php
User.saveUser
public function saveUser($id) { if (! Guard::verifyNonce('cuztom_nonce', 'cuztom_meta')) { return; } // Filter $values = apply_filters('cuztom_user_save_values', (new Request($_POST))->getAll(), $this); // Do do_action('cuztom_user_save', $this); parent::save($id, $values); }
php
public function saveUser($id) { if (! Guard::verifyNonce('cuztom_nonce', 'cuztom_meta')) { return; } // Filter $values = apply_filters('cuztom_user_save_values', (new Request($_POST))->getAll(), $this); // Do do_action('cuztom_user_save', $this); parent::save($id, $values); }
[ "public", "function", "saveUser", "(", "$", "id", ")", "{", "if", "(", "!", "Guard", "::", "verifyNonce", "(", "'cuztom_nonce'", ",", "'cuztom_meta'", ")", ")", "{", "return", ";", "}", "// Filter", "$", "values", "=", "apply_filters", "(", "'cuztom_user_s...
Hooks into the save hook for the user meta. @param int $id
[ "Hooks", "into", "the", "save", "hook", "for", "the", "user", "meta", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/User.php#L84-L97
train
gizburdt/cuztom
src/Meta/Meta.php
Meta.save
public function save($object, $values) { if (Cuztom::isEmpty($values)) { return; } // Filter $values = apply_filters('cuztom_meta_values', $values, $this); // Do do_action('cuztom_meta_save', $this); foreach ($this->data as $id => $field) { $field->save($object, $values); } }
php
public function save($object, $values) { if (Cuztom::isEmpty($values)) { return; } // Filter $values = apply_filters('cuztom_meta_values', $values, $this); // Do do_action('cuztom_meta_save', $this); foreach ($this->data as $id => $field) { $field->save($object, $values); } }
[ "public", "function", "save", "(", "$", "object", ",", "$", "values", ")", "{", "if", "(", "Cuztom", "::", "isEmpty", "(", "$", "values", ")", ")", "{", "return", ";", "}", "// Filter", "$", "values", "=", "apply_filters", "(", "'cuztom_meta_values'", ...
Normal save method to save all the fields in a metabox. @param int $object Object ID @param array $values Array of values
[ "Normal", "save", "method", "to", "save", "all", "the", "fields", "in", "a", "metabox", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Meta.php#L129-L144
train
gizburdt/cuztom
src/Meta/Meta.php
Meta.searchField
protected function searchField($search) { foreach ($this->data as $field) { if (method_exists($field, 'getField') && $find = $field->getField($search)) { return $find; } } }
php
protected function searchField($search) { foreach ($this->data as $field) { if (method_exists($field, 'getField') && $find = $field->getField($search)) { return $find; } } }
[ "protected", "function", "searchField", "(", "$", "search", ")", "{", "foreach", "(", "$", "this", "->", "data", "as", "$", "field", ")", "{", "if", "(", "method_exists", "(", "$", "field", ",", "'getField'", ")", "&&", "$", "find", "=", "$", "field"...
Search for a field. @param string $search @return
[ "Search", "for", "a", "field", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Meta.php#L165-L172
train
gizburdt/cuztom
src/Meta/Meta.php
Meta.build
public function build($fields) { $data = []; if (Cuztom::isArray($fields)) { foreach ($fields as $type => $args) { $args = Cuztom::merge($args, [ 'metaBox' => $this, 'metaType' => $this->metaType, 'object' => $this->object, 'parent' => $this->id, ]); $field = Field::create($args, $this->values); $data[$field->id] = $field; } } return $data; }
php
public function build($fields) { $data = []; if (Cuztom::isArray($fields)) { foreach ($fields as $type => $args) { $args = Cuztom::merge($args, [ 'metaBox' => $this, 'metaType' => $this->metaType, 'object' => $this->object, 'parent' => $this->id, ]); $field = Field::create($args, $this->values); $data[$field->id] = $field; } } return $data; }
[ "public", "function", "build", "(", "$", "fields", ")", "{", "$", "data", "=", "[", "]", ";", "if", "(", "Cuztom", "::", "isArray", "(", "$", "fields", ")", ")", "{", "foreach", "(", "$", "fields", "as", "$", "type", "=>", "$", "args", ")", "{"...
This method builds the complete array with the right key => value pairs. @param array $fields @return array
[ "This", "method", "builds", "the", "complete", "array", "with", "the", "right", "key", "=", ">", "value", "pairs", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Meta.php#L180-L200
train
gizburdt/cuztom
src/Support/Guard.php
Guard.verifyNonce
public static function verifyNonce($name, $value) { return isset($_POST[$name]) && wp_verify_nonce($_POST[$name], $value); }
php
public static function verifyNonce($name, $value) { return isset($_POST[$name]) && wp_verify_nonce($_POST[$name], $value); }
[ "public", "static", "function", "verifyNonce", "(", "$", "name", ",", "$", "value", ")", "{", "return", "isset", "(", "$", "_POST", "[", "$", "name", "]", ")", "&&", "wp_verify_nonce", "(", "$", "_POST", "[", "$", "name", "]", ",", "$", "value", ")...
Check nonce. @param string $name @param string $value @return bool
[ "Check", "nonce", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Support/Guard.php#L48-L51
train
gizburdt/cuztom
src/Fields/Traits/Selectable.php
Selectable.maybeShowOptionNone
public function maybeShowOptionNone() { if (isset($this->args['show_option_none']) && ! Cuztom::isEmpty($this->args['show_option_none'])) { return '<option value="-1" '.(Cuztom::isEmpty($this->value) ? 'selected="selected"' : '').'>'.$this->args['show_option_none'].'</option>'; } }
php
public function maybeShowOptionNone() { if (isset($this->args['show_option_none']) && ! Cuztom::isEmpty($this->args['show_option_none'])) { return '<option value="-1" '.(Cuztom::isEmpty($this->value) ? 'selected="selected"' : '').'>'.$this->args['show_option_none'].'</option>'; } }
[ "public", "function", "maybeShowOptionNone", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "args", "[", "'show_option_none'", "]", ")", "&&", "!", "Cuztom", "::", "isEmpty", "(", "$", "this", "->", "args", "[", "'show_option_none'", "]", ")"...
Show option none? @return string
[ "Show", "option", "none?" ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Traits/Selectable.php#L17-L22
train
gizburdt/cuztom
src/Fields/Traits/Checkables.php
Checkables.outputOption
public function outputOption($value = null, $default_value = null, $option = null) { return '<input type="'.$this->getInputType().'" name="'.$this->getName().'" id="'.$this->getId($option).'" class="'.$this->getCssClass().'" value="'.$option.'" '.$this->getDataAttributes().' '.$this->maybeChecked($value, $default_value, $option).'/>'; }
php
public function outputOption($value = null, $default_value = null, $option = null) { return '<input type="'.$this->getInputType().'" name="'.$this->getName().'" id="'.$this->getId($option).'" class="'.$this->getCssClass().'" value="'.$option.'" '.$this->getDataAttributes().' '.$this->maybeChecked($value, $default_value, $option).'/>'; }
[ "public", "function", "outputOption", "(", "$", "value", "=", "null", ",", "$", "default_value", "=", "null", ",", "$", "option", "=", "null", ")", "{", "return", "'<input\n type=\"'", ".", "$", "this", "->", "getInputType", "(", ")", ".", "'\"\...
Output option. @param string $value @param string $default_value @param string $option @return string
[ "Output", "option", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Traits/Checkables.php#L19-L29
train
gizburdt/cuztom
src/Fields/Bundle/Item.php
Item.getField
public function getField($field) { return isset($this->data[$field]) ? $this->data[$field] : null; }
php
public function getField($field) { return isset($this->data[$field]) ? $this->data[$field] : null; }
[ "public", "function", "getField", "(", "$", "field", ")", "{", "return", "isset", "(", "$", "this", "->", "data", "[", "$", "field", "]", ")", "?", "$", "this", "->", "data", "[", "$", "field", "]", ":", "null", ";", "}" ]
Return field from data. @param string $field @return object
[ "Return", "field", "from", "data", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Bundle/Item.php#L66-L69
train
gizburdt/cuztom
src/Support/Ajax.php
Ajax.setupRepeatableList
public function setupRepeatableList() { if (! Guard::verifyAjaxNonce('cuztom', 'security')) { return; } $data = []; $field = self::getField(); if (Cuztom::isArray($field->value)) { foreach ($field->value as $value) { $data[] = $field->outputInput($value); } } echo (new Response(true, $data))->toJson(); // wp die(); }
php
public function setupRepeatableList() { if (! Guard::verifyAjaxNonce('cuztom', 'security')) { return; } $data = []; $field = self::getField(); if (Cuztom::isArray($field->value)) { foreach ($field->value as $value) { $data[] = $field->outputInput($value); } } echo (new Response(true, $data))->toJson(); // wp die(); }
[ "public", "function", "setupRepeatableList", "(", ")", "{", "if", "(", "!", "Guard", "::", "verifyAjaxNonce", "(", "'cuztom'", ",", "'security'", ")", ")", "{", "return", ";", "}", "$", "data", "=", "[", "]", ";", "$", "field", "=", "self", "::", "ge...
Setup repeatable list on init. @return mixed
[ "Setup", "repeatable", "list", "on", "init", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Support/Ajax.php#L54-L73
train
gizburdt/cuztom
src/Support/Ajax.php
Ajax.setupBundleList
public function setupBundleList() { if (! Guard::verifyAjaxNonce('cuztom', 'security')) { return; } $data = []; $bundle = self::getField(); if (Cuztom::isArray($bundle->data)) { foreach ($bundle->data as $item) { $data[] = $item->output(); } } echo (new Response(true, $data))->toJson(); // wp die(); }
php
public function setupBundleList() { if (! Guard::verifyAjaxNonce('cuztom', 'security')) { return; } $data = []; $bundle = self::getField(); if (Cuztom::isArray($bundle->data)) { foreach ($bundle->data as $item) { $data[] = $item->output(); } } echo (new Response(true, $data))->toJson(); // wp die(); }
[ "public", "function", "setupBundleList", "(", ")", "{", "if", "(", "!", "Guard", "::", "verifyAjaxNonce", "(", "'cuztom'", ",", "'security'", ")", ")", "{", "return", ";", "}", "$", "data", "=", "[", "]", ";", "$", "bundle", "=", "self", "::", "getFi...
Setup bundle list on init. @return mixed
[ "Setup", "bundle", "list", "on", "init", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Support/Ajax.php#L102-L121
train
gizburdt/cuztom
src/Fields/TermSelect.php
TermSelect.outputInput
public function outputInput($value = null, $view = null) { $this->args['class'] = (isset($this->args['class']) ? $this->args['class'] : '').' cuztom-input--select cuztom-input--term-select'; $this->args['echo'] = 0; $this->args['name'] = $this->getName(); $this->args['id'] = $this->getId(); $this->args['selected'] = ! Cuztom::isEmpty($value) ? $value : $this->default_value; return wp_dropdown_categories($this->args); }
php
public function outputInput($value = null, $view = null) { $this->args['class'] = (isset($this->args['class']) ? $this->args['class'] : '').' cuztom-input--select cuztom-input--term-select'; $this->args['echo'] = 0; $this->args['name'] = $this->getName(); $this->args['id'] = $this->getId(); $this->args['selected'] = ! Cuztom::isEmpty($value) ? $value : $this->default_value; return wp_dropdown_categories($this->args); }
[ "public", "function", "outputInput", "(", "$", "value", "=", "null", ",", "$", "view", "=", "null", ")", "{", "$", "this", "->", "args", "[", "'class'", "]", "=", "(", "isset", "(", "$", "this", "->", "args", "[", "'class'", "]", ")", "?", "$", ...
Output input. @param string|array $value @return string
[ "Output", "input", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/TermSelect.php#L42-L52
train
gizburdt/cuztom
src/Entities/PostType.php
PostType.registerEntity
public function registerEntity() { parent::registerEntity(); // Args $args = apply_filters('cuztom_post_type_args', array_merge( [ 'label' => sprintf(__('%s', 'cuztom'), $this->plural), 'public' => true, 'supports' => ['title', 'editor'], 'has_archive' => sanitize_title($this->plural), 'labels' => [ 'name' => sprintf(_x('%s', 'post type general name', 'cuztom'), $this->plural), 'singular_name' => sprintf(_x('%s', 'post type singular title', 'cuztom'), $this->title), 'menu_name' => sprintf(__('%s', 'cuztom'), $this->plural), 'all_items' => sprintf(__('All %s', 'cuztom'), $this->plural), 'add_new' => sprintf(_x('Add New', '%s', 'cuztom'), $this->title), 'add_new_item' => sprintf(__('Add New %s', 'cuztom'), $this->title), 'edit_item' => sprintf(__('Edit %s', 'cuztom'), $this->title), 'new_item' => sprintf(__('New %s', 'cuztom'), $this->title), 'view_item' => sprintf(__('View %s', 'cuztom'), $this->title), 'items_archive' => sprintf(__('%s Archive', 'cuztom'), $this->title), 'search_items' => sprintf(__('Search %s', 'cuztom'), $this->plural), 'not_found' => sprintf(__('No %s found', 'cuztom'), $this->plural), 'not_found_in_trash' => sprintf(__('No %s found in trash', 'cuztom'), $this->plural), 'parent_item_colon' => sprintf(__('%s Parent', 'cuztom'), $this->title), ], ], $this->original ), $this); // Register the post type register_post_type($this->name, $args); }
php
public function registerEntity() { parent::registerEntity(); // Args $args = apply_filters('cuztom_post_type_args', array_merge( [ 'label' => sprintf(__('%s', 'cuztom'), $this->plural), 'public' => true, 'supports' => ['title', 'editor'], 'has_archive' => sanitize_title($this->plural), 'labels' => [ 'name' => sprintf(_x('%s', 'post type general name', 'cuztom'), $this->plural), 'singular_name' => sprintf(_x('%s', 'post type singular title', 'cuztom'), $this->title), 'menu_name' => sprintf(__('%s', 'cuztom'), $this->plural), 'all_items' => sprintf(__('All %s', 'cuztom'), $this->plural), 'add_new' => sprintf(_x('Add New', '%s', 'cuztom'), $this->title), 'add_new_item' => sprintf(__('Add New %s', 'cuztom'), $this->title), 'edit_item' => sprintf(__('Edit %s', 'cuztom'), $this->title), 'new_item' => sprintf(__('New %s', 'cuztom'), $this->title), 'view_item' => sprintf(__('View %s', 'cuztom'), $this->title), 'items_archive' => sprintf(__('%s Archive', 'cuztom'), $this->title), 'search_items' => sprintf(__('Search %s', 'cuztom'), $this->plural), 'not_found' => sprintf(__('No %s found', 'cuztom'), $this->plural), 'not_found_in_trash' => sprintf(__('No %s found in trash', 'cuztom'), $this->plural), 'parent_item_colon' => sprintf(__('%s Parent', 'cuztom'), $this->title), ], ], $this->original ), $this); // Register the post type register_post_type($this->name, $args); }
[ "public", "function", "registerEntity", "(", ")", "{", "parent", "::", "registerEntity", "(", ")", ";", "// Args", "$", "args", "=", "apply_filters", "(", "'cuztom_post_type_args'", ",", "array_merge", "(", "[", "'label'", "=>", "sprintf", "(", "__", "(", "'...
Register post Type. @return void
[ "Register", "post", "Type", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/PostType.php#L38-L71
train
gizburdt/cuztom
src/Entities/PostType.php
PostType.addTaxonomy
public function addTaxonomy($name, $args = []) { $taxonomy = new Taxonomy($name, $this->name, $args); return $this; }
php
public function addTaxonomy($name, $args = []) { $taxonomy = new Taxonomy($name, $this->name, $args); return $this; }
[ "public", "function", "addTaxonomy", "(", "$", "name", ",", "$", "args", "=", "[", "]", ")", "{", "$", "taxonomy", "=", "new", "Taxonomy", "(", "$", "name", ",", "$", "this", "->", "name", ",", "$", "args", ")", ";", "return", "$", "this", ";", ...
Add a taxonomy to the Post Type. @param string|array $name @param array $args
[ "Add", "a", "taxonomy", "to", "the", "Post", "Type", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/PostType.php#L79-L84
train
gizburdt/cuztom
src/Entities/PostType.php
PostType.addMetaBox
public function addMetaBox($id, $args) { $box = new MetaBox($id, $this->name, $args); return $this; }
php
public function addMetaBox($id, $args) { $box = new MetaBox($id, $this->name, $args); return $this; }
[ "public", "function", "addMetaBox", "(", "$", "id", ",", "$", "args", ")", "{", "$", "box", "=", "new", "MetaBox", "(", "$", "id", ",", "$", "this", "->", "name", ",", "$", "args", ")", ";", "return", "$", "this", ";", "}" ]
Add Meta Box to the Post Type. @param string $id @param array $args
[ "Add", "Meta", "Box", "to", "the", "Post", "Type", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/PostType.php#L92-L97
train
gizburdt/cuztom
src/Entities/PostType.php
PostType.removePostTypeSupport
public function removePostTypeSupport($features) { foreach ((array) $features as $feature) { remove_post_type_support($this->name, $feature); } return $this; }
php
public function removePostTypeSupport($features) { foreach ((array) $features as $feature) { remove_post_type_support($this->name, $feature); } return $this; }
[ "public", "function", "removePostTypeSupport", "(", "$", "features", ")", "{", "foreach", "(", "(", "array", ")", "$", "features", "as", "$", "feature", ")", "{", "remove_post_type_support", "(", "$", "this", "->", "name", ",", "$", "feature", ")", ";", ...
Remove support from Post Type. @param string|array $feature @return object
[ "Remove", "support", "from", "Post", "Type", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/PostType.php#L118-L125
train
gizburdt/cuztom
src/Entities/Taxonomy.php
Taxonomy.registerEntity
public function registerEntity() { parent::registerEntity(); // Args $args = apply_filters('cuztom_taxonomy_args', array_merge( [ 'label' => sprintf(__('%s', 'cuztom'), $this->plural), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, '_builtin' => false, 'show_admin_column' => false, 'labels' => [ 'name' => sprintf(_x('%s', 'taxonomy general name', 'cuztom'), $this->plural), 'singular_name' => sprintf(_x('%s', 'taxonomy singular name', 'cuztom'), $this->title), 'search_items' => sprintf(__('Search %s', 'cuztom'), $this->plural), 'all_items' => sprintf(__('All %s', 'cuztom'), $this->plural), 'parent_item' => sprintf(__('Parent %s', 'cuztom'), $this->title), 'parent_item_colon' => sprintf(__('Parent %s:', 'cuztom'), $this->title), 'edit_item' => sprintf(__('Edit %s', 'cuztom'), $this->title), 'update_item' => sprintf(__('Update %s', 'cuztom'), $this->title), 'add_new_item' => sprintf(__('Add New %s', 'cuztom'), $this->title), 'new_item_name' => sprintf(__('New %s Name', 'cuztom'), $this->title), 'menu_name' => sprintf(__('%s', 'cuztom'), $this->plural), ], ], $this->original ), $this); register_taxonomy($this->name, $this->postType, $args); }
php
public function registerEntity() { parent::registerEntity(); // Args $args = apply_filters('cuztom_taxonomy_args', array_merge( [ 'label' => sprintf(__('%s', 'cuztom'), $this->plural), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, '_builtin' => false, 'show_admin_column' => false, 'labels' => [ 'name' => sprintf(_x('%s', 'taxonomy general name', 'cuztom'), $this->plural), 'singular_name' => sprintf(_x('%s', 'taxonomy singular name', 'cuztom'), $this->title), 'search_items' => sprintf(__('Search %s', 'cuztom'), $this->plural), 'all_items' => sprintf(__('All %s', 'cuztom'), $this->plural), 'parent_item' => sprintf(__('Parent %s', 'cuztom'), $this->title), 'parent_item_colon' => sprintf(__('Parent %s:', 'cuztom'), $this->title), 'edit_item' => sprintf(__('Edit %s', 'cuztom'), $this->title), 'update_item' => sprintf(__('Update %s', 'cuztom'), $this->title), 'add_new_item' => sprintf(__('Add New %s', 'cuztom'), $this->title), 'new_item_name' => sprintf(__('New %s Name', 'cuztom'), $this->title), 'menu_name' => sprintf(__('%s', 'cuztom'), $this->plural), ], ], $this->original ), $this); register_taxonomy($this->name, $this->postType, $args); }
[ "public", "function", "registerEntity", "(", ")", "{", "parent", "::", "registerEntity", "(", ")", ";", "// Args", "$", "args", "=", "apply_filters", "(", "'cuztom_taxonomy_args'", ",", "array_merge", "(", "[", "'label'", "=>", "sprintf", "(", "__", "(", "'%...
Registers the custom Taxonomy with the given arguments. @return void
[ "Registers", "the", "custom", "Taxonomy", "with", "the", "given", "arguments", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/Taxonomy.php#L75-L107
train
gizburdt/cuztom
src/Entities/Taxonomy.php
Taxonomy.addTermMeta
public function addTermMeta($id, $data = [], $locations = ['add_form', 'edit_form']) { $meta = new TermMeta($id, $this->name, $data, $locations); return $this; }
php
public function addTermMeta($id, $data = [], $locations = ['add_form', 'edit_form']) { $meta = new TermMeta($id, $this->name, $data, $locations); return $this; }
[ "public", "function", "addTermMeta", "(", "$", "id", ",", "$", "data", "=", "[", "]", ",", "$", "locations", "=", "[", "'add_form'", ",", "'edit_form'", "]", ")", "{", "$", "meta", "=", "new", "TermMeta", "(", "$", "id", ",", "$", "this", "->", "...
Add Term Meta to this Taxonomy. @param string $id @param array $data @param array $locations
[ "Add", "Term", "Meta", "to", "this", "Taxonomy", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/Taxonomy.php#L126-L131
train
gizburdt/cuztom
src/Entities/Taxonomy.php
Taxonomy.adminColumnFilter
public function adminColumnFilter() { global $typenow, $wp_query; if (in_array($typenow, $this->postType)) { wp_dropdown_categories([ 'show_option_all' => sprintf(__('Show all %s', 'cuztom'), $this->plural), 'taxonomy' => $this->name, 'name' => $this->name, 'orderby' => 'name', 'selected' => isset($wp_query->query[$this->name]) ? $wp_query->query[$this->name] : '', 'hierarchical' => true, 'show_count' => true, 'hide_empty' => true, ]); } }
php
public function adminColumnFilter() { global $typenow, $wp_query; if (in_array($typenow, $this->postType)) { wp_dropdown_categories([ 'show_option_all' => sprintf(__('Show all %s', 'cuztom'), $this->plural), 'taxonomy' => $this->name, 'name' => $this->name, 'orderby' => 'name', 'selected' => isset($wp_query->query[$this->name]) ? $wp_query->query[$this->name] : '', 'hierarchical' => true, 'show_count' => true, 'hide_empty' => true, ]); } }
[ "public", "function", "adminColumnFilter", "(", ")", "{", "global", "$", "typenow", ",", "$", "wp_query", ";", "if", "(", "in_array", "(", "$", "typenow", ",", "$", "this", "->", "postType", ")", ")", "{", "wp_dropdown_categories", "(", "[", "'show_option_...
Adds a filter to the post table filters. @return void
[ "Adds", "a", "filter", "to", "the", "post", "table", "filters", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/Taxonomy.php#L150-L166
train
gizburdt/cuztom
src/Entities/Taxonomy.php
Taxonomy.postFilterQuery
public function postFilterQuery($query) { // @TODO: Is this still right? global $pagenow; $vars = &$query->query_vars; if ($pagenow == 'edit.php' && isset($vars[$this->name]) && is_numeric($vars[$this->name]) && $vars[$this->name]) { $term = get_term_by('id', $vars[$this->name], $this->name); $vars[$this->name] = $term->slug; } return $vars; }
php
public function postFilterQuery($query) { // @TODO: Is this still right? global $pagenow; $vars = &$query->query_vars; if ($pagenow == 'edit.php' && isset($vars[$this->name]) && is_numeric($vars[$this->name]) && $vars[$this->name]) { $term = get_term_by('id', $vars[$this->name], $this->name); $vars[$this->name] = $term->slug; } return $vars; }
[ "public", "function", "postFilterQuery", "(", "$", "query", ")", "{", "// @TODO: Is this still right?", "global", "$", "pagenow", ";", "$", "vars", "=", "&", "$", "query", "->", "query_vars", ";", "if", "(", "$", "pagenow", "==", "'edit.php'", "&&", "isset",...
Applies the selected filter to the query. @param object $query @return array
[ "Applies", "the", "selected", "filter", "to", "the", "query", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Entities/Taxonomy.php#L174-L188
train
gizburdt/cuztom
src/Meta/Term.php
Term.addColumn
public function addColumn($columns) { foreach ($this->fields as $id => $field) { if (isset($field->show_admin_column) && $field->show_admin_column) { $columns[$id] = $field->label; } } return $columns; }
php
public function addColumn($columns) { foreach ($this->fields as $id => $field) { if (isset($field->show_admin_column) && $field->show_admin_column) { $columns[$id] = $field->label; } } return $columns; }
[ "public", "function", "addColumn", "(", "$", "columns", ")", "{", "foreach", "(", "$", "this", "->", "fields", "as", "$", "id", "=>", "$", "field", ")", "{", "if", "(", "isset", "(", "$", "field", "->", "show_admin_column", ")", "&&", "$", "field", ...
Used to add a column head to the Taxonomy's List Table. @param array $columns @return array
[ "Used", "to", "add", "a", "column", "head", "to", "the", "Taxonomy", "s", "List", "Table", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Term.php#L131-L140
train
gizburdt/cuztom
src/Fields/Bundle.php
Bundle.save
public function save($object, $values) { $values = isset($values[$this->id]) ? $values[$this->id] : null; $values = is_array($values) ? array_values($values) : []; // Filter $values = apply_filters('cuztom_bundle_save_values', $values, $this); // Do do_action('cuztom_bundle_save', $this); foreach ($values as $cell => $fields) { foreach ($fields as $id => $value) { $values[$this->id][$cell][$id] = $this->getFirstItem()->getField($id)->parseValue($value); } } parent::save($object, $values); }
php
public function save($object, $values) { $values = isset($values[$this->id]) ? $values[$this->id] : null; $values = is_array($values) ? array_values($values) : []; // Filter $values = apply_filters('cuztom_bundle_save_values', $values, $this); // Do do_action('cuztom_bundle_save', $this); foreach ($values as $cell => $fields) { foreach ($fields as $id => $value) { $values[$this->id][$cell][$id] = $this->getFirstItem()->getField($id)->parseValue($value); } } parent::save($object, $values); }
[ "public", "function", "save", "(", "$", "object", ",", "$", "values", ")", "{", "$", "values", "=", "isset", "(", "$", "values", "[", "$", "this", "->", "id", "]", ")", "?", "$", "values", "[", "$", "this", "->", "id", "]", ":", "null", ";", ...
Save bundle meta. @param int $object @param array $values
[ "Save", "bundle", "meta", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Bundle.php#L68-L91
train
gizburdt/cuztom
src/Fields/Bundle.php
Bundle.build
public function build($args) { $data = []; $args = Cuztom::merge($args, [ 'parent' => $this, 'metaType' => $this->metaType, 'object' => $this->object, ]); // Build with value if (Cuztom::isArray($this->value)) { $i = 0; foreach ($this->value as $value) { $args = Cuztom::merge($args, "index=>$i"); $data[] = new BundleItem($args, $value); $i++; } } // Without value else { $args = Cuztom::merge($args, 'index=>0'); $data[] = new BundleItem($args); } return $data; }
php
public function build($args) { $data = []; $args = Cuztom::merge($args, [ 'parent' => $this, 'metaType' => $this->metaType, 'object' => $this->object, ]); // Build with value if (Cuztom::isArray($this->value)) { $i = 0; foreach ($this->value as $value) { $args = Cuztom::merge($args, "index=>$i"); $data[] = new BundleItem($args, $value); $i++; } } // Without value else { $args = Cuztom::merge($args, 'index=>0'); $data[] = new BundleItem($args); } return $data; }
[ "public", "function", "build", "(", "$", "args", ")", "{", "$", "data", "=", "[", "]", ";", "$", "args", "=", "Cuztom", "::", "merge", "(", "$", "args", ",", "[", "'parent'", "=>", "$", "this", ",", "'metaType'", "=>", "$", "this", "->", "metaTyp...
This method builds the complete array for a bundle. @param array $data @param array $values
[ "This", "method", "builds", "the", "complete", "array", "for", "a", "bundle", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Bundle.php#L120-L151
train
gizburdt/cuztom
src/Meta/Box.php
Box.addHooks
public function addHooks() { if (isset($this->callback[0]) && $this->callback[0] == $this) { foreach ($this->postTypes as $postType) { add_filter('manage_'.$postType.'_posts_columns', [$this, 'addColumn']); add_action('manage_'.$postType.'_posts_custom_column', [$this, 'addColumnContent'], 10, 2); add_action('manage_edit-'.$postType.'_sortable_columns', [$this, 'addSortableColumn'], 10, 2); } add_action('save_post', [$this, 'savePost']); add_action('post_edit_form_tag', [$this, 'editFormTag']); } // Add the meta box add_action('add_meta_boxes', [$this, 'addMetaBox']); // Do do_action('cuztom_box_hooks', $this); }
php
public function addHooks() { if (isset($this->callback[0]) && $this->callback[0] == $this) { foreach ($this->postTypes as $postType) { add_filter('manage_'.$postType.'_posts_columns', [$this, 'addColumn']); add_action('manage_'.$postType.'_posts_custom_column', [$this, 'addColumnContent'], 10, 2); add_action('manage_edit-'.$postType.'_sortable_columns', [$this, 'addSortableColumn'], 10, 2); } add_action('save_post', [$this, 'savePost']); add_action('post_edit_form_tag', [$this, 'editFormTag']); } // Add the meta box add_action('add_meta_boxes', [$this, 'addMetaBox']); // Do do_action('cuztom_box_hooks', $this); }
[ "public", "function", "addHooks", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "callback", "[", "0", "]", ")", "&&", "$", "this", "->", "callback", "[", "0", "]", "==", "$", "this", ")", "{", "foreach", "(", "$", "this", "->", "po...
Add all hooks.
[ "Add", "all", "hooks", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Box.php#L62-L80
train
gizburdt/cuztom
src/Meta/Box.php
Box.addMetaBox
public function addMetaBox() { foreach ($this->postTypes as $postType) { add_meta_box( $this->id, $this->title, $this->callback, $postType, $this->context, $this->priority ); } }
php
public function addMetaBox() { foreach ($this->postTypes as $postType) { add_meta_box( $this->id, $this->title, $this->callback, $postType, $this->context, $this->priority ); } }
[ "public", "function", "addMetaBox", "(", ")", "{", "foreach", "(", "$", "this", "->", "postTypes", "as", "$", "postType", ")", "{", "add_meta_box", "(", "$", "this", "->", "id", ",", "$", "this", "->", "title", ",", "$", "this", "->", "callback", ","...
Method that calls the add_meta_box function.
[ "Method", "that", "calls", "the", "add_meta_box", "function", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Box.php#L85-L97
train
gizburdt/cuztom
src/Meta/Box.php
Box.savePost
public function savePost($id) { if ( Guard::doingAutosave() || Guard::doingAjax() || ! Guard::verifyNonce('cuztom_nonce', 'cuztom_meta') || ! Guard::isPostType($id, $this->postTypes) || ! Guard::userCanEdit($id) ) { return; } // Filter $values = apply_filters('cuztom_box_save_values', (new Request($_POST))->getAll(), $this); // Do do_action('cuztom_box_save', $this); parent::save($id, $values); }
php
public function savePost($id) { if ( Guard::doingAutosave() || Guard::doingAjax() || ! Guard::verifyNonce('cuztom_nonce', 'cuztom_meta') || ! Guard::isPostType($id, $this->postTypes) || ! Guard::userCanEdit($id) ) { return; } // Filter $values = apply_filters('cuztom_box_save_values', (new Request($_POST))->getAll(), $this); // Do do_action('cuztom_box_save', $this); parent::save($id, $values); }
[ "public", "function", "savePost", "(", "$", "id", ")", "{", "if", "(", "Guard", "::", "doingAutosave", "(", ")", "||", "Guard", "::", "doingAjax", "(", ")", "||", "!", "Guard", "::", "verifyNonce", "(", "'cuztom_nonce'", ",", "'cuztom_meta'", ")", "||", ...
Hooks into the save hook for the newly registered Post Type. @param int $id
[ "Hooks", "into", "the", "save", "hook", "for", "the", "newly", "registered", "Post", "Type", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Box.php#L104-L123
train
gizburdt/cuztom
src/Meta/Box.php
Box.addColumn
public function addColumn($columns) { unset($columns['date']); foreach ($this->data as $id => $field) { if (isset($field->show_admin_column) && $field->show_admin_column) { $columns[$id] = $field->label; } } $columns['date'] = __('Date'); return $columns; }
php
public function addColumn($columns) { unset($columns['date']); foreach ($this->data as $id => $field) { if (isset($field->show_admin_column) && $field->show_admin_column) { $columns[$id] = $field->label; } } $columns['date'] = __('Date'); return $columns; }
[ "public", "function", "addColumn", "(", "$", "columns", ")", "{", "unset", "(", "$", "columns", "[", "'date'", "]", ")", ";", "foreach", "(", "$", "this", "->", "data", "as", "$", "id", "=>", "$", "field", ")", "{", "if", "(", "isset", "(", "$", ...
Used to add a column head to the Post Type's List Table. @param array $columns @return array
[ "Used", "to", "add", "a", "column", "head", "to", "the", "Post", "Type", "s", "List", "Table", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Box.php#L131-L144
train
gizburdt/cuztom
src/Meta/Box.php
Box.addSortableColumn
public function addSortableColumn($columns) { if ($this->data) { foreach ($this->data as $id => $field) { if ($field->admin_column_sortable) { $columns[$id] = $field->label; } } } return $columns; }
php
public function addSortableColumn($columns) { if ($this->data) { foreach ($this->data as $id => $field) { if ($field->admin_column_sortable) { $columns[$id] = $field->label; } } } return $columns; }
[ "public", "function", "addSortableColumn", "(", "$", "columns", ")", "{", "if", "(", "$", "this", "->", "data", ")", "{", "foreach", "(", "$", "this", "->", "data", "as", "$", "id", "=>", "$", "field", ")", "{", "if", "(", "$", "field", "->", "ad...
Used to make all columns sortable. @param array $columns @return array
[ "Used", "to", "make", "all", "columns", "sortable", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Box.php#L167-L178
train
gizburdt/cuztom
src/Meta/Box.php
Box.determineObject
public function determineObject() { if (isset($_GET['post'])) { return $_GET['post']; } if (isset($_POST['post_ID'])) { return $_POST['post_ID']; } if (isset($_POST['cuztom']['object'])) { return $_POST['cuztom']['object']; } }
php
public function determineObject() { if (isset($_GET['post'])) { return $_GET['post']; } if (isset($_POST['post_ID'])) { return $_POST['post_ID']; } if (isset($_POST['cuztom']['object'])) { return $_POST['cuztom']['object']; } }
[ "public", "function", "determineObject", "(", ")", "{", "if", "(", "isset", "(", "$", "_GET", "[", "'post'", "]", ")", ")", "{", "return", "$", "_GET", "[", "'post'", "]", ";", "}", "if", "(", "isset", "(", "$", "_POST", "[", "'post_ID'", "]", ")...
Get object ID. @return int|null
[ "Get", "object", "ID", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Meta/Box.php#L185-L198
train
gizburdt/cuztom
src/Fields/Text.php
Text.parseValue
public function parseValue($value) { if (is_array($value)) { array_walk_recursive($value, [$this, 'doHtmlspecialchars']); } else { $value = $this->doHtmlspecialchars($value); } return parent::parseValue($value); }
php
public function parseValue($value) { if (is_array($value)) { array_walk_recursive($value, [$this, 'doHtmlspecialchars']); } else { $value = $this->doHtmlspecialchars($value); } return parent::parseValue($value); }
[ "public", "function", "parseValue", "(", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "array_walk_recursive", "(", "$", "value", ",", "[", "$", "this", ",", "'doHtmlspecialchars'", "]", ")", ";", "}", "else", "{", ...
Parse value for HTML special chars. @param string $value @return string
[ "Parse", "value", "for", "HTML", "special", "chars", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Text.php#L25-L34
train
gizburdt/cuztom
src/Fields/Image.php
Image.outputColumnContent
public function outputColumnContent($post_id) { $meta = get_post_meta($post_id, $this->id, true); echo wp_get_attachment_image($meta, [100, 100]); }
php
public function outputColumnContent($post_id) { $meta = get_post_meta($post_id, $this->id, true); echo wp_get_attachment_image($meta, [100, 100]); }
[ "public", "function", "outputColumnContent", "(", "$", "post_id", ")", "{", "$", "meta", "=", "get_post_meta", "(", "$", "post_id", ",", "$", "this", "->", "id", ",", "true", ")", ";", "echo", "wp_get_attachment_image", "(", "$", "meta", ",", "[", "100",...
Output column content. @param string $post_id @return string
[ "Output", "column", "content", "." ]
440afc5b9b65302dab2138c97974883ede90fbce
https://github.com/gizburdt/cuztom/blob/440afc5b9b65302dab2138c97974883ede90fbce/src/Fields/Image.php#L71-L76
train
hellowearemito/yii2-sentry
src/Component.php
Component.setEnvironmentOptions
private function setEnvironmentOptions() { if (empty($this->environment)) { return; } if (is_object($this->client) && property_exists($this->client, 'environment')) { $this->client->environment = $this->environment; } $this->jsOptions['environment'] = $this->environment; }
php
private function setEnvironmentOptions() { if (empty($this->environment)) { return; } if (is_object($this->client) && property_exists($this->client, 'environment')) { $this->client->environment = $this->environment; } $this->jsOptions['environment'] = $this->environment; }
[ "private", "function", "setEnvironmentOptions", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "environment", ")", ")", "{", "return", ";", "}", "if", "(", "is_object", "(", "$", "this", "->", "client", ")", "&&", "property_exists", "(", "$...
Adds a tag to filter events by environment
[ "Adds", "a", "tag", "to", "filter", "events", "by", "environment" ]
a754ab1bf2f7262a6637341b534a4638a787dd6e
https://github.com/hellowearemito/yii2-sentry/blob/a754ab1bf2f7262a6637341b534a4638a787dd6e/src/Component.php#L88-L98
train
hellowearemito/yii2-sentry
src/Component.php
Component.registerAssets
private function registerAssets() { if ($this->jsNotifier === false) { return; } if (!Yii::$app instanceof \yii\web\Application) { return; } try { $view = Yii::$app->getView(); RavenAsset::register($view); $view->registerJs('Raven.config(' . Json::encode($this->publicDsn) . ', ' . Json::encode($this->jsOptions) . ').install();', View::POS_HEAD); } catch (Exception $e) { // initialize Sentry component even if unable to register the assets Yii::error($e->getMessage()); } }
php
private function registerAssets() { if ($this->jsNotifier === false) { return; } if (!Yii::$app instanceof \yii\web\Application) { return; } try { $view = Yii::$app->getView(); RavenAsset::register($view); $view->registerJs('Raven.config(' . Json::encode($this->publicDsn) . ', ' . Json::encode($this->jsOptions) . ').install();', View::POS_HEAD); } catch (Exception $e) { // initialize Sentry component even if unable to register the assets Yii::error($e->getMessage()); } }
[ "private", "function", "registerAssets", "(", ")", "{", "if", "(", "$", "this", "->", "jsNotifier", "===", "false", ")", "{", "return", ";", "}", "if", "(", "!", "Yii", "::", "$", "app", "instanceof", "\\", "yii", "\\", "web", "\\", "Application", ")...
Registers RavenJS if publicDsn exists
[ "Registers", "RavenJS", "if", "publicDsn", "exists" ]
a754ab1bf2f7262a6637341b534a4638a787dd6e
https://github.com/hellowearemito/yii2-sentry/blob/a754ab1bf2f7262a6637341b534a4638a787dd6e/src/Component.php#L118-L136
train
tgallice/fb-messenger-sdk
src/Messenger.php
Messenger.subscribe
public function subscribe() { $response = $this->client->post('/me/subscribed_apps'); $decoded = $this->decodeResponse($response); return $decoded['success']; }
php
public function subscribe() { $response = $this->client->post('/me/subscribed_apps'); $decoded = $this->decodeResponse($response); return $decoded['success']; }
[ "public", "function", "subscribe", "(", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "post", "(", "'/me/subscribed_apps'", ")", ";", "$", "decoded", "=", "$", "this", "->", "decodeResponse", "(", "$", "response", ")", ";", "return",...
Subscribe the app to the page @return bool
[ "Subscribe", "the", "app", "to", "the", "page" ]
1904df1a6dadb0e57b06ab109c9ca4a7e351843c
https://github.com/tgallice/fb-messenger-sdk/blob/1904df1a6dadb0e57b06ab109c9ca4a7e351843c/src/Messenger.php#L94-L100
train
tgallice/fb-messenger-sdk
src/WebhookRequestHandler.php
WebhookRequestHandler.isValidVerifyTokenRequest
public function isValidVerifyTokenRequest() { if ($this->getRequest()->getMethod() !== 'GET') { return false; } $params = $this->getRequest()->getQueryParams(); if (!isset($params['hub_verify_token'])) { return false; } return $params['hub_verify_token'] === $this->verifyToken; }
php
public function isValidVerifyTokenRequest() { if ($this->getRequest()->getMethod() !== 'GET') { return false; } $params = $this->getRequest()->getQueryParams(); if (!isset($params['hub_verify_token'])) { return false; } return $params['hub_verify_token'] === $this->verifyToken; }
[ "public", "function", "isValidVerifyTokenRequest", "(", ")", "{", "if", "(", "$", "this", "->", "getRequest", "(", ")", "->", "getMethod", "(", ")", "!==", "'GET'", ")", "{", "return", "false", ";", "}", "$", "params", "=", "$", "this", "->", "getReque...
Check if the token match with the given verify token. This is useful in the webhook setup process. @return bool
[ "Check", "if", "the", "token", "match", "with", "the", "given", "verify", "token", ".", "This", "is", "useful", "in", "the", "webhook", "setup", "process", "." ]
1904df1a6dadb0e57b06ab109c9ca4a7e351843c
https://github.com/tgallice/fb-messenger-sdk/blob/1904df1a6dadb0e57b06ab109c9ca4a7e351843c/src/WebhookRequestHandler.php#L80-L93
train
tgallice/fb-messenger-sdk
src/WebhookRequestHandler.php
WebhookRequestHandler.isValidCallbackRequest
public function isValidCallbackRequest() { if (!$this->isValidHubSignature()) { return false; } $decoded = $this->getDecodedBody(); $object = isset($decoded['object']) ? $decoded['object'] : null; $entry = isset($decoded['entry']) ? $decoded['entry'] : null; return $object === 'page' && null !== $entry; }
php
public function isValidCallbackRequest() { if (!$this->isValidHubSignature()) { return false; } $decoded = $this->getDecodedBody(); $object = isset($decoded['object']) ? $decoded['object'] : null; $entry = isset($decoded['entry']) ? $decoded['entry'] : null; return $object === 'page' && null !== $entry; }
[ "public", "function", "isValidCallbackRequest", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isValidHubSignature", "(", ")", ")", "{", "return", "false", ";", "}", "$", "decoded", "=", "$", "this", "->", "getDecodedBody", "(", ")", ";", "$", "obj...
Check if the request is a valid webhook request @return bool
[ "Check", "if", "the", "request", "is", "a", "valid", "webhook", "request" ]
1904df1a6dadb0e57b06ab109c9ca4a7e351843c
https://github.com/tgallice/fb-messenger-sdk/blob/1904df1a6dadb0e57b06ab109c9ca4a7e351843c/src/WebhookRequestHandler.php#L110-L122
train
tgallice/fb-messenger-sdk
src/WebhookRequestHandler.php
WebhookRequestHandler.dispatchCallbackEvents
public function dispatchCallbackEvents() { foreach ($this->getAllCallbackEvents() as $event) { $this->dispatcher->dispatch($event->getName(), $event); if ($event instanceof PostbackEvent) { // Dispatch postback payload $this->dispatcher->dispatch($event->getPostback()->getPayload(), $event); } if ($event instanceof MessageEvent && $event->isQuickReply()) { // Dispatch quick reply payload $this->dispatcher->dispatch($event->getQuickReplyPayload(), $event); } } }
php
public function dispatchCallbackEvents() { foreach ($this->getAllCallbackEvents() as $event) { $this->dispatcher->dispatch($event->getName(), $event); if ($event instanceof PostbackEvent) { // Dispatch postback payload $this->dispatcher->dispatch($event->getPostback()->getPayload(), $event); } if ($event instanceof MessageEvent && $event->isQuickReply()) { // Dispatch quick reply payload $this->dispatcher->dispatch($event->getQuickReplyPayload(), $event); } } }
[ "public", "function", "dispatchCallbackEvents", "(", ")", "{", "foreach", "(", "$", "this", "->", "getAllCallbackEvents", "(", ")", "as", "$", "event", ")", "{", "$", "this", "->", "dispatcher", "->", "dispatch", "(", "$", "event", "->", "getName", "(", ...
Dispatch events to listeners
[ "Dispatch", "events", "to", "listeners" ]
1904df1a6dadb0e57b06ab109c9ca4a7e351843c
https://github.com/tgallice/fb-messenger-sdk/blob/1904df1a6dadb0e57b06ab109c9ca4a7e351843c/src/WebhookRequestHandler.php#L187-L202
train
authbucket/oauth2-php
src/GrantType/PasswordGrantTypeHandler.php
PasswordGrantTypeHandler.checkUsername
private function checkUsername(Request $request) { // username must exist and in valid format. $username = $request->request->get('username'); $errors = $this->validator->validate($username, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\Username(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // password must exist and in valid format. $password = $request->request->get('password'); $errors = $this->validator->validate($password, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\Password(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // Validate credentials with authentication manager. try { $token = new UsernamePasswordToken($username, $password, 'oauth2'); $authenticationProvider = new DaoAuthenticationProvider( $this->userProvider, new UserChecker(), 'oauth2', $this->encoderFactory ); $authenticationProvider->authenticate($token); } catch (BadCredentialsException $e) { throw new InvalidGrantException([ 'error_description' => 'The provided resource owner credentials is invalid.', ]); } return $username; }
php
private function checkUsername(Request $request) { // username must exist and in valid format. $username = $request->request->get('username'); $errors = $this->validator->validate($username, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\Username(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // password must exist and in valid format. $password = $request->request->get('password'); $errors = $this->validator->validate($password, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\Password(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // Validate credentials with authentication manager. try { $token = new UsernamePasswordToken($username, $password, 'oauth2'); $authenticationProvider = new DaoAuthenticationProvider( $this->userProvider, new UserChecker(), 'oauth2', $this->encoderFactory ); $authenticationProvider->authenticate($token); } catch (BadCredentialsException $e) { throw new InvalidGrantException([ 'error_description' => 'The provided resource owner credentials is invalid.', ]); } return $username; }
[ "private", "function", "checkUsername", "(", "Request", "$", "request", ")", "{", "// username must exist and in valid format.", "$", "username", "=", "$", "request", "->", "request", "->", "get", "(", "'username'", ")", ";", "$", "errors", "=", "$", "this", "...
Fetch username from POST. @param Request $request Incoming request object @return string The supplied username @throw InvalidRequestException If username or password in invalid format. @throw InvalidGrantException If reported as bad credentials from authentication provider.
[ "Fetch", "username", "from", "POST", "." ]
d923b94de8c6c567cb22e8c57af48a16f71f0c56
https://github.com/authbucket/oauth2-php/blob/d923b94de8c6c567cb22e8c57af48a16f71f0c56/src/GrantType/PasswordGrantTypeHandler.php#L69-L112
train
authbucket/oauth2-php
src/GrantType/AuthorizationCodeGrantTypeHandler.php
AuthorizationCodeGrantTypeHandler.checkCode
private function checkCode( Request $request, $clientId ) { // code is required and must in valid format. $code = $request->request->get('code'); $errors = $this->validator->validate($code, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\Code(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // Check code with database record. $codeManager = $this->modelManagerFactory->getModelManager('code'); $result = $codeManager->readModelOneBy([ 'code' => $code, ]); if ($result === null || $result->getClientId() !== $clientId) { throw new InvalidGrantException([ 'error_description' => 'The provided authorization grant is invalid.', ]); } elseif ($result->getExpires() < new \DateTime()) { throw new InvalidGrantException([ 'error_description' => 'The provided authorization grant is expired.', ]); } return [$result->getUsername(), $result->getScope()]; }
php
private function checkCode( Request $request, $clientId ) { // code is required and must in valid format. $code = $request->request->get('code'); $errors = $this->validator->validate($code, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\Code(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // Check code with database record. $codeManager = $this->modelManagerFactory->getModelManager('code'); $result = $codeManager->readModelOneBy([ 'code' => $code, ]); if ($result === null || $result->getClientId() !== $clientId) { throw new InvalidGrantException([ 'error_description' => 'The provided authorization grant is invalid.', ]); } elseif ($result->getExpires() < new \DateTime()) { throw new InvalidGrantException([ 'error_description' => 'The provided authorization grant is expired.', ]); } return [$result->getUsername(), $result->getScope()]; }
[ "private", "function", "checkCode", "(", "Request", "$", "request", ",", "$", "clientId", ")", "{", "// code is required and must in valid format.", "$", "code", "=", "$", "request", "->", "request", "->", "get", "(", "'code'", ")", ";", "$", "errors", "=", ...
Fetch code from POST. @param Request $request Incoming request object @param string $clientId Corresponding client_id that code should belongs to @return array A list with stored username and scope, originally grant in authorize endpoint @throw InvalidRequestException If code in invalid format. @throw InvalidGrantException If code provided is no longer valid.
[ "Fetch", "code", "from", "POST", "." ]
d923b94de8c6c567cb22e8c57af48a16f71f0c56
https://github.com/authbucket/oauth2-php/blob/d923b94de8c6c567cb22e8c57af48a16f71f0c56/src/GrantType/AuthorizationCodeGrantTypeHandler.php#L63-L95
train
authbucket/oauth2-php
src/GrantType/AuthorizationCodeGrantTypeHandler.php
AuthorizationCodeGrantTypeHandler.checkRedirectUri
private function checkRedirectUri( Request $request, $clientId ) { // redirect_uri may not exists. $redirectUri = $request->request->get('redirect_uri'); $errors = $this->validator->validate($redirectUri, [ new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\RedirectUri(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // redirect_uri is not required if already established via other channels, // check an existing redirect URI against the one supplied. $stored = null; $clientManager = $this->modelManagerFactory->getModelManager('client'); $result = $clientManager->readModelOneBy([ 'clientId' => $clientId, ]); if ($result !== null && $result->getRedirectUri()) { $stored = $result->getRedirectUri(); } // At least one of: existing redirect URI or input redirect URI must be // specified. if (!$stored && !$redirectUri) { throw new InvalidRequestException([ 'error_description' => 'The request is missing a required parameter.', ]); } // If there's an existing uri and one from input, verify that they match. if ($stored && $redirectUri) { // Ensure that the input uri starts with the stored uri. if (strcasecmp(substr($redirectUri, 0, strlen($stored)), $stored) !== 0) { throw new InvalidGrantException([ 'error_description' => 'The provided authorization grant does not match the redirection URI used in the authorization request.', ]); } } return $redirectUri ?: $stored; }
php
private function checkRedirectUri( Request $request, $clientId ) { // redirect_uri may not exists. $redirectUri = $request->request->get('redirect_uri'); $errors = $this->validator->validate($redirectUri, [ new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\RedirectUri(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // redirect_uri is not required if already established via other channels, // check an existing redirect URI against the one supplied. $stored = null; $clientManager = $this->modelManagerFactory->getModelManager('client'); $result = $clientManager->readModelOneBy([ 'clientId' => $clientId, ]); if ($result !== null && $result->getRedirectUri()) { $stored = $result->getRedirectUri(); } // At least one of: existing redirect URI or input redirect URI must be // specified. if (!$stored && !$redirectUri) { throw new InvalidRequestException([ 'error_description' => 'The request is missing a required parameter.', ]); } // If there's an existing uri and one from input, verify that they match. if ($stored && $redirectUri) { // Ensure that the input uri starts with the stored uri. if (strcasecmp(substr($redirectUri, 0, strlen($stored)), $stored) !== 0) { throw new InvalidGrantException([ 'error_description' => 'The provided authorization grant does not match the redirection URI used in the authorization request.', ]); } } return $redirectUri ?: $stored; }
[ "private", "function", "checkRedirectUri", "(", "Request", "$", "request", ",", "$", "clientId", ")", "{", "// redirect_uri may not exists.", "$", "redirectUri", "=", "$", "request", "->", "request", "->", "get", "(", "'redirect_uri'", ")", ";", "$", "errors", ...
Fetch redirect_uri from POST, or stored record. @param Request $request Incoming request object @param string $clientId Corresponding client_id that code should belongs to @return string The supplied redirect_uri from incoming request, or from stored record @throw InvalidRequestException If redirect_uri not exists in both incoming request and database record, or supplied value not match with stord record.
[ "Fetch", "redirect_uri", "from", "POST", "or", "stored", "record", "." ]
d923b94de8c6c567cb22e8c57af48a16f71f0c56
https://github.com/authbucket/oauth2-php/blob/d923b94de8c6c567cb22e8c57af48a16f71f0c56/src/GrantType/AuthorizationCodeGrantTypeHandler.php#L107-L152
train
authbucket/oauth2-php
src/ResponseType/AbstractResponseTypeHandler.php
AbstractResponseTypeHandler.checkUsername
protected function checkUsername() { $token = $this->tokenStorage->getToken(); if (!$token instanceof RememberMeToken && !$token instanceof UsernamePasswordToken) { throw new ServerErrorException([ 'error_description' => 'The authorization server encountered an unexpected condition that prevented it from fulfilling the request.', ]); } return $token->getUsername(); }
php
protected function checkUsername() { $token = $this->tokenStorage->getToken(); if (!$token instanceof RememberMeToken && !$token instanceof UsernamePasswordToken) { throw new ServerErrorException([ 'error_description' => 'The authorization server encountered an unexpected condition that prevented it from fulfilling the request.', ]); } return $token->getUsername(); }
[ "protected", "function", "checkUsername", "(", ")", "{", "$", "token", "=", "$", "this", "->", "tokenStorage", "->", "getToken", "(", ")", ";", "if", "(", "!", "$", "token", "instanceof", "RememberMeToken", "&&", "!", "$", "token", "instanceof", "UsernameP...
Fetch username from authenticated token. @return string Supplied username from authenticated token @throw ServerErrorException If supplied token is not a standard TokenInterface instance.
[ "Fetch", "username", "from", "authenticated", "token", "." ]
d923b94de8c6c567cb22e8c57af48a16f71f0c56
https://github.com/authbucket/oauth2-php/blob/d923b94de8c6c567cb22e8c57af48a16f71f0c56/src/ResponseType/AbstractResponseTypeHandler.php#L57-L67
train
authbucket/oauth2-php
src/ResponseType/AbstractResponseTypeHandler.php
AbstractResponseTypeHandler.checkClientId
protected function checkClientId(Request $request) { // client_id is required and in valid format. $clientId = $request->query->get('client_id'); $errors = $this->validator->validate($clientId, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\ClientId(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // Compare client_id with database record. $clientManager = $this->modelManagerFactory->getModelManager('client'); $result = $clientManager->readModelOneBy([ 'clientId' => $clientId, ]); if ($result === null) { throw new UnauthorizedClientException([ 'error_description' => 'The client is not authorized.', ]); } return $clientId; }
php
protected function checkClientId(Request $request) { // client_id is required and in valid format. $clientId = $request->query->get('client_id'); $errors = $this->validator->validate($clientId, [ new \Symfony\Component\Validator\Constraints\NotBlank(), new \AuthBucket\OAuth2\Symfony\Component\Validator\Constraints\ClientId(), ]); if (count($errors) > 0) { throw new InvalidRequestException([ 'error_description' => 'The request includes an invalid parameter value.', ]); } // Compare client_id with database record. $clientManager = $this->modelManagerFactory->getModelManager('client'); $result = $clientManager->readModelOneBy([ 'clientId' => $clientId, ]); if ($result === null) { throw new UnauthorizedClientException([ 'error_description' => 'The client is not authorized.', ]); } return $clientId; }
[ "protected", "function", "checkClientId", "(", "Request", "$", "request", ")", "{", "// client_id is required and in valid format.", "$", "clientId", "=", "$", "request", "->", "query", "->", "get", "(", "'client_id'", ")", ";", "$", "errors", "=", "$", "this", ...
Fetch cliend_id from GET. @param Request $request Incoming request object @return string Supplied client_id from incoming request @throw InvalidRequestException If supplied client_id in bad format. @throw UnauthorizedClientException If client_id not found from database record.
[ "Fetch", "cliend_id", "from", "GET", "." ]
d923b94de8c6c567cb22e8c57af48a16f71f0c56
https://github.com/authbucket/oauth2-php/blob/d923b94de8c6c567cb22e8c57af48a16f71f0c56/src/ResponseType/AbstractResponseTypeHandler.php#L79-L105
train
ProAI/laravel-handlebars
src/Compilers/HandlebarsCompiler.php
HandlebarsCompiler.getLanguageHelpers
protected function getLanguageHelpers() { return [ 'lang' => function ($args, $named) { return Lang::get($args[0], $named); }, 'choice' => function ($args, $named) { return Lang::choice($args[0], $args[1], $named); } ]; }
php
protected function getLanguageHelpers() { return [ 'lang' => function ($args, $named) { return Lang::get($args[0], $named); }, 'choice' => function ($args, $named) { return Lang::choice($args[0], $args[1], $named); } ]; }
[ "protected", "function", "getLanguageHelpers", "(", ")", "{", "return", "[", "'lang'", "=>", "function", "(", "$", "args", ",", "$", "named", ")", "{", "return", "Lang", "::", "get", "(", "$", "args", "[", "0", "]", ",", "$", "named", ")", ";", "}"...
Get language helper functions. @return array
[ "Get", "language", "helper", "functions", "." ]
c0e154d2df1dfa667c2226e19710f06b8acef94e
https://github.com/ProAI/laravel-handlebars/blob/c0e154d2df1dfa667c2226e19710f06b8acef94e/src/Compilers/HandlebarsCompiler.php#L166-L176
train
ProAI/laravel-handlebars
src/HandlebarsServiceProvider.php
HandlebarsServiceProvider.registerHandlebarsEngine
public function registerHandlebarsEngine($resolver) { $app = $this->app; // The Compiler engine requires an instance of the CompilerInterface, which in // this case will be the Handlebars compiler, so we'll first create the compiler // instance to pass into the engine so it can compile the views properly. $app->singleton('handlebars.lightncandy', function ($app) { return new LightnCandy; }); $app->singleton('handlebars.compiler', function ($app) { $cache = $app['config']['view.compiled']; return new HandlebarsCompiler($app['files'], $app['handlebars.lightncandy'], $cache); }); $resolver->register('handlebars', function () use ($app) { return new HandlebarsEngine($app['handlebars.compiler']); }); }
php
public function registerHandlebarsEngine($resolver) { $app = $this->app; // The Compiler engine requires an instance of the CompilerInterface, which in // this case will be the Handlebars compiler, so we'll first create the compiler // instance to pass into the engine so it can compile the views properly. $app->singleton('handlebars.lightncandy', function ($app) { return new LightnCandy; }); $app->singleton('handlebars.compiler', function ($app) { $cache = $app['config']['view.compiled']; return new HandlebarsCompiler($app['files'], $app['handlebars.lightncandy'], $cache); }); $resolver->register('handlebars', function () use ($app) { return new HandlebarsEngine($app['handlebars.compiler']); }); }
[ "public", "function", "registerHandlebarsEngine", "(", "$", "resolver", ")", "{", "$", "app", "=", "$", "this", "->", "app", ";", "// The Compiler engine requires an instance of the CompilerInterface, which in", "// this case will be the Handlebars compiler, so we'll first create t...
Register the mustache engine implementation. @param \Illuminate\View\Engines\EngineResolver $resolver @return void
[ "Register", "the", "mustache", "engine", "implementation", "." ]
c0e154d2df1dfa667c2226e19710f06b8acef94e
https://github.com/ProAI/laravel-handlebars/blob/c0e154d2df1dfa667c2226e19710f06b8acef94e/src/HandlebarsServiceProvider.php#L82-L102
train