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
silverstripe/silverstripe-framework
src/View/SSViewer.php
SSViewer.flush_template_cache
public static function flush_template_cache($force = false) { if (!self::$template_cache_flushed || $force) { $dir = dir(TEMP_PATH); while (false !== ($file = $dir->read())) { if (strstr($file, '.cache')) { unlink(TEMP_PATH . DIRECTORY_SEPARATOR . ...
php
public static function flush_template_cache($force = false) { if (!self::$template_cache_flushed || $force) { $dir = dir(TEMP_PATH); while (false !== ($file = $dir->read())) { if (strstr($file, '.cache')) { unlink(TEMP_PATH . DIRECTORY_SEPARATOR . ...
[ "public", "static", "function", "flush_template_cache", "(", "$", "force", "=", "false", ")", "{", "if", "(", "!", "self", "::", "$", "template_cache_flushed", "||", "$", "force", ")", "{", "$", "dir", "=", "dir", "(", "TEMP_PATH", ")", ";", "while", "...
Clears all parsed template files in the cache folder. Can only be called once per request (there may be multiple SSViewer instances). @param bool $force Set this to true to force a re-flush. If left to false, flushing may only be performed once a request.
[ "Clears", "all", "parsed", "template", "files", "in", "the", "cache", "folder", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L505-L516
train
silverstripe/silverstripe-framework
src/View/SSViewer.php
SSViewer.flush_cacheblock_cache
public static function flush_cacheblock_cache($force = false) { if (!self::$cacheblock_cache_flushed || $force) { $cache = Injector::inst()->get(CacheInterface::class . '.cacheblock'); $cache->clear(); self::$cacheblock_cache_flushed = true; } }
php
public static function flush_cacheblock_cache($force = false) { if (!self::$cacheblock_cache_flushed || $force) { $cache = Injector::inst()->get(CacheInterface::class . '.cacheblock'); $cache->clear(); self::$cacheblock_cache_flushed = true; } }
[ "public", "static", "function", "flush_cacheblock_cache", "(", "$", "force", "=", "false", ")", "{", "if", "(", "!", "self", "::", "$", "cacheblock_cache_flushed", "||", "$", "force", ")", "{", "$", "cache", "=", "Injector", "::", "inst", "(", ")", "->",...
Clears all partial cache blocks. Can only be called once per request (there may be multiple SSViewer instances). @param bool $force Set this to true to force a re-flush. If left to false, flushing may only be performed once a request.
[ "Clears", "all", "partial", "cache", "blocks", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L526-L535
train
silverstripe/silverstripe-framework
src/View/SSViewer.php
SSViewer.includeGeneratedTemplate
protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null) { if (isset($_GET['showtemplate']) && $_GET['showtemplate'] && Permission::check('ADMIN')) { $lines = file($cacheFile); echo "<h2>Template: $cacheFile</h2>"; echo "...
php
protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null) { if (isset($_GET['showtemplate']) && $_GET['showtemplate'] && Permission::check('ADMIN')) { $lines = file($cacheFile); echo "<h2>Template: $cacheFile</h2>"; echo "...
[ "protected", "function", "includeGeneratedTemplate", "(", "$", "cacheFile", ",", "$", "item", ",", "$", "overlay", ",", "$", "underlay", ",", "$", "inheritedScope", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "_GET", "[", "'showtemplate'", "]", ...
An internal utility function to set up variables in preparation for including a compiled template, then do the include Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call @param string $cacheFile The path to the file that contains the template compiled to PHP @param Vie...
[ "An", "internal", "utility", "function", "to", "set", "up", "variables", "in", "preparation", "for", "including", "a", "compiled", "template", "then", "do", "the", "include" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L584-L605
train
silverstripe/silverstripe-framework
src/View/SSViewer.php
SSViewer.getSubtemplateFor
protected function getSubtemplateFor($subtemplate) { // Get explicit subtemplate name if (isset($this->subTemplates[$subtemplate])) { return $this->subTemplates[$subtemplate]; } // Don't apply sub-templates if type is already specified (e.g. 'Includes') if (isset...
php
protected function getSubtemplateFor($subtemplate) { // Get explicit subtemplate name if (isset($this->subTemplates[$subtemplate])) { return $this->subTemplates[$subtemplate]; } // Don't apply sub-templates if type is already specified (e.g. 'Includes') if (isset...
[ "protected", "function", "getSubtemplateFor", "(", "$", "subtemplate", ")", "{", "// Get explicit subtemplate name", "if", "(", "isset", "(", "$", "this", "->", "subTemplates", "[", "$", "subtemplate", "]", ")", ")", "{", "return", "$", "this", "->", "subTempl...
Get the appropriate template to use for the named sub-template, or null if none are appropriate @param string $subtemplate Sub-template to use @return array|null
[ "Get", "the", "appropriate", "template", "to", "use", "for", "the", "named", "sub", "-", "template", "or", "null", "if", "none", "are", "appropriate" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L712-L738
train
silverstripe/silverstripe-framework
src/View/SSViewer.php
SSViewer.execute_string
public static function execute_string($content, $data, $arguments = null, $globalRequirements = false) { $v = SSViewer::fromString($content); if ($globalRequirements) { $v->includeRequirements(false); } else { //nest a requirements backend for our template rendering ...
php
public static function execute_string($content, $data, $arguments = null, $globalRequirements = false) { $v = SSViewer::fromString($content); if ($globalRequirements) { $v->includeRequirements(false); } else { //nest a requirements backend for our template rendering ...
[ "public", "static", "function", "execute_string", "(", "$", "content", ",", "$", "data", ",", "$", "arguments", "=", "null", ",", "$", "globalRequirements", "=", "false", ")", "{", "$", "v", "=", "SSViewer", "::", "fromString", "(", "$", "content", ")", ...
Execute the evaluated string, passing it the given data. Used by partial caching to evaluate custom cache keys expressed using template expressions @param string $content Input string @param mixed $data Data context @param array $arguments Additional arguments @param bool $globalRequirements @return string Evaluated ...
[ "Execute", "the", "evaluated", "string", "passing", "it", "the", "given", "data", ".", "Used", "by", "partial", "caching", "to", "evaluate", "custom", "cache", "keys", "expressed", "using", "template", "expressions" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L784-L802
train
silverstripe/silverstripe-framework
src/View/SSViewer.php
SSViewer.parseTemplateContent
public function parseTemplateContent($content, $template = "") { return $this->getParser()->compileString( $content, $template, Director::isDev() && SSViewer::config()->uninherited('source_file_comments') ); }
php
public function parseTemplateContent($content, $template = "") { return $this->getParser()->compileString( $content, $template, Director::isDev() && SSViewer::config()->uninherited('source_file_comments') ); }
[ "public", "function", "parseTemplateContent", "(", "$", "content", ",", "$", "template", "=", "\"\"", ")", "{", "return", "$", "this", "->", "getParser", "(", ")", "->", "compileString", "(", "$", "content", ",", "$", "template", ",", "Director", "::", "...
Parse given template contents @param string $content The template contents @param string $template The template file name @return string
[ "Parse", "given", "template", "contents" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L811-L818
train
silverstripe/silverstripe-framework
src/Dev/FixtureFactory.php
FixtureFactory.createObject
public function createObject($name, $identifier, $data = null) { if (!isset($this->blueprints[$name])) { $this->blueprints[$name] = new FixtureBlueprint($name); } $blueprint = $this->blueprints[$name]; $obj = $blueprint->createObject($identifier, $data, $this->fixtures); ...
php
public function createObject($name, $identifier, $data = null) { if (!isset($this->blueprints[$name])) { $this->blueprints[$name] = new FixtureBlueprint($name); } $blueprint = $this->blueprints[$name]; $obj = $blueprint->createObject($identifier, $data, $this->fixtures); ...
[ "public", "function", "createObject", "(", "$", "name", ",", "$", "identifier", ",", "$", "data", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "blueprints", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "blue...
Writes the fixture into the database using DataObjects @param string $name Name of the {@link FixtureBlueprint} to use, usually a DataObject subclass. @param string $identifier Unique identifier for this fixture type @param array $data Map of properties. Overrides default data. @return DataObject
[ "Writes", "the", "fixture", "into", "the", "database", "using", "DataObjects" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/FixtureFactory.php#L79-L94
train
silverstripe/silverstripe-framework
src/Dev/FixtureFactory.php
FixtureFactory.createRaw
public function createRaw($table, $identifier, $data) { $fields = array(); foreach ($data as $fieldName => $fieldVal) { $fields["\"{$fieldName}\""] = $this->parseValue($fieldVal); } $insert = new SQLInsert("\"{$table}\"", $fields); $insert->execute(); $id ...
php
public function createRaw($table, $identifier, $data) { $fields = array(); foreach ($data as $fieldName => $fieldVal) { $fields["\"{$fieldName}\""] = $this->parseValue($fieldVal); } $insert = new SQLInsert("\"{$table}\"", $fields); $insert->execute(); $id ...
[ "public", "function", "createRaw", "(", "$", "table", ",", "$", "identifier", ",", "$", "data", ")", "{", "$", "fields", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "fieldName", "=>", "$", "fieldVal", ")", "{", "$", "fields...
Writes the fixture into the database directly using a database manipulation. Does not use blueprints. Only supports tables with a primary key. @param string $table Existing database table name @param string $identifier Unique identifier for this fixture type @param array $data Map of properties @return int Database id...
[ "Writes", "the", "fixture", "into", "the", "database", "directly", "using", "a", "database", "manipulation", ".", "Does", "not", "use", "blueprints", ".", "Only", "supports", "tables", "with", "a", "primary", "key", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/FixtureFactory.php#L105-L117
train
silverstripe/silverstripe-framework
src/Dev/FixtureFactory.php
FixtureFactory.getId
public function getId($class, $identifier) { if (isset($this->fixtures[$class][$identifier])) { return $this->fixtures[$class][$identifier]; } else { return false; } }
php
public function getId($class, $identifier) { if (isset($this->fixtures[$class][$identifier])) { return $this->fixtures[$class][$identifier]; } else { return false; } }
[ "public", "function", "getId", "(", "$", "class", ",", "$", "identifier", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "fixtures", "[", "$", "class", "]", "[", "$", "identifier", "]", ")", ")", "{", "return", "$", "this", "->", "fixtures",...
Get the ID of an object from the fixture. @param string $class The data class, as specified in your fixture file. Parent classes won't work @param string $identifier The identifier string, as provided in your fixture file @return int
[ "Get", "the", "ID", "of", "an", "object", "from", "the", "fixture", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/FixtureFactory.php#L126-L133
train
silverstripe/silverstripe-framework
src/Dev/FixtureFactory.php
FixtureFactory.get
public function get($class, $identifier) { $id = $this->getId($class, $identifier); if (!$id) { return null; } // If the class doesn't exist, look for a table instead if (!class_exists($class)) { $tableNames = DataObject::getSchema()->getTableNames();...
php
public function get($class, $identifier) { $id = $this->getId($class, $identifier); if (!$id) { return null; } // If the class doesn't exist, look for a table instead if (!class_exists($class)) { $tableNames = DataObject::getSchema()->getTableNames();...
[ "public", "function", "get", "(", "$", "class", ",", "$", "identifier", ")", "{", "$", "id", "=", "$", "this", "->", "getId", "(", "$", "class", ",", "$", "identifier", ")", ";", "if", "(", "!", "$", "id", ")", "{", "return", "null", ";", "}", ...
Get an object from the fixture. @param string $class The data class or table name, as specified in your fixture file. Parent classes won't work @param string $identifier The identifier string, as provided in your fixture file @return DataObject
[ "Get", "an", "object", "from", "the", "fixture", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/FixtureFactory.php#L169-L187
train
silverstripe/silverstripe-framework
src/Core/TempFolder.php
TempFolder.getTempFolder
public static function getTempFolder($base) { $parent = static::getTempParentFolder($base); // The actual temp folder is a subfolder of getTempParentFolder(), named by username $subfolder = Path::join($parent, static::getTempFolderUsername()); if (!@file_exists($subfolder)) { ...
php
public static function getTempFolder($base) { $parent = static::getTempParentFolder($base); // The actual temp folder is a subfolder of getTempParentFolder(), named by username $subfolder = Path::join($parent, static::getTempFolderUsername()); if (!@file_exists($subfolder)) { ...
[ "public", "static", "function", "getTempFolder", "(", "$", "base", ")", "{", "$", "parent", "=", "static", "::", "getTempParentFolder", "(", "$", "base", ")", ";", "// The actual temp folder is a subfolder of getTempParentFolder(), named by username", "$", "subfolder", ...
Returns the temporary folder path that silverstripe should use for its cache files. @param string $base The base path to use for determining the temporary path @return string Path to temp
[ "Returns", "the", "temporary", "folder", "path", "that", "silverstripe", "should", "use", "for", "its", "cache", "files", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/TempFolder.php#L18-L30
train
silverstripe/silverstripe-framework
src/Core/TempFolder.php
TempFolder.getTempFolderUsername
public static function getTempFolderUsername() { $user = Environment::getEnv('APACHE_RUN_USER'); if (!$user) { $user = Environment::getEnv('USER'); } if (!$user) { $user = Environment::getEnv('USERNAME'); } if (!$user && function_exists('posix_...
php
public static function getTempFolderUsername() { $user = Environment::getEnv('APACHE_RUN_USER'); if (!$user) { $user = Environment::getEnv('USER'); } if (!$user) { $user = Environment::getEnv('USERNAME'); } if (!$user && function_exists('posix_...
[ "public", "static", "function", "getTempFolderUsername", "(", ")", "{", "$", "user", "=", "Environment", "::", "getEnv", "(", "'APACHE_RUN_USER'", ")", ";", "if", "(", "!", "$", "user", ")", "{", "$", "user", "=", "Environment", "::", "getEnv", "(", "'US...
Returns as best a representation of the current username as we can glean. @return string
[ "Returns", "as", "best", "a", "representation", "of", "the", "current", "username", "as", "we", "can", "glean", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/TempFolder.php#L37-L55
train
silverstripe/silverstripe-framework
src/Core/TempFolder.php
TempFolder.getTempParentFolder
protected static function getTempParentFolder($base) { // first, try finding a silverstripe-cache dir built off the base path $localPath = Path::join($base, 'silverstripe-cache'); if (@file_exists($localPath)) { if ((fileperms($localPath) & 0777) != 0777) { @chmod...
php
protected static function getTempParentFolder($base) { // first, try finding a silverstripe-cache dir built off the base path $localPath = Path::join($base, 'silverstripe-cache'); if (@file_exists($localPath)) { if ((fileperms($localPath) & 0777) != 0777) { @chmod...
[ "protected", "static", "function", "getTempParentFolder", "(", "$", "base", ")", "{", "// first, try finding a silverstripe-cache dir built off the base path", "$", "localPath", "=", "Path", "::", "join", "(", "$", "base", ",", "'silverstripe-cache'", ")", ";", "if", ...
Return the parent folder of the temp folder. The temp folder will be a subfolder of this, named by username. This structure prevents permission problems. @param string $base @return string @throws Exception
[ "Return", "the", "parent", "folder", "of", "the", "temp", "folder", ".", "The", "temp", "folder", "will", "be", "a", "subfolder", "of", "this", "named", "by", "username", ".", "This", "structure", "prevents", "permission", "problems", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/TempFolder.php#L66-L116
train
silverstripe/silverstripe-framework
src/i18n/Data/Sources.php
Sources.getSortedModules
public function getSortedModules() { $i18nOrder = Sources::config()->uninherited('module_priority'); $sortedModules = []; if ($i18nOrder) { Deprecation::notice('5.0', sprintf( '%s.module_priority is deprecated. Use %s.module_priority instead.', __C...
php
public function getSortedModules() { $i18nOrder = Sources::config()->uninherited('module_priority'); $sortedModules = []; if ($i18nOrder) { Deprecation::notice('5.0', sprintf( '%s.module_priority is deprecated. Use %s.module_priority instead.', __C...
[ "public", "function", "getSortedModules", "(", ")", "{", "$", "i18nOrder", "=", "Sources", "::", "config", "(", ")", "->", "uninherited", "(", "'module_priority'", ")", ";", "$", "sortedModules", "=", "[", "]", ";", "if", "(", "$", "i18nOrder", ")", "{",...
Get sorted modules @return array Array of module names -> path
[ "Get", "sorted", "modules" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/i18n/Data/Sources.php#L37-L54
train
silverstripe/silverstripe-framework
src/i18n/Data/Sources.php
Sources.getLangFiles
protected function getLangFiles() { if (static::$cache_lang_files) { return static::$cache_lang_files; } $locales = []; foreach ($this->getLangDirs() as $langPath) { $langFiles = scandir($langPath); foreach ($langFiles as $langFile) { ...
php
protected function getLangFiles() { if (static::$cache_lang_files) { return static::$cache_lang_files; } $locales = []; foreach ($this->getLangDirs() as $langPath) { $langFiles = scandir($langPath); foreach ($langFiles as $langFile) { ...
[ "protected", "function", "getLangFiles", "(", ")", "{", "if", "(", "static", "::", "$", "cache_lang_files", ")", "{", "return", "static", "::", "$", "cache_lang_files", ";", "}", "$", "locales", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "g...
Search directories for list of distinct locale filenames @return array Map of locale key => key of all distinct localisation file names
[ "Search", "directories", "for", "list", "of", "distinct", "locale", "filenames" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/i18n/Data/Sources.php#L111-L131
train
silverstripe/silverstripe-framework
src/Core/Injector/InjectorLoader.php
InjectorLoader.getManifest
public function getManifest() { if ($this !== self::$instance) { throw new BadMethodCallException( "Non-current injector manifest cannot be accessed. Please call ->activate() first" ); } if (empty($this->manifests)) { throw new BadMethodCal...
php
public function getManifest() { if ($this !== self::$instance) { throw new BadMethodCallException( "Non-current injector manifest cannot be accessed. Please call ->activate() first" ); } if (empty($this->manifests)) { throw new BadMethodCal...
[ "public", "function", "getManifest", "(", ")", "{", "if", "(", "$", "this", "!==", "self", "::", "$", "instance", ")", "{", "throw", "new", "BadMethodCallException", "(", "\"Non-current injector manifest cannot be accessed. Please call ->activate() first\"", ")", ";", ...
Returns the currently active class manifest instance that is used for loading classes. @return Injector
[ "Returns", "the", "currently", "active", "class", "manifest", "instance", "that", "is", "used", "for", "loading", "classes", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Injector/InjectorLoader.php#L37-L48
train
silverstripe/silverstripe-framework
src/Forms/CheckboxField.php
CheckboxField.performReadonlyTransformation
public function performReadonlyTransformation() { $field = new CheckboxField_Readonly($this->name, $this->title, $this->value); $field->setForm($this->form); return $field; }
php
public function performReadonlyTransformation() { $field = new CheckboxField_Readonly($this->name, $this->title, $this->value); $field->setForm($this->form); return $field; }
[ "public", "function", "performReadonlyTransformation", "(", ")", "{", "$", "field", "=", "new", "CheckboxField_Readonly", "(", "$", "this", "->", "name", ",", "$", "this", "->", "title", ",", "$", "this", "->", "value", ")", ";", "$", "field", "->", "set...
Returns a readonly version of this field
[ "Returns", "a", "readonly", "version", "of", "this", "field" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/CheckboxField.php#L51-L56
train
silverstripe/silverstripe-framework
src/Forms/GroupedDropdownField.php
GroupedDropdownField.getFieldOption
protected function getFieldOption($valueOrGroup, $titleOrOptions) { // Return flat option if (!is_array($titleOrOptions)) { return parent::getFieldOption($valueOrGroup, $titleOrOptions); } // Build children from options list $options = new ArrayList(); fo...
php
protected function getFieldOption($valueOrGroup, $titleOrOptions) { // Return flat option if (!is_array($titleOrOptions)) { return parent::getFieldOption($valueOrGroup, $titleOrOptions); } // Build children from options list $options = new ArrayList(); fo...
[ "protected", "function", "getFieldOption", "(", "$", "valueOrGroup", ",", "$", "titleOrOptions", ")", "{", "// Return flat option", "if", "(", "!", "is_array", "(", "$", "titleOrOptions", ")", ")", "{", "return", "parent", "::", "getFieldOption", "(", "$", "va...
Build a potentially nested fieldgroup @param mixed $valueOrGroup Value of item, or title of group @param string|array $titleOrOptions Title of item, or options in grouip @return ArrayData Data for this item
[ "Build", "a", "potentially", "nested", "fieldgroup" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/GroupedDropdownField.php#L69-L86
train
silverstripe/silverstripe-framework
src/Core/EnvironmentLoader.php
EnvironmentLoader.loadFile
public function loadFile($path, $overload = false) { // Not readable if (!file_exists($path) || !is_readable($path)) { return null; } // Parse and cleanup content $result = []; $variables = Parser::parse(file_get_contents($path)); foreach ($variab...
php
public function loadFile($path, $overload = false) { // Not readable if (!file_exists($path) || !is_readable($path)) { return null; } // Parse and cleanup content $result = []; $variables = Parser::parse(file_get_contents($path)); foreach ($variab...
[ "public", "function", "loadFile", "(", "$", "path", ",", "$", "overload", "=", "false", ")", "{", "// Not readable", "if", "(", "!", "file_exists", "(", "$", "path", ")", "||", "!", "is_readable", "(", "$", "path", ")", ")", "{", "return", "null", ";...
Load environment variables from .env file @param string $path Path to the file @param bool $overload Set to true to allow vars to overload. Recommended to leave false. @return array|null List of values parsed as an associative array, or null if not loaded If overloading, this list will reflect the final state for all ...
[ "Load", "environment", "variables", "from", ".", "env", "file" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/EnvironmentLoader.php#L21-L46
train
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldFilterHeader.php
GridFieldFilterHeader.handleAction
public function handleAction(GridField $gridField, $actionName, $arguments, $data) { if (!$this->checkDataType($gridField->getList())) { return; } $state = $gridField->State->GridFieldFilterHeader; $state->Columns = null; if ($actionName === 'filter') { ...
php
public function handleAction(GridField $gridField, $actionName, $arguments, $data) { if (!$this->checkDataType($gridField->getList())) { return; } $state = $gridField->State->GridFieldFilterHeader; $state->Columns = null; if ($actionName === 'filter') { ...
[ "public", "function", "handleAction", "(", "GridField", "$", "gridField", ",", "$", "actionName", ",", "$", "arguments", ",", "$", "data", ")", "{", "if", "(", "!", "$", "this", "->", "checkDataType", "(", "$", "gridField", "->", "getList", "(", ")", "...
If the GridField has a filterable datalist, return an array of actions @param GridField $gridField @return void
[ "If", "the", "GridField", "has", "a", "filterable", "datalist", "return", "an", "array", "of", "actions" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/GridField/GridFieldFilterHeader.php#L170-L185
train
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldFilterHeader.php
GridFieldFilterHeader.getSearchFieldSchema
public function getSearchFieldSchema(GridField $gridField) { $schemaUrl = Controller::join_links($gridField->Link(), 'schema/SearchForm'); $context = $this->getSearchContext($gridField); $params = $gridField->getRequest()->postVar('filter') ?: []; if (array_key_exists($gridField->ge...
php
public function getSearchFieldSchema(GridField $gridField) { $schemaUrl = Controller::join_links($gridField->Link(), 'schema/SearchForm'); $context = $this->getSearchContext($gridField); $params = $gridField->getRequest()->postVar('filter') ?: []; if (array_key_exists($gridField->ge...
[ "public", "function", "getSearchFieldSchema", "(", "GridField", "$", "gridField", ")", "{", "$", "schemaUrl", "=", "Controller", "::", "join_links", "(", "$", "gridField", "->", "Link", "(", ")", ",", "'schema/SearchForm'", ")", ";", "$", "context", "=", "$"...
Returns the search field schema for the component @param GridField $gridfield @return string
[ "Returns", "the", "search", "field", "schema", "for", "the", "component" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/GridField/GridFieldFilterHeader.php#L265-L307
train
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldFilterHeader.php
GridFieldFilterHeader.getSearchForm
public function getSearchForm(GridField $gridField) { $searchContext = $this->getSearchContext($gridField); $searchFields = $searchContext->getSearchFields(); if ($searchFields->count() === 0) { return null; } if ($this->searchForm) { return $this->s...
php
public function getSearchForm(GridField $gridField) { $searchContext = $this->getSearchContext($gridField); $searchFields = $searchContext->getSearchFields(); if ($searchFields->count() === 0) { return null; } if ($this->searchForm) { return $this->s...
[ "public", "function", "getSearchForm", "(", "GridField", "$", "gridField", ")", "{", "$", "searchContext", "=", "$", "this", "->", "getSearchContext", "(", "$", "gridField", ")", ";", "$", "searchFields", "=", "$", "searchContext", "->", "getSearchFields", "("...
Returns the search form for the component @param GridField $gridField @return Form|null
[ "Returns", "the", "search", "form", "for", "the", "component" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/GridField/GridFieldFilterHeader.php#L315-L372
train
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldFilterHeader.php
GridFieldFilterHeader.getSearchFormSchema
public function getSearchFormSchema(GridField $gridField) { $form = $this->getSearchForm($gridField); // If there are no filterable fields, return a 400 response if (!$form) { return new HTTPResponse(_t(__CLASS__ . '.SearchFormFaliure', 'No search form could be generated'), 400)...
php
public function getSearchFormSchema(GridField $gridField) { $form = $this->getSearchForm($gridField); // If there are no filterable fields, return a 400 response if (!$form) { return new HTTPResponse(_t(__CLASS__ . '.SearchFormFaliure', 'No search form could be generated'), 400)...
[ "public", "function", "getSearchFormSchema", "(", "GridField", "$", "gridField", ")", "{", "$", "form", "=", "$", "this", "->", "getSearchForm", "(", "$", "gridField", ")", ";", "// If there are no filterable fields, return a 400 response", "if", "(", "!", "$", "f...
Returns the search form schema for the component @param GridField $gridfield @return HTTPResponse
[ "Returns", "the", "search", "form", "schema", "for", "the", "component" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/GridField/GridFieldFilterHeader.php#L380-L397
train
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldFilterHeader.php
GridFieldFilterHeader.getHTMLFragments
public function getHTMLFragments($gridField) { $forTemplate = new ArrayData([]); if (!$this->canFilterAnyColumns($gridField)) { return null; } if ($this->useLegacyFilterHeader) { $fieldsList = $this->getLegacyFilterHeader($gridField); $forTemplat...
php
public function getHTMLFragments($gridField) { $forTemplate = new ArrayData([]); if (!$this->canFilterAnyColumns($gridField)) { return null; } if ($this->useLegacyFilterHeader) { $fieldsList = $this->getLegacyFilterHeader($gridField); $forTemplat...
[ "public", "function", "getHTMLFragments", "(", "$", "gridField", ")", "{", "$", "forTemplate", "=", "new", "ArrayData", "(", "[", "]", ")", ";", "if", "(", "!", "$", "this", "->", "canFilterAnyColumns", "(", "$", "gridField", ")", ")", "{", "return", "...
Either returns the legacy filter header or the search button and field @param GridField $gridField @return array|null
[ "Either", "returns", "the", "legacy", "filter", "header", "or", "the", "search", "button", "and", "field" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/GridField/GridFieldFilterHeader.php#L481-L508
train
silverstripe/silverstripe-framework
thirdparty/difflib/difflib.php
Diff.finalize
public function finalize() { $lines = array(); foreach ($this->edits as $edit) { if ($edit->final) array_splice($lines, sizeof($lines), 0, $edit->final); } return $lines; }
php
public function finalize() { $lines = array(); foreach ($this->edits as $edit) { if ($edit->final) array_splice($lines, sizeof($lines), 0, $edit->final); } return $lines; }
[ "public", "function", "finalize", "(", ")", "{", "$", "lines", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "edits", "as", "$", "edit", ")", "{", "if", "(", "$", "edit", "->", "final", ")", "array_splice", "(", "$", "lines", ",...
Get the final set of lines. This reconstructs the $to_lines parameter passed to the constructor. @return array The sequence of strings.
[ "Get", "the", "final", "set", "of", "lines", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/thirdparty/difflib/difflib.php#L590-L599
train
silverstripe/silverstripe-framework
src/Dev/Install/DatabaseAdapterRegistry.php
DatabaseAdapterRegistry.register
public static function register($config) { // Validate config $missing = array_diff(['title', 'class', 'helperClass', 'supported'], array_keys($config)); if ($missing) { throw new InvalidArgumentException( "Missing database helper config keys: '" . implode("', '",...
php
public static function register($config) { // Validate config $missing = array_diff(['title', 'class', 'helperClass', 'supported'], array_keys($config)); if ($missing) { throw new InvalidArgumentException( "Missing database helper config keys: '" . implode("', '",...
[ "public", "static", "function", "register", "(", "$", "config", ")", "{", "// Validate config", "$", "missing", "=", "array_diff", "(", "[", "'title'", ",", "'class'", ",", "'helperClass'", ",", "'supported'", "]", ",", "array_keys", "(", "$", "config", ")",...
Add new adapter to the registry @param array $config Associative array of configuration details. This must include: - title - class - helperClass - supported This SHOULD include: - fields - helperPath (if helperClass can't be autoloaded via psr-4/-0) - missingExtensionText - module OR missingModuleText
[ "Add", "new", "adapter", "to", "the", "registry" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/DatabaseAdapterRegistry.php#L69-L101
train
silverstripe/silverstripe-framework
src/Dev/Install/DatabaseAdapterRegistry.php
DatabaseAdapterRegistry.getDatabaseConfigurationHelper
public static function getDatabaseConfigurationHelper($databaseClass) { $adapters = static::get_adapters(); if (empty($adapters[$databaseClass]) || empty($adapters[$databaseClass]['helperClass'])) { return null; } // Load if path given if (isset($adapters[$databa...
php
public static function getDatabaseConfigurationHelper($databaseClass) { $adapters = static::get_adapters(); if (empty($adapters[$databaseClass]) || empty($adapters[$databaseClass]['helperClass'])) { return null; } // Load if path given if (isset($adapters[$databa...
[ "public", "static", "function", "getDatabaseConfigurationHelper", "(", "$", "databaseClass", ")", "{", "$", "adapters", "=", "static", "::", "get_adapters", "(", ")", ";", "if", "(", "empty", "(", "$", "adapters", "[", "$", "databaseClass", "]", ")", "||", ...
Build configuration helper for a given class @param string $databaseClass Name of class @return DatabaseConfigurationHelper|null Instance of helper, or null if cannot be loaded
[ "Build", "configuration", "helper", "for", "a", "given", "class" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/DatabaseAdapterRegistry.php#L199-L214
train
silverstripe/silverstripe-framework
src/Core/Config/Middleware/ExtensionMiddleware.php
ExtensionMiddleware.getExtraConfig
protected function getExtraConfig($class, $classConfig, $excludeMiddleware) { // Note: 'extensions' config needs to come from it's own middleware call in case // applied by delta middleware (e.g. Object::add_extension) $extensionSourceConfig = Config::inst()->get($class, null, Config::UNINHE...
php
protected function getExtraConfig($class, $classConfig, $excludeMiddleware) { // Note: 'extensions' config needs to come from it's own middleware call in case // applied by delta middleware (e.g. Object::add_extension) $extensionSourceConfig = Config::inst()->get($class, null, Config::UNINHE...
[ "protected", "function", "getExtraConfig", "(", "$", "class", ",", "$", "classConfig", ",", "$", "excludeMiddleware", ")", "{", "// Note: 'extensions' config needs to come from it's own middleware call in case", "// applied by delta middleware (e.g. Object::add_extension)", "$", "e...
Applied config to a class from its extensions @param string $class @param array $classConfig @param int $excludeMiddleware @return Generator
[ "Applied", "config", "to", "a", "class", "from", "its", "extensions" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Config/Middleware/ExtensionMiddleware.php#L55-L108
train
silverstripe/silverstripe-framework
src/Core/Startup/ErrorDirector.php
ErrorDirector.handleRequestWithTokenChain
public function handleRequestWithTokenChain( HTTPRequest $request, ConfirmationTokenChain $confirmationTokenChain, Kernel $kernel ) { Injector::inst()->registerService($request, HTTPRequest::class); // Next, check if we're in dev mode, or the database doesn't have any securi...
php
public function handleRequestWithTokenChain( HTTPRequest $request, ConfirmationTokenChain $confirmationTokenChain, Kernel $kernel ) { Injector::inst()->registerService($request, HTTPRequest::class); // Next, check if we're in dev mode, or the database doesn't have any securi...
[ "public", "function", "handleRequestWithTokenChain", "(", "HTTPRequest", "$", "request", ",", "ConfirmationTokenChain", "$", "confirmationTokenChain", ",", "Kernel", "$", "kernel", ")", "{", "Injector", "::", "inst", "(", ")", "->", "registerService", "(", "$", "r...
Redirect with token if allowed, or null if not allowed @param HTTPRequest $request @param ConfirmationTokenChain $confirmationTokenChain @param Kernel $kernel @return null|HTTPResponse Redirection response, or null if not able to redirect
[ "Redirect", "with", "token", "if", "allowed", "or", "null", "if", "not", "allowed" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Startup/ErrorDirector.php#L28-L49
train
silverstripe/silverstripe-framework
src/Security/MemberAuthenticator/LogoutHandler.php
LogoutHandler.logout
public function logout() { $member = Security::getCurrentUser(); // If the user doesn't have a security token, show them a form where they can get one. // This protects against nuisance CSRF attacks to log out users. if ($member && !SecurityToken::inst()->checkRequest($this->getRequ...
php
public function logout() { $member = Security::getCurrentUser(); // If the user doesn't have a security token, show them a form where they can get one. // This protects against nuisance CSRF attacks to log out users. if ($member && !SecurityToken::inst()->checkRequest($this->getRequ...
[ "public", "function", "logout", "(", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "// If the user doesn't have a security token, show them a form where they can get one.", "// This protects against nuisance CSRF attacks to log out users.", "if", ...
Log out form handler method This method is called when the user clicks on "logout" on the form created when the parameter <i>$checkCurrentUser</i> of the {@link __construct constructor} was set to TRUE and the user was currently logged in. @return array|HTTPResponse
[ "Log", "out", "form", "handler", "method" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/MemberAuthenticator/LogoutHandler.php#L51-L72
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.collateFamilyIDs
public function collateFamilyIDs() { if (!$this->exists()) { throw new \InvalidArgumentException("Cannot call collateFamilyIDs on unsaved Group."); } $familyIDs = array(); $chunkToAdd = array($this->ID); while ($chunkToAdd) { $familyIDs = array_merge...
php
public function collateFamilyIDs() { if (!$this->exists()) { throw new \InvalidArgumentException("Cannot call collateFamilyIDs on unsaved Group."); } $familyIDs = array(); $chunkToAdd = array($this->ID); while ($chunkToAdd) { $familyIDs = array_merge...
[ "public", "function", "collateFamilyIDs", "(", ")", "{", "if", "(", "!", "$", "this", "->", "exists", "(", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Cannot call collateFamilyIDs on unsaved Group.\"", ")", ";", "}", "$", "familyIDs"...
Return a set of this record's "family" of IDs - the IDs of this record and all its descendants. @return array
[ "Return", "a", "set", "of", "this", "record", "s", "family", "of", "IDs", "-", "the", "IDs", "of", "this", "record", "and", "all", "its", "descendants", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L352-L370
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.collateAncestorIDs
public function collateAncestorIDs() { $parent = $this; $items = []; while ($parent instanceof Group) { $items[] = $parent->ID; $parent = $parent->getParent(); } return $items; }
php
public function collateAncestorIDs() { $parent = $this; $items = []; while ($parent instanceof Group) { $items[] = $parent->ID; $parent = $parent->getParent(); } return $items; }
[ "public", "function", "collateAncestorIDs", "(", ")", "{", "$", "parent", "=", "$", "this", ";", "$", "items", "=", "[", "]", ";", "while", "(", "$", "parent", "instanceof", "Group", ")", "{", "$", "items", "[", "]", "=", "$", "parent", "->", "ID",...
Returns an array of the IDs of this group and all its parents @return array
[ "Returns", "an", "array", "of", "the", "IDs", "of", "this", "group", "and", "all", "its", "parents" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L377-L386
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.inGroups
public function inGroups($groups, $requireAll = false) { $ancestorIDs = $this->collateAncestorIDs(); $candidateIDs = []; foreach ($groups as $group) { $groupID = $this->identifierToGroupID($group); if ($groupID) { $candidateIDs[] = $groupID; ...
php
public function inGroups($groups, $requireAll = false) { $ancestorIDs = $this->collateAncestorIDs(); $candidateIDs = []; foreach ($groups as $group) { $groupID = $this->identifierToGroupID($group); if ($groupID) { $candidateIDs[] = $groupID; ...
[ "public", "function", "inGroups", "(", "$", "groups", ",", "$", "requireAll", "=", "false", ")", "{", "$", "ancestorIDs", "=", "$", "this", "->", "collateAncestorIDs", "(", ")", ";", "$", "candidateIDs", "=", "[", "]", ";", "foreach", "(", "$", "groups...
Check if the group is a child of the given groups or any parent groups @param (string|int|Group)[] $groups @param bool $requireAll set to TRUE if must be in ALL groups, or FALSE if must be in ANY @return bool Returns TRUE if the Group is a child of any of the given groups, otherwise FALSE
[ "Check", "if", "the", "group", "is", "a", "child", "of", "the", "given", "groups", "or", "any", "parent", "groups" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L406-L426
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.identifierToGroupID
protected function identifierToGroupID($groupID) { if (is_numeric($groupID) && Group::get()->byID($groupID)) { return $groupID; } elseif (is_string($groupID) && $groupByCode = Group::get()->filter(['Code' => $groupID])->first()) { return $groupByCode->ID; } elseif ($g...
php
protected function identifierToGroupID($groupID) { if (is_numeric($groupID) && Group::get()->byID($groupID)) { return $groupID; } elseif (is_string($groupID) && $groupByCode = Group::get()->filter(['Code' => $groupID])->first()) { return $groupByCode->ID; } elseif ($g...
[ "protected", "function", "identifierToGroupID", "(", "$", "groupID", ")", "{", "if", "(", "is_numeric", "(", "$", "groupID", ")", "&&", "Group", "::", "get", "(", ")", "->", "byID", "(", "$", "groupID", ")", ")", "{", "return", "$", "groupID", ";", "...
Turn a string|int|Group into a GroupID @param string|int|Group $groupID Group instance, Group Code or ID @return int|null the Group ID or NULL if not found
[ "Turn", "a", "string|int|Group", "into", "a", "GroupID" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L434-L444
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.stageChildren
public function stageChildren() { return Group::get() ->filter("ParentID", $this->ID) ->exclude("ID", $this->ID) ->sort('"Sort"'); }
php
public function stageChildren() { return Group::get() ->filter("ParentID", $this->ID) ->exclude("ID", $this->ID) ->sort('"Sort"'); }
[ "public", "function", "stageChildren", "(", ")", "{", "return", "Group", "::", "get", "(", ")", "->", "filter", "(", "\"ParentID\"", ",", "$", "this", "->", "ID", ")", "->", "exclude", "(", "\"ID\"", ",", "$", "this", "->", "ID", ")", "->", "sort", ...
Override this so groups are ordered in the CMS
[ "Override", "this", "so", "groups", "are", "ordered", "in", "the", "CMS" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L457-L463
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.canEdit
public function canEdit($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // extended access checks $results = $this->extend('canEdit', $member); if ($results && is_array($results)) { if (!min($results)) { retur...
php
public function canEdit($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // extended access checks $results = $this->extend('canEdit', $member); if ($results && is_array($results)) { if (!min($results)) { retur...
[ "public", "function", "canEdit", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "// extended access checks", "$", "results", "=", "$", "thi...
Checks for permission-code CMS_ACCESS_SecurityAdmin. If the group has ADMIN permissions, it requires the user to have ADMIN permissions as well. @param Member $member Member @return boolean
[ "Checks", "for", "permission", "-", "code", "CMS_ACCESS_SecurityAdmin", ".", "If", "the", "group", "has", "ADMIN", "permissions", "it", "requires", "the", "user", "to", "have", "ADMIN", "permissions", "as", "well", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L545-L573
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.canView
public function canView($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // extended access checks $results = $this->extend('canView', $member); if ($results && is_array($results)) { if (!min($results)) { retur...
php
public function canView($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // extended access checks $results = $this->extend('canView', $member); if ($results && is_array($results)) { if (!min($results)) { retur...
[ "public", "function", "canView", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "// extended access checks", "$", "results", "=", "$", "thi...
Checks for permission-code CMS_ACCESS_SecurityAdmin. @param Member $member @return boolean
[ "Checks", "for", "permission", "-", "code", "CMS_ACCESS_SecurityAdmin", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L581-L601
train
silverstripe/silverstripe-framework
src/Security/Group.php
Group.AllChildrenIncludingDeleted
public function AllChildrenIncludingDeleted() { $children = parent::AllChildrenIncludingDeleted(); $filteredChildren = new ArrayList(); if ($children) { foreach ($children as $child) { /** @var DataObject $child */ if ($child->canView()) { ...
php
public function AllChildrenIncludingDeleted() { $children = parent::AllChildrenIncludingDeleted(); $filteredChildren = new ArrayList(); if ($children) { foreach ($children as $child) { /** @var DataObject $child */ if ($child->canView()) { ...
[ "public", "function", "AllChildrenIncludingDeleted", "(", ")", "{", "$", "children", "=", "parent", "::", "AllChildrenIncludingDeleted", "(", ")", ";", "$", "filteredChildren", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "$", "children", ")", "{", "fo...
Returns all of the children for the CMS Tree. Filters to only those groups that the current user can edit @return ArrayList
[ "Returns", "all", "of", "the", "children", "for", "the", "CMS", "Tree", ".", "Filters", "to", "only", "those", "groups", "that", "the", "current", "user", "can", "edit" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/Group.php#L626-L642
train
silverstripe/silverstripe-framework
src/Dev/CSVParser.php
CSVParser.mapColumns
public function mapColumns($columnMap) { if ($columnMap) { $lowerColumnMap = array(); foreach ($columnMap as $k => $v) { $lowerColumnMap[strtolower($k)] = $v; } $this->columnMap = array_merge($this->columnMap, $lowerColumnMap); } ...
php
public function mapColumns($columnMap) { if ($columnMap) { $lowerColumnMap = array(); foreach ($columnMap as $k => $v) { $lowerColumnMap[strtolower($k)] = $v; } $this->columnMap = array_merge($this->columnMap, $lowerColumnMap); } ...
[ "public", "function", "mapColumns", "(", "$", "columnMap", ")", "{", "if", "(", "$", "columnMap", ")", "{", "$", "lowerColumnMap", "=", "array", "(", ")", ";", "foreach", "(", "$", "columnMap", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "lowerC...
Re-map columns in the CSV file. This can be useful for identifying synonyms in the file. For example: <code> $csv->mapColumns(array( 'firstname' => 'FirstName', 'last name' => 'Surname', )); </code> @param array
[ "Re", "-", "map", "columns", "in", "the", "CSV", "file", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CSVParser.php#L139-L150
train
silverstripe/silverstripe-framework
src/Dev/CSVParser.php
CSVParser.openFile
protected function openFile() { ini_set('auto_detect_line_endings', 1); $this->fileHandle = fopen($this->filename, 'r'); if ($this->providedHeaderRow) { $this->headerRow = $this->remapHeader($this->providedHeaderRow); } }
php
protected function openFile() { ini_set('auto_detect_line_endings', 1); $this->fileHandle = fopen($this->filename, 'r'); if ($this->providedHeaderRow) { $this->headerRow = $this->remapHeader($this->providedHeaderRow); } }
[ "protected", "function", "openFile", "(", ")", "{", "ini_set", "(", "'auto_detect_line_endings'", ",", "1", ")", ";", "$", "this", "->", "fileHandle", "=", "fopen", "(", "$", "this", "->", "filename", ",", "'r'", ")", ";", "if", "(", "$", "this", "->",...
Open the CSV file for reading.
[ "Open", "the", "CSV", "file", "for", "reading", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CSVParser.php#L169-L177
train
silverstripe/silverstripe-framework
src/Dev/CSVParser.php
CSVParser.closeFile
protected function closeFile() { if ($this->fileHandle) { fclose($this->fileHandle); } $this->fileHandle = null; $this->rowNum = 0; $this->currentRow = null; $this->headerRow = null; }
php
protected function closeFile() { if ($this->fileHandle) { fclose($this->fileHandle); } $this->fileHandle = null; $this->rowNum = 0; $this->currentRow = null; $this->headerRow = null; }
[ "protected", "function", "closeFile", "(", ")", "{", "if", "(", "$", "this", "->", "fileHandle", ")", "{", "fclose", "(", "$", "this", "->", "fileHandle", ")", ";", "}", "$", "this", "->", "fileHandle", "=", "null", ";", "$", "this", "->", "rowNum", ...
Close the CSV file and re-set all of the internal variables.
[ "Close", "the", "CSV", "file", "and", "re", "-", "set", "all", "of", "the", "internal", "variables", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CSVParser.php#L182-L192
train
silverstripe/silverstripe-framework
src/Dev/CSVParser.php
CSVParser.fetchCSVHeader
protected function fetchCSVHeader() { $srcRow = fgetcsv( $this->fileHandle, 0, $this->delimiter, $this->enclosure ); $this->headerRow = $this->remapHeader($srcRow); }
php
protected function fetchCSVHeader() { $srcRow = fgetcsv( $this->fileHandle, 0, $this->delimiter, $this->enclosure ); $this->headerRow = $this->remapHeader($srcRow); }
[ "protected", "function", "fetchCSVHeader", "(", ")", "{", "$", "srcRow", "=", "fgetcsv", "(", "$", "this", "->", "fileHandle", ",", "0", ",", "$", "this", "->", "delimiter", ",", "$", "this", "->", "enclosure", ")", ";", "$", "this", "->", "headerRow",...
Get a header row from the CSV file.
[ "Get", "a", "header", "row", "from", "the", "CSV", "file", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CSVParser.php#L198-L208
train
silverstripe/silverstripe-framework
src/View/ThemeManifest.php
ThemeManifest.getCacheKey
public function getCacheKey($includeTests = false) { return sha1(sprintf( "manifest-%s-%s-%u", $this->base, $this->project, $includeTests )); }
php
public function getCacheKey($includeTests = false) { return sha1(sprintf( "manifest-%s-%s-%u", $this->base, $this->project, $includeTests )); }
[ "public", "function", "getCacheKey", "(", "$", "includeTests", "=", "false", ")", "{", "return", "sha1", "(", "sprintf", "(", "\"manifest-%s-%s-%u\"", ",", "$", "this", "->", "base", ",", "$", "this", "->", "project", ",", "$", "includeTests", ")", ")", ...
Generate a unique cache key to avoid manifest cache collisions. We compartmentalise based on the base path, the given project, and whether or not we intend to include tests. @param bool $includeTests @return string
[ "Generate", "a", "unique", "cache", "key", "to", "avoid", "manifest", "cache", "collisions", ".", "We", "compartmentalise", "based", "on", "the", "base", "path", "the", "given", "project", "and", "whether", "or", "not", "we", "intend", "to", "include", "test...
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeManifest.php#L110-L118
train
silverstripe/silverstripe-framework
src/View/ThemeManifest.php
ThemeManifest.handleDirectory
public function handleDirectory($basename, $pathname, $depth) { if ($basename !== self::TEMPLATES_DIR) { return; } $dir = trim(substr(dirname($pathname), strlen($this->base)), '/\\'); $this->themes[] = "/" . $dir; }
php
public function handleDirectory($basename, $pathname, $depth) { if ($basename !== self::TEMPLATES_DIR) { return; } $dir = trim(substr(dirname($pathname), strlen($this->base)), '/\\'); $this->themes[] = "/" . $dir; }
[ "public", "function", "handleDirectory", "(", "$", "basename", ",", "$", "pathname", ",", "$", "depth", ")", "{", "if", "(", "$", "basename", "!==", "self", "::", "TEMPLATES_DIR", ")", "{", "return", ";", "}", "$", "dir", "=", "trim", "(", "substr", ...
Add a directory to the manifest @param string $basename @param string $pathname @param int $depth
[ "Add", "a", "directory", "to", "the", "manifest" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeManifest.php#L162-L169
train
silverstripe/silverstripe-framework
src/View/ThemeResourceLoader.php
ThemeResourceLoader.getSet
public function getSet($set) { if (isset($this->sets[$set])) { return $this->sets[$set]; } return null; }
php
public function getSet($set) { if (isset($this->sets[$set])) { return $this->sets[$set]; } return null; }
[ "public", "function", "getSet", "(", "$", "set", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "sets", "[", "$", "set", "]", ")", ")", "{", "return", "$", "this", "->", "sets", "[", "$", "set", "]", ";", "}", "return", "null", ";", "}...
Get a named theme set @param string $set @return ThemeList
[ "Get", "a", "named", "theme", "set" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeResourceLoader.php#L83-L89
train
silverstripe/silverstripe-framework
src/View/ThemeResourceLoader.php
ThemeResourceLoader.getPath
public function getPath($identifier) { $slashPos = strpos($identifier, '/'); $parts = explode(':', $identifier, 2); // If identifier starts with "/", it's a path from root if ($slashPos === 0) { if (count($parts) > 1) { throw new InvalidArgumentException(...
php
public function getPath($identifier) { $slashPos = strpos($identifier, '/'); $parts = explode(':', $identifier, 2); // If identifier starts with "/", it's a path from root if ($slashPos === 0) { if (count($parts) > 1) { throw new InvalidArgumentException(...
[ "public", "function", "getPath", "(", "$", "identifier", ")", "{", "$", "slashPos", "=", "strpos", "(", "$", "identifier", ",", "'/'", ")", ";", "$", "parts", "=", "explode", "(", "':'", ",", "$", "identifier", ",", "2", ")", ";", "// If identifier sta...
Given a theme identifier, determine the path from the root directory The mapping from $identifier to path follows these rules: - A simple theme name ('mytheme') which maps to the standard themes dir (/themes/mytheme) - A theme path with a leading slash ('/mymodule/themes/mytheme') which maps directly to that path. - o...
[ "Given", "a", "theme", "identifier", "determine", "the", "path", "from", "the", "root", "directory" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeResourceLoader.php#L105-L161
train
silverstripe/silverstripe-framework
src/View/ThemeResourceLoader.php
ThemeResourceLoader.findTemplate
public function findTemplate($template, $themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } // Look for a cached result for this data set $cacheKey = md5(json_encode($template) . json_encode($themes)); if ($this->getCache()->has($cacheKe...
php
public function findTemplate($template, $themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } // Look for a cached result for this data set $cacheKey = md5(json_encode($template) . json_encode($themes)); if ($this->getCache()->has($cacheKe...
[ "public", "function", "findTemplate", "(", "$", "template", ",", "$", "themes", "=", "null", ")", "{", "if", "(", "$", "themes", "===", "null", ")", "{", "$", "themes", "=", "SSViewer", "::", "get_themes", "(", ")", ";", "}", "// Look for a cached result...
Attempts to find possible candidate templates from a set of template names from modules, current theme directory and finally the application folder. The template names can be passed in as plain strings, or be in the format "type/name", where type is the type of template to search for (e.g. Includes, Layout). The resu...
[ "Attempts", "to", "find", "possible", "candidate", "templates", "from", "a", "set", "of", "template", "names", "from", "modules", "current", "theme", "directory", "and", "finally", "the", "application", "folder", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeResourceLoader.php#L185-L250
train
silverstripe/silverstripe-framework
src/View/ThemeResourceLoader.php
ThemeResourceLoader.findThemedJavascript
public function findThemedJavascript($name, $themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } if (substr($name, -3) !== '.js') { $name .= '.js'; } $filename = $this->findThemedResource("javascript/$name", $themes); ...
php
public function findThemedJavascript($name, $themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } if (substr($name, -3) !== '.js') { $name .= '.js'; } $filename = $this->findThemedResource("javascript/$name", $themes); ...
[ "public", "function", "findThemedJavascript", "(", "$", "name", ",", "$", "themes", "=", "null", ")", "{", "if", "(", "$", "themes", "===", "null", ")", "{", "$", "themes", "=", "SSViewer", "::", "get_themes", "(", ")", ";", "}", "if", "(", "substr",...
Resolve themed javascript path A javascript file in the current theme path name 'themename/javascript/$name.js' is first searched for, and it that doesn't exist and the module parameter is set then a javascript file with that name in the module is used. @param string $name The name of the file - eg '/js/File.js' woul...
[ "Resolve", "themed", "javascript", "path" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeResourceLoader.php#L288-L304
train
silverstripe/silverstripe-framework
src/View/ThemeResourceLoader.php
ThemeResourceLoader.findThemedResource
public function findThemedResource($resource, $themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } $paths = $this->getThemePaths($themes); foreach ($paths as $themePath) { $relativePath = Path::join($themePath, $resource); ...
php
public function findThemedResource($resource, $themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } $paths = $this->getThemePaths($themes); foreach ($paths as $themePath) { $relativePath = Path::join($themePath, $resource); ...
[ "public", "function", "findThemedResource", "(", "$", "resource", ",", "$", "themes", "=", "null", ")", "{", "if", "(", "$", "themes", "===", "null", ")", "{", "$", "themes", "=", "SSViewer", "::", "get_themes", "(", ")", ";", "}", "$", "paths", "=",...
Resolve a themed resource A themed resource and be any file that resides in a theme folder. @param string $resource A file path relative to the root folder of a theme @param array $themes An order listed of themes to search, Defaults to {@see SSViewer::get_themes()} @return string
[ "Resolve", "a", "themed", "resource" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeResourceLoader.php#L315-L333
train
silverstripe/silverstripe-framework
src/View/ThemeResourceLoader.php
ThemeResourceLoader.getThemePaths
public function getThemePaths($themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } $paths = []; foreach ($themes as $themename) { // Expand theme sets $set = $this->getSet($themename); $subthemes = $set ? $set-...
php
public function getThemePaths($themes = null) { if ($themes === null) { $themes = SSViewer::get_themes(); } $paths = []; foreach ($themes as $themename) { // Expand theme sets $set = $this->getSet($themename); $subthemes = $set ? $set-...
[ "public", "function", "getThemePaths", "(", "$", "themes", "=", "null", ")", "{", "if", "(", "$", "themes", "===", "null", ")", "{", "$", "themes", "=", "SSViewer", "::", "get_themes", "(", ")", ";", "}", "$", "paths", "=", "[", "]", ";", "foreach"...
Resolve all themes to the list of root folders relative to site root @param array $themes List of themes to resolve. Supports named theme sets. Defaults to {@see SSViewer::get_themes()}. @return array List of root-relative folders in order of precendence.
[ "Resolve", "all", "themes", "to", "the", "list", "of", "root", "folders", "relative", "to", "site", "root" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/ThemeResourceLoader.php#L341-L359
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.setUrl
public function setUrl($url) { $this->url = $url; // Normalize URL if its relative (strictly speaking), or has leading slashes if (Director::is_relative_url($url) || preg_match('/^\//', $url)) { $this->url = preg_replace(array('/\/+/','/^\//', '/\/$/'), array('/','',''), $this->...
php
public function setUrl($url) { $this->url = $url; // Normalize URL if its relative (strictly speaking), or has leading slashes if (Director::is_relative_url($url) || preg_match('/^\//', $url)) { $this->url = preg_replace(array('/\/+/','/^\//', '/\/$/'), array('/','',''), $this->...
[ "public", "function", "setUrl", "(", "$", "url", ")", "{", "$", "this", "->", "url", "=", "$", "url", ";", "// Normalize URL if its relative (strictly speaking), or has leading slashes", "if", "(", "Director", "::", "is_relative_url", "(", "$", "url", ")", "||", ...
Allow the setting of a URL This is here so that RootURLController can change the URL of the request without us loosing all the other info attached (like headers) @param string $url The new URL @return HTTPRequest The updated request
[ "Allow", "the", "setting", "of", "a", "URL" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L176-L195
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.addHeader
public function addHeader($header, $value) { $header = strtolower($header); $this->headers[$header] = $value; return $this; }
php
public function addHeader($header, $value) { $header = strtolower($header); $this->headers[$header] = $value; return $this; }
[ "public", "function", "addHeader", "(", "$", "header", ",", "$", "value", ")", "{", "$", "header", "=", "strtolower", "(", "$", "header", ")", ";", "$", "this", "->", "headers", "[", "$", "header", "]", "=", "$", "value", ";", "return", "$", "this"...
Add a HTTP header to the response, replacing any header of the same name. @param string $header Example: "content-type" @param string $value Example: "text/xml"
[ "Add", "a", "HTTP", "header", "to", "the", "response", "replacing", "any", "header", "of", "the", "same", "name", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L355-L360
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.getURL
public function getURL($includeGetVars = false) { $url = ($this->getExtension()) ? $this->url . '.' . $this->getExtension() : $this->url; if ($includeGetVars) { $vars = $this->getVars(); if (count($vars)) { $url .= '?' . http_build_query($vars); }...
php
public function getURL($includeGetVars = false) { $url = ($this->getExtension()) ? $this->url . '.' . $this->getExtension() : $this->url; if ($includeGetVars) { $vars = $this->getVars(); if (count($vars)) { $url .= '?' . http_build_query($vars); }...
[ "public", "function", "getURL", "(", "$", "includeGetVars", "=", "false", ")", "{", "$", "url", "=", "(", "$", "this", "->", "getExtension", "(", ")", ")", "?", "$", "this", "->", "url", ".", "'.'", ".", "$", "this", "->", "getExtension", "(", ")",...
Returns the URL used to generate the page @param bool $includeGetVars whether or not to include the get parameters\ @return string
[ "Returns", "the", "URL", "used", "to", "generate", "the", "page" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L402-L416
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.shiftAllParams
public function shiftAllParams() { $keys = array_keys($this->allParams); $values = array_values($this->allParams); $value = array_shift($values); // push additional unparsed URL parts onto the parameter stack if (array_key_exists($this->unshiftedButParsedParts, $this->...
php
public function shiftAllParams() { $keys = array_keys($this->allParams); $values = array_values($this->allParams); $value = array_shift($values); // push additional unparsed URL parts onto the parameter stack if (array_key_exists($this->unshiftedButParsedParts, $this->...
[ "public", "function", "shiftAllParams", "(", ")", "{", "$", "keys", "=", "array_keys", "(", "$", "this", "->", "allParams", ")", ";", "$", "values", "=", "array_values", "(", "$", "this", "->", "allParams", ")", ";", "$", "value", "=", "array_shift", "...
Shift all the parameter values down a key space, and return the shifted value. @return string
[ "Shift", "all", "the", "parameter", "values", "down", "a", "key", "space", "and", "return", "the", "shifted", "value", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L621-L637
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.isEmptyPattern
public function isEmptyPattern($pattern) { if (preg_match('/^([A-Za-z]+) +(.*)$/', $pattern, $matches)) { $pattern = $matches[2]; } if (trim($pattern) == "") { return true; } return false; }
php
public function isEmptyPattern($pattern) { if (preg_match('/^([A-Za-z]+) +(.*)$/', $pattern, $matches)) { $pattern = $matches[2]; } if (trim($pattern) == "") { return true; } return false; }
[ "public", "function", "isEmptyPattern", "(", "$", "pattern", ")", "{", "if", "(", "preg_match", "(", "'/^([A-Za-z]+) +(.*)$/'", ",", "$", "pattern", ",", "$", "matches", ")", ")", "{", "$", "pattern", "=", "$", "matches", "[", "2", "]", ";", "}", "if",...
Returns true if this is a URL that will match without shifting off any of the URL. This is used by the request handler to prevent infinite parsing loops. @param string $pattern @return bool
[ "Returns", "true", "if", "this", "is", "a", "URL", "that", "will", "match", "without", "shifting", "off", "any", "of", "the", "URL", ".", "This", "is", "used", "by", "the", "request", "handler", "to", "prevent", "infinite", "parsing", "loops", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L722-L732
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.shift
public function shift($count = 1) { $return = array(); if ($count == 1) { return array_shift($this->dirParts); } for ($i=0; $i<$count; $i++) { $value = array_shift($this->dirParts); if ($value === null) { break; } ...
php
public function shift($count = 1) { $return = array(); if ($count == 1) { return array_shift($this->dirParts); } for ($i=0; $i<$count; $i++) { $value = array_shift($this->dirParts); if ($value === null) { break; } ...
[ "public", "function", "shift", "(", "$", "count", "=", "1", ")", "{", "$", "return", "=", "array", "(", ")", ";", "if", "(", "$", "count", "==", "1", ")", "{", "return", "array_shift", "(", "$", "this", "->", "dirParts", ")", ";", "}", "for", "...
Shift one or more parts off the beginning of the URL. If you specify shifting more than 1 item off, then the items will be returned as an array @param int $count Shift Count @return string|array
[ "Shift", "one", "or", "more", "parts", "off", "the", "beginning", "of", "the", "URL", ".", "If", "you", "specify", "shifting", "more", "than", "1", "item", "off", "then", "the", "items", "will", "be", "returned", "as", "an", "array" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L741-L760
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.setIP
public function setIP($ip) { if (!filter_var($ip, FILTER_VALIDATE_IP)) { throw new InvalidArgumentException("Invalid ip $ip"); } $this->ip = $ip; return $this; }
php
public function setIP($ip) { if (!filter_var($ip, FILTER_VALIDATE_IP)) { throw new InvalidArgumentException("Invalid ip $ip"); } $this->ip = $ip; return $this; }
[ "public", "function", "setIP", "(", "$", "ip", ")", "{", "if", "(", "!", "filter_var", "(", "$", "ip", ",", "FILTER_VALIDATE_IP", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Invalid ip $ip\"", ")", ";", "}", "$", "this", "->", "ip"...
Sets the client IP address which originated this request. Use setIPFromHeaderValue if assigning from header value. @param $ip string @return $this
[ "Sets", "the", "client", "IP", "address", "which", "originated", "this", "request", ".", "Use", "setIPFromHeaderValue", "if", "assigning", "from", "header", "value", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L798-L805
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.getAcceptMimetypes
public function getAcceptMimetypes($includeQuality = false) { $mimetypes = array(); $mimetypesWithQuality = preg_split('#\s*,\s*#', $this->getHeader('accept')); foreach ($mimetypesWithQuality as $mimetypeWithQuality) { $mimetypes[] = ($includeQuality) ? $mimetypeWithQuality : pre...
php
public function getAcceptMimetypes($includeQuality = false) { $mimetypes = array(); $mimetypesWithQuality = preg_split('#\s*,\s*#', $this->getHeader('accept')); foreach ($mimetypesWithQuality as $mimetypeWithQuality) { $mimetypes[] = ($includeQuality) ? $mimetypeWithQuality : pre...
[ "public", "function", "getAcceptMimetypes", "(", "$", "includeQuality", "=", "false", ")", "{", "$", "mimetypes", "=", "array", "(", ")", ";", "$", "mimetypesWithQuality", "=", "preg_split", "(", "'#\\s*,\\s*#'", ",", "$", "this", "->", "getHeader", "(", "'a...
Returns all mimetypes from the HTTP "Accept" header as an array. @param boolean $includeQuality Don't strip away optional "quality indicators", e.g. "application/xml;q=0.9" (Default: false) @return array
[ "Returns", "all", "mimetypes", "from", "the", "HTTP", "Accept", "header", "as", "an", "array", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L815-L823
train
silverstripe/silverstripe-framework
src/Control/HTTPRequest.php
HTTPRequest.detect_method
public static function detect_method($origMethod, $postVars) { if (isset($postVars['_method'])) { if (!in_array(strtoupper($postVars['_method']), array('GET','POST','PUT','DELETE','HEAD'))) { user_error('HTTPRequest::detect_method(): Invalid "_method" parameter', E_USER_ERROR); ...
php
public static function detect_method($origMethod, $postVars) { if (isset($postVars['_method'])) { if (!in_array(strtoupper($postVars['_method']), array('GET','POST','PUT','DELETE','HEAD'))) { user_error('HTTPRequest::detect_method(): Invalid "_method" parameter', E_USER_ERROR); ...
[ "public", "static", "function", "detect_method", "(", "$", "origMethod", ",", "$", "postVars", ")", "{", "if", "(", "isset", "(", "$", "postVars", "[", "'_method'", "]", ")", ")", "{", "if", "(", "!", "in_array", "(", "strtoupper", "(", "$", "postVars"...
Gets the "real" HTTP method for a request. Used to work around browser limitations of form submissions to GET and POST, by overriding the HTTP method with a POST parameter called "_method" for PUT, DELETE, HEAD. Using GET for the "_method" override is not supported, as GET should never carry out state changes. Alterna...
[ "Gets", "the", "real", "HTTP", "method", "for", "a", "request", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/HTTPRequest.php#L873-L883
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBField.php
DBField.create_field
public static function create_field($spec, $value, $name = null, ...$args) { // Raise warning if inconsistent with DataObject::dbObject() behaviour // This will cause spec args to be shifted down by the number of provided $args if ($args && strpos($spec, '(') !== false) { trigger...
php
public static function create_field($spec, $value, $name = null, ...$args) { // Raise warning if inconsistent with DataObject::dbObject() behaviour // This will cause spec args to be shifted down by the number of provided $args if ($args && strpos($spec, '(') !== false) { trigger...
[ "public", "static", "function", "create_field", "(", "$", "spec", ",", "$", "value", ",", "$", "name", "=", "null", ",", "...", "$", "args", ")", "{", "// Raise warning if inconsistent with DataObject::dbObject() behaviour", "// This will cause spec args to be shifted dow...
Create a DBField object that's not bound to any particular field. Useful for accessing the classes behaviour for other parts of your code. @param string $spec Class specification to construct. May include both service name and additional constructor arguments in the same format as DataObject.db config. @param mixed $...
[ "Create", "a", "DBField", "object", "that", "s", "not", "bound", "to", "any", "particular", "field", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBField.php#L164-L178
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBField.php
DBField.setName
public function setName($name) { if ($this->name && $this->name !== $name) { user_error("DBField::setName() shouldn't be called once a DBField already has a name." . "It's partially immutable - it shouldn't be altered after it's given a value.", E_USER_WARNING); } ...
php
public function setName($name) { if ($this->name && $this->name !== $name) { user_error("DBField::setName() shouldn't be called once a DBField already has a name." . "It's partially immutable - it shouldn't be altered after it's given a value.", E_USER_WARNING); } ...
[ "public", "function", "setName", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "name", "&&", "$", "this", "->", "name", "!==", "$", "name", ")", "{", "user_error", "(", "\"DBField::setName() shouldn't be called once a DBField already has a name.\"", ...
Set the name of this field. The name should never be altered, but it if was never given a name in the first place you can set a name. If you try an alter the name a warning will be thrown. @param string $name @return $this
[ "Set", "the", "name", "of", "this", "field", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBField.php#L192-L202
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBField.php
DBField.prepValueForDB
public function prepValueForDB($value) { if ($value === null || $value === "" || $value === false || ($this->scalarValueOnly() && !is_scalar($value)) ) { return null; } else { return $value; } }
php
public function prepValueForDB($value) { if ($value === null || $value === "" || $value === false || ($this->scalarValueOnly() && !is_scalar($value)) ) { return null; } else { return $value; } }
[ "public", "function", "prepValueForDB", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "null", "||", "$", "value", "===", "\"\"", "||", "$", "value", "===", "false", "||", "(", "$", "this", "->", "scalarValueOnly", "(", ")", "&&", "!", ...
Return the transformed value ready to be sent to the database. This value will be escaped automatically by the prepared query processor, so it should not be escaped or quoted at all. @param $value mixed The value to check @return mixed The raw value, or escaped parameterised details
[ "Return", "the", "transformed", "value", "ready", "to", "be", "sent", "to", "the", "database", ".", "This", "value", "will", "be", "escaped", "automatically", "by", "the", "prepared", "query", "processor", "so", "it", "should", "not", "be", "escaped", "or", ...
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBField.php#L341-L352
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBField.php
DBField.saveInto
public function saveInto($dataObject) { $fieldName = $this->name; if (empty($fieldName)) { throw new \BadMethodCallException( "DBField::saveInto() Called on a nameless '" . static::class . "' object" ); } $dataObject->$fieldName = $this->value;...
php
public function saveInto($dataObject) { $fieldName = $this->name; if (empty($fieldName)) { throw new \BadMethodCallException( "DBField::saveInto() Called on a nameless '" . static::class . "' object" ); } $dataObject->$fieldName = $this->value;...
[ "public", "function", "saveInto", "(", "$", "dataObject", ")", "{", "$", "fieldName", "=", "$", "this", "->", "name", ";", "if", "(", "empty", "(", "$", "fieldName", ")", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "\"DBField::saveInto()...
Saves this field to the given data object. @param DataObject $dataObject
[ "Saves", "this", "field", "to", "the", "given", "data", "object", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBField.php#L537-L546
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBField.php
DBField.scaffoldFormField
public function scaffoldFormField($title = null, $params = null) { return TextField::create($this->name, $title); }
php
public function scaffoldFormField($title = null, $params = null) { return TextField::create($this->name, $title); }
[ "public", "function", "scaffoldFormField", "(", "$", "title", "=", "null", ",", "$", "params", "=", "null", ")", "{", "return", "TextField", "::", "create", "(", "$", "this", "->", "name", ",", "$", "title", ")", ";", "}" ]
Returns a FormField instance used as a default for form scaffolding. Used by {@link SearchContext}, {@link ModelAdmin}, {@link DataObject::scaffoldFormFields()} @param string $title Optional. Localized title of the generated instance @param array $params @return FormField
[ "Returns", "a", "FormField", "instance", "used", "as", "a", "default", "for", "form", "scaffolding", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBField.php#L558-L561
train
silverstripe/silverstripe-framework
thirdparty/php-peg/Compiler.php
Rule.compile
function compile($indent) { $function_name = $this->function_name( $this->name ) ; // Build the typestack $typestack = array(); $class=$this; do { $typestack[] = $this->function_name($class->name); } while($class = $class->extends); $typestack = "array('" . implode("','", $typestack) . "')"; /...
php
function compile($indent) { $function_name = $this->function_name( $this->name ) ; // Build the typestack $typestack = array(); $class=$this; do { $typestack[] = $this->function_name($class->name); } while($class = $class->extends); $typestack = "array('" . implode("','", $typestack) . "')"; /...
[ "function", "compile", "(", "$", "indent", ")", "{", "$", "function_name", "=", "$", "this", "->", "function_name", "(", "$", "this", "->", "name", ")", ";", "// Build the typestack", "$", "typestack", "=", "array", "(", ")", ";", "$", "class", "=", "$...
Generate the PHP code for a function to match against a string for this rule
[ "Generate", "the", "PHP", "code", "for", "a", "function", "to", "match", "against", "a", "string", "for", "this", "rule" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/thirdparty/php-peg/Compiler.php#L714-L758
train
silverstripe/silverstripe-framework
src/ORM/Queries/SQLDelete.php
SQLDelete.addDelete
public function addDelete($tables) { if (is_array($tables)) { $this->delete = array_merge($this->delete, $tables); } elseif (!empty($tables)) { $this->delete[str_replace(array('"','`'), '', $tables)] = $tables; } return $this; }
php
public function addDelete($tables) { if (is_array($tables)) { $this->delete = array_merge($this->delete, $tables); } elseif (!empty($tables)) { $this->delete[str_replace(array('"','`'), '', $tables)] = $tables; } return $this; }
[ "public", "function", "addDelete", "(", "$", "tables", ")", "{", "if", "(", "is_array", "(", "$", "tables", ")", ")", "{", "$", "this", "->", "delete", "=", "array_merge", "(", "$", "this", "->", "delete", ",", "$", "tables", ")", ";", "}", "elseif...
Sets the list of tables to limit the delete to, if multiple tables are specified in the condition clause @param string|array $tables Escaped SQL statement, usually an unquoted table name @return $this Self reference
[ "Sets", "the", "list", "of", "tables", "to", "limit", "the", "delete", "to", "if", "multiple", "tables", "are", "specified", "in", "the", "condition", "clause" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLDelete.php#L83-L91
train
silverstripe/silverstripe-framework
src/i18n/Messages/Symfony/SymfonyMessageProvider.php
SymfonyMessageProvider.load
protected function load($locale) { if (isset($this->loadedLocales[$locale])) { return; } // Add full locale file. E.g. 'en_NZ' $this ->getTranslator() ->addResource('ss', $this->getSourceDirs(), $locale); // Add lang-only file. E.g. 'en' ...
php
protected function load($locale) { if (isset($this->loadedLocales[$locale])) { return; } // Add full locale file. E.g. 'en_NZ' $this ->getTranslator() ->addResource('ss', $this->getSourceDirs(), $locale); // Add lang-only file. E.g. 'en' ...
[ "protected", "function", "load", "(", "$", "locale", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "loadedLocales", "[", "$", "locale", "]", ")", ")", "{", "return", ";", "}", "// Add full locale file. E.g. 'en_NZ'", "$", "this", "->", "getTranslat...
Load resources for the given locale @param string $locale
[ "Load", "resources", "for", "the", "given", "locale" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/i18n/Messages/Symfony/SymfonyMessageProvider.php#L64-L85
train
silverstripe/silverstripe-framework
src/i18n/Messages/Symfony/SymfonyMessageProvider.php
SymfonyMessageProvider.templateInjection
protected function templateInjection($injection) { $injection = $injection ?: []; // Rewrite injection to {} surrounded placeholders $arguments = array_combine( array_map(function ($val) { return '{' . $val . '}'; }, array_keys($injection)), ...
php
protected function templateInjection($injection) { $injection = $injection ?: []; // Rewrite injection to {} surrounded placeholders $arguments = array_combine( array_map(function ($val) { return '{' . $val . '}'; }, array_keys($injection)), ...
[ "protected", "function", "templateInjection", "(", "$", "injection", ")", "{", "$", "injection", "=", "$", "injection", "?", ":", "[", "]", ";", "// Rewrite injection to {} surrounded placeholders", "$", "arguments", "=", "array_combine", "(", "array_map", "(", "f...
Generate template safe injection parameters @param array $injection @return array Injection array with all keys surrounded with {} placeholders
[ "Generate", "template", "safe", "injection", "parameters" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/i18n/Messages/Symfony/SymfonyMessageProvider.php#L165-L176
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.schemaUpdate
public function schemaUpdate($callback) { // Begin schema update $this->schemaIsUpdating = true; // Update table list $this->tableList = array(); $tables = $this->tableList(); foreach ($tables as $table) { $this->tableList[strtolower($table)] = $table; ...
php
public function schemaUpdate($callback) { // Begin schema update $this->schemaIsUpdating = true; // Update table list $this->tableList = array(); $tables = $this->tableList(); foreach ($tables as $table) { $this->tableList[strtolower($table)] = $table; ...
[ "public", "function", "schemaUpdate", "(", "$", "callback", ")", "{", "// Begin schema update", "$", "this", "->", "schemaIsUpdating", "=", "true", ";", "// Update table list", "$", "this", "->", "tableList", "=", "array", "(", ")", ";", "$", "tables", "=", ...
Initiates a schema update within a single callback @param callable $callback
[ "Initiates", "a", "schema", "update", "within", "a", "single", "callback" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L143-L200
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.transCreateTable
public function transCreateTable($table, $options = null, $advanced_options = null) { $this->schemaUpdateTransaction[$table] = array( 'command' => 'create', 'newFields' => array(), 'newIndexes' => array(), 'options' => $options, 'advancedOptions' =...
php
public function transCreateTable($table, $options = null, $advanced_options = null) { $this->schemaUpdateTransaction[$table] = array( 'command' => 'create', 'newFields' => array(), 'newIndexes' => array(), 'options' => $options, 'advancedOptions' =...
[ "public", "function", "transCreateTable", "(", "$", "table", ",", "$", "options", "=", "null", ",", "$", "advanced_options", "=", "null", ")", "{", "$", "this", "->", "schemaUpdateTransaction", "[", "$", "table", "]", "=", "array", "(", "'command'", "=>", ...
Instruct the schema manager to record a table creation to later execute @param string $table Name of the table @param array $options Create table options (ENGINE, etc.) @param array $advanced_options Advanced table creation options
[ "Instruct", "the", "schema", "manager", "to", "record", "a", "table", "creation", "to", "later", "execute" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L240-L249
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.transAlterTable
public function transAlterTable($table, $options, $advanced_options) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['alteredOptions'] = $options; $this->schemaUpdateTransaction[$table]['advancedOptions'] = $advanced_options; }
php
public function transAlterTable($table, $options, $advanced_options) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['alteredOptions'] = $options; $this->schemaUpdateTransaction[$table]['advancedOptions'] = $advanced_options; }
[ "public", "function", "transAlterTable", "(", "$", "table", ",", "$", "options", ",", "$", "advanced_options", ")", "{", "$", "this", "->", "transInitTable", "(", "$", "table", ")", ";", "$", "this", "->", "schemaUpdateTransaction", "[", "$", "table", "]",...
Instruct the schema manager to record a table alteration to later execute @param string $table Name of the table @param array $options Create table options (ENGINE, etc.) @param array $advanced_options Advanced table creation options
[ "Instruct", "the", "schema", "manager", "to", "record", "a", "table", "alteration", "to", "later", "execute" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L258-L263
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.transCreateField
public function transCreateField($table, $field, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['newFields'][$field] = $schema; }
php
public function transCreateField($table, $field, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['newFields'][$field] = $schema; }
[ "public", "function", "transCreateField", "(", "$", "table", ",", "$", "field", ",", "$", "schema", ")", "{", "$", "this", "->", "transInitTable", "(", "$", "table", ")", ";", "$", "this", "->", "schemaUpdateTransaction", "[", "$", "table", "]", "[", "...
Instruct the schema manager to record a field to be later created @param string $table Name of the table to hold this field @param string $field Name of the field to create @param string $schema Field specification as a string
[ "Instruct", "the", "schema", "manager", "to", "record", "a", "field", "to", "be", "later", "created" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L272-L276
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.transCreateIndex
public function transCreateIndex($table, $index, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['newIndexes'][$index] = $schema; }
php
public function transCreateIndex($table, $index, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['newIndexes'][$index] = $schema; }
[ "public", "function", "transCreateIndex", "(", "$", "table", ",", "$", "index", ",", "$", "schema", ")", "{", "$", "this", "->", "transInitTable", "(", "$", "table", ")", ";", "$", "this", "->", "schemaUpdateTransaction", "[", "$", "table", "]", "[", "...
Instruct the schema manager to record an index to be later created @param string $table Name of the table to hold this index @param string $index Name of the index to create @param array $schema Already parsed index specification
[ "Instruct", "the", "schema", "manager", "to", "record", "an", "index", "to", "be", "later", "created" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L285-L289
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.transAlterField
public function transAlterField($table, $field, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['alteredFields'][$field] = $schema; }
php
public function transAlterField($table, $field, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['alteredFields'][$field] = $schema; }
[ "public", "function", "transAlterField", "(", "$", "table", ",", "$", "field", ",", "$", "schema", ")", "{", "$", "this", "->", "transInitTable", "(", "$", "table", ")", ";", "$", "this", "->", "schemaUpdateTransaction", "[", "$", "table", "]", "[", "'...
Instruct the schema manager to record a field to be later updated @param string $table Name of the table to hold this field @param string $field Name of the field to update @param string $schema Field specification as a string
[ "Instruct", "the", "schema", "manager", "to", "record", "a", "field", "to", "be", "later", "updated" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L298-L302
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.transAlterIndex
public function transAlterIndex($table, $index, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['alteredIndexes'][$index] = $schema; }
php
public function transAlterIndex($table, $index, $schema) { $this->transInitTable($table); $this->schemaUpdateTransaction[$table]['alteredIndexes'][$index] = $schema; }
[ "public", "function", "transAlterIndex", "(", "$", "table", ",", "$", "index", ",", "$", "schema", ")", "{", "$", "this", "->", "transInitTable", "(", "$", "table", ")", ";", "$", "this", "->", "schemaUpdateTransaction", "[", "$", "table", "]", "[", "'...
Instruct the schema manager to record an index to be later updated @param string $table Name of the table to hold this index @param string $index Name of the index to update @param array $schema Already parsed index specification
[ "Instruct", "the", "schema", "manager", "to", "record", "an", "index", "to", "be", "later", "updated" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L311-L315
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.determineIndexType
protected function determineIndexType($spec) { // check array spec if (is_array($spec) && isset($spec['type'])) { return $spec['type']; } elseif (!is_array($spec) && preg_match('/(?<type>\w+)\s*\(/', $spec, $matchType)) { return strtolower($matchType['type']); ...
php
protected function determineIndexType($spec) { // check array spec if (is_array($spec) && isset($spec['type'])) { return $spec['type']; } elseif (!is_array($spec) && preg_match('/(?<type>\w+)\s*\(/', $spec, $matchType)) { return strtolower($matchType['type']); ...
[ "protected", "function", "determineIndexType", "(", "$", "spec", ")", "{", "// check array spec", "if", "(", "is_array", "(", "$", "spec", ")", "&&", "isset", "(", "$", "spec", "[", "'type'", "]", ")", ")", "{", "return", "$", "spec", "[", "'type'", "]...
Given an index spec determines the index type @param array|string $spec @return string
[ "Given", "an", "index", "spec", "determines", "the", "index", "type" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L577-L587
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.hasField
public function hasField($tableName, $fieldName) { if (!$this->hasTable($tableName)) { return false; } $fields = $this->fieldList($tableName); return array_key_exists($fieldName, $fields); }
php
public function hasField($tableName, $fieldName) { if (!$this->hasTable($tableName)) { return false; } $fields = $this->fieldList($tableName); return array_key_exists($fieldName, $fields); }
[ "public", "function", "hasField", "(", "$", "tableName", ",", "$", "fieldName", ")", "{", "if", "(", "!", "$", "this", "->", "hasTable", "(", "$", "tableName", ")", ")", "{", "return", "false", ";", "}", "$", "fields", "=", "$", "this", "->", "fiel...
Return true if the table exists and already has a the field specified @param string $tableName - The table to check @param string $fieldName - The field to check @return bool - True if the table exists and the field exists on the table
[ "Return", "true", "if", "the", "table", "exists", "and", "already", "has", "a", "the", "field", "specified" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L637-L644
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.alterationMessage
public function alterationMessage($message, $type = "") { if (!$this->supressOutput) { if (Director::is_cli()) { switch ($type) { case "created": case "changed": case "repaired": $sign = "+"; ...
php
public function alterationMessage($message, $type = "") { if (!$this->supressOutput) { if (Director::is_cli()) { switch ($type) { case "created": case "changed": case "repaired": $sign = "+"; ...
[ "public", "function", "alterationMessage", "(", "$", "message", ",", "$", "type", "=", "\"\"", ")", "{", "if", "(", "!", "$", "this", "->", "supressOutput", ")", "{", "if", "(", "Director", "::", "is_cli", "(", ")", ")", "{", "switch", "(", "$", "t...
Show a message about database alteration @param string $message to display @param string $type one of [created|changed|repaired|obsolete|deleted|error]
[ "Show", "a", "message", "about", "database", "alteration" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L786-L840
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBSchemaManager.php
DBSchemaManager.fixTableCase
public function fixTableCase($tableName) { // Check if table exists $tables = $this->tableList(); if (!array_key_exists(strtolower($tableName), $tables)) { return; } // Check if case differs $currentName = $tables[strtolower($tableName)]; if ($cur...
php
public function fixTableCase($tableName) { // Check if table exists $tables = $this->tableList(); if (!array_key_exists(strtolower($tableName), $tables)) { return; } // Check if case differs $currentName = $tables[strtolower($tableName)]; if ($cur...
[ "public", "function", "fixTableCase", "(", "$", "tableName", ")", "{", "// Check if table exists", "$", "tables", "=", "$", "this", "->", "tableList", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "strtolower", "(", "$", "tableName", ")", ",", "$...
Ensure the given table has the correct case @param string $tableName Name of table in desired case
[ "Ensure", "the", "given", "table", "has", "the", "correct", "case" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBSchemaManager.php#L865-L888
train
silverstripe/silverstripe-framework
src/Dev/Tasks/i18nTextCollectorTask.php
i18nTextCollectorTask.getIsMerge
protected function getIsMerge($request) { $merge = $request->getVar('merge'); // Default to true if not given if (!isset($merge)) { return true; } // merge=0 or merge=false will disable merge return !in_array($merge, array('0', 'false')); }
php
protected function getIsMerge($request) { $merge = $request->getVar('merge'); // Default to true if not given if (!isset($merge)) { return true; } // merge=0 or merge=false will disable merge return !in_array($merge, array('0', 'false')); }
[ "protected", "function", "getIsMerge", "(", "$", "request", ")", "{", "$", "merge", "=", "$", "request", "->", "getVar", "(", "'merge'", ")", ";", "// Default to true if not given", "if", "(", "!", "isset", "(", "$", "merge", ")", ")", "{", "return", "tr...
Check if we should merge @param HTTPRequest $request @return bool
[ "Check", "if", "we", "should", "merge" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Tasks/i18nTextCollectorTask.php#L72-L83
train
silverstripe/silverstripe-framework
src/ORM/ManyManyList.php
ManyManyList.linkJoinTable
protected function linkJoinTable() { // Join to the many-many join table $dataClassIDColumn = DataObject::getSchema()->sqlColumnForField($this->dataClass(), 'ID'); $this->dataQuery->innerJoin( $this->joinTable, "\"{$this->joinTable}\".\"{$this->localKey}\" = {$dataCla...
php
protected function linkJoinTable() { // Join to the many-many join table $dataClassIDColumn = DataObject::getSchema()->sqlColumnForField($this->dataClass(), 'ID'); $this->dataQuery->innerJoin( $this->joinTable, "\"{$this->joinTable}\".\"{$this->localKey}\" = {$dataCla...
[ "protected", "function", "linkJoinTable", "(", ")", "{", "// Join to the many-many join table", "$", "dataClassIDColumn", "=", "DataObject", "::", "getSchema", "(", ")", "->", "sqlColumnForField", "(", "$", "this", "->", "dataClass", "(", ")", ",", "'ID'", ")", ...
Setup the join between this dataobject and the necessary mapping table
[ "Setup", "the", "join", "between", "this", "dataobject", "and", "the", "necessary", "mapping", "table" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/ManyManyList.php#L77-L90
train
silverstripe/silverstripe-framework
src/ORM/ManyManyList.php
ManyManyList.createDataObject
public function createDataObject($row) { // remove any composed fields $add = []; if ($this->_compositeExtraFields) { foreach ($this->_compositeExtraFields as $fieldName => $composed) { // convert joined extra fields into their composite field types. ...
php
public function createDataObject($row) { // remove any composed fields $add = []; if ($this->_compositeExtraFields) { foreach ($this->_compositeExtraFields as $fieldName => $composed) { // convert joined extra fields into their composite field types. ...
[ "public", "function", "createDataObject", "(", "$", "row", ")", "{", "// remove any composed fields", "$", "add", "=", "[", "]", ";", "if", "(", "$", "this", "->", "_compositeExtraFields", ")", "{", "foreach", "(", "$", "this", "->", "_compositeExtraFields", ...
Create a DataObject from the given SQL row. @param array $row @return DataObject
[ "Create", "a", "DataObject", "from", "the", "given", "SQL", "row", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/ManyManyList.php#L130-L162
train
silverstripe/silverstripe-framework
src/ORM/ManyManyList.php
ManyManyList.foreignIDFilter
protected function foreignIDFilter($id = null) { if ($id === null) { $id = $this->getForeignID(); } // Apply relation filter $key = "\"{$this->joinTable}\".\"{$this->foreignKey}\""; if (is_array($id)) { return ["$key IN (" . DB::placeholders($id) . ")...
php
protected function foreignIDFilter($id = null) { if ($id === null) { $id = $this->getForeignID(); } // Apply relation filter $key = "\"{$this->joinTable}\".\"{$this->foreignKey}\""; if (is_array($id)) { return ["$key IN (" . DB::placeholders($id) . ")...
[ "protected", "function", "foreignIDFilter", "(", "$", "id", "=", "null", ")", "{", "if", "(", "$", "id", "===", "null", ")", "{", "$", "id", "=", "$", "this", "->", "getForeignID", "(", ")", ";", "}", "// Apply relation filter", "$", "key", "=", "\"\...
Return a filter expression for when getting the contents of the relationship for some foreign ID @param int|null|string|array $id @return array
[ "Return", "a", "filter", "expression", "for", "when", "getting", "the", "contents", "of", "the", "relationship", "for", "some", "foreign", "ID" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/ManyManyList.php#L172-L187
train
silverstripe/silverstripe-framework
src/ORM/ManyManyList.php
ManyManyList.getExtraData
public function getExtraData($componentName, $itemID) { $result = []; // Skip if no extrafields or unsaved record if (empty($this->extraFields) || empty($itemID)) { return $result; } if (!is_numeric($itemID)) { throw new InvalidArgumentException('Man...
php
public function getExtraData($componentName, $itemID) { $result = []; // Skip if no extrafields or unsaved record if (empty($this->extraFields) || empty($itemID)) { return $result; } if (!is_numeric($itemID)) { throw new InvalidArgumentException('Man...
[ "public", "function", "getExtraData", "(", "$", "componentName", ",", "$", "itemID", ")", "{", "$", "result", "=", "[", "]", ";", "// Skip if no extrafields or unsaved record", "if", "(", "empty", "(", "$", "this", "->", "extraFields", ")", "||", "empty", "(...
Find the extra field data for a single row of the relationship join table, given the known child ID. @param string $componentName The name of the component @param int $itemID The ID of the child for the relationship @return array Map of fieldName => fieldValue
[ "Find", "the", "extra", "field", "data", "for", "a", "single", "row", "of", "the", "relationship", "join", "table", "given", "the", "known", "child", "ID", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/ManyManyList.php#L418-L453
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.AllChildrenIncludingDeleted
public function AllChildrenIncludingDeleted() { /** @var DataObject|Hierarchy|Versioned $owner */ $owner = $this->owner; $stageChildren = $owner->stageChildren(true); // Add live site content that doesn't exist on the stage site, if required. if ($owner->hasExtension(Version...
php
public function AllChildrenIncludingDeleted() { /** @var DataObject|Hierarchy|Versioned $owner */ $owner = $this->owner; $stageChildren = $owner->stageChildren(true); // Add live site content that doesn't exist on the stage site, if required. if ($owner->hasExtension(Version...
[ "public", "function", "AllChildrenIncludingDeleted", "(", ")", "{", "/** @var DataObject|Hierarchy|Versioned $owner */", "$", "owner", "=", "$", "this", "->", "owner", ";", "$", "stageChildren", "=", "$", "owner", "->", "stageChildren", "(", "true", ")", ";", "// ...
Return all children, including those that have been deleted but are still in live. - Deleted children will be marked as "DeletedFromStage" - Added children will be marked as "AddedToStage" - Modified children will be marked as "ModifiedOnStage" - Everything else has "SameOnStage" set, as an indicator that this informat...
[ "Return", "all", "children", "including", "those", "that", "have", "been", "deleted", "but", "are", "still", "in", "live", ".", "-", "Deleted", "children", "will", "be", "marked", "as", "DeletedFromStage", "-", "Added", "children", "will", "be", "marked", "a...
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L229-L248
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.AllHistoricalChildren
public function AllHistoricalChildren() { /** @var DataObject|Versioned|Hierarchy $owner */ $owner = $this->owner; if (!$owner->hasExtension(Versioned::class) || !$owner->hasStages()) { throw new Exception( 'Hierarchy->AllHistoricalChildren() only works with Versi...
php
public function AllHistoricalChildren() { /** @var DataObject|Versioned|Hierarchy $owner */ $owner = $this->owner; if (!$owner->hasExtension(Versioned::class) || !$owner->hasStages()) { throw new Exception( 'Hierarchy->AllHistoricalChildren() only works with Versi...
[ "public", "function", "AllHistoricalChildren", "(", ")", "{", "/** @var DataObject|Versioned|Hierarchy $owner */", "$", "owner", "=", "$", "this", "->", "owner", ";", "if", "(", "!", "$", "owner", "->", "hasExtension", "(", "Versioned", "::", "class", ")", "||",...
Return all the children that this page had, including pages that were deleted from both stage & live. @return DataList @throws Exception
[ "Return", "all", "the", "children", "that", "this", "page", "had", "including", "pages", "that", "were", "deleted", "from", "both", "stage", "&", "live", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L256-L273
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.showingCMSTree
public function showingCMSTree() { if (!Controller::has_curr() || !class_exists(LeftAndMain::class)) { return false; } $controller = Controller::curr(); return $controller instanceof LeftAndMain && in_array($controller->getAction(), array("treeview", "listview...
php
public function showingCMSTree() { if (!Controller::has_curr() || !class_exists(LeftAndMain::class)) { return false; } $controller = Controller::curr(); return $controller instanceof LeftAndMain && in_array($controller->getAction(), array("treeview", "listview...
[ "public", "function", "showingCMSTree", "(", ")", "{", "if", "(", "!", "Controller", "::", "has_curr", "(", ")", "||", "!", "class_exists", "(", "LeftAndMain", "::", "class", ")", ")", "{", "return", "false", ";", "}", "$", "controller", "=", "Controller...
Checks if we're on a controller where we should filter. ie. Are we loading the SiteTree? @return bool
[ "Checks", "if", "we", "re", "on", "a", "controller", "where", "we", "should", "filter", ".", "ie", ".", "Are", "we", "loading", "the", "SiteTree?" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L402-L410
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.stageChildren
public function stageChildren($showAll = false, $skipParentIDFilter = false) { $hideFromHierarchy = $this->owner->config()->hide_from_hierarchy; $hideFromCMSTree = $this->owner->config()->hide_from_cms_tree; $baseClass = $this->owner->baseClass(); $baseTable = $this->owner->baseTable...
php
public function stageChildren($showAll = false, $skipParentIDFilter = false) { $hideFromHierarchy = $this->owner->config()->hide_from_hierarchy; $hideFromCMSTree = $this->owner->config()->hide_from_cms_tree; $baseClass = $this->owner->baseClass(); $baseTable = $this->owner->baseTable...
[ "public", "function", "stageChildren", "(", "$", "showAll", "=", "false", ",", "$", "skipParentIDFilter", "=", "false", ")", "{", "$", "hideFromHierarchy", "=", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "hide_from_hierarchy", ";", "$", "h...
Return children in the stage site. @param bool $showAll Include all of the elements, even those not shown in the menus. Only applicable when extension is applied to {@link SiteTree}. @param bool $skipParentIDFilter Set to true to supress the ParentID and ID where statements. @return DataList
[ "Return", "children", "in", "the", "stage", "site", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L420-L450
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.liveChildren
public function liveChildren($showAll = false, $onlyDeletedFromStage = false) { /** @var Versioned|DataObject|Hierarchy $owner */ $owner = $this->owner; if (!$owner->hasExtension(Versioned::class) || !$owner->hasStages()) { throw new Exception('Hierarchy->liveChildren() only work...
php
public function liveChildren($showAll = false, $onlyDeletedFromStage = false) { /** @var Versioned|DataObject|Hierarchy $owner */ $owner = $this->owner; if (!$owner->hasExtension(Versioned::class) || !$owner->hasStages()) { throw new Exception('Hierarchy->liveChildren() only work...
[ "public", "function", "liveChildren", "(", "$", "showAll", "=", "false", ",", "$", "onlyDeletedFromStage", "=", "false", ")", "{", "/** @var Versioned|DataObject|Hierarchy $owner */", "$", "owner", "=", "$", "this", "->", "owner", ";", "if", "(", "!", "$", "ow...
Return children in the live site, if it exists. @param bool $showAll Include all of the elements, even those not shown in the menus. Only applicable when extension is applied to {@link SiteTree}. @param bool $onlyDeletedFromStage Only return items that have been deleted from stage @return DataList @throws...
[ "Return", "children", "in", "the", "live", "site", "if", "it", "exists", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L461-L489
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.getParent
public function getParent($filter = null) { $parentID = $this->owner->ParentID; if (empty($parentID)) { return null; } $baseClass = $this->owner->baseClass(); $idSQL = $this->owner->getSchema()->sqlColumnForField($baseClass, 'ID'); return DataObject::get_o...
php
public function getParent($filter = null) { $parentID = $this->owner->ParentID; if (empty($parentID)) { return null; } $baseClass = $this->owner->baseClass(); $idSQL = $this->owner->getSchema()->sqlColumnForField($baseClass, 'ID'); return DataObject::get_o...
[ "public", "function", "getParent", "(", "$", "filter", "=", "null", ")", "{", "$", "parentID", "=", "$", "this", "->", "owner", "->", "ParentID", ";", "if", "(", "empty", "(", "$", "parentID", ")", ")", "{", "return", "null", ";", "}", "$", "baseCl...
Get this object's parent, optionally filtered by an SQL clause. If the clause doesn't match the parent, nothing is returned. @param string $filter @return DataObject
[ "Get", "this", "object", "s", "parent", "optionally", "filtered", "by", "an", "SQL", "clause", ".", "If", "the", "clause", "doesn", "t", "match", "the", "parent", "nothing", "is", "returned", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L498-L510
train
silverstripe/silverstripe-framework
src/ORM/Hierarchy/Hierarchy.php
Hierarchy.getAncestors
public function getAncestors($includeSelf = false) { $ancestors = new ArrayList(); $object = $this->owner; if ($includeSelf) { $ancestors->push($object); } while ($object = $object->getParent()) { $ancestors->push($object); } return $...
php
public function getAncestors($includeSelf = false) { $ancestors = new ArrayList(); $object = $this->owner; if ($includeSelf) { $ancestors->push($object); } while ($object = $object->getParent()) { $ancestors->push($object); } return $...
[ "public", "function", "getAncestors", "(", "$", "includeSelf", "=", "false", ")", "{", "$", "ancestors", "=", "new", "ArrayList", "(", ")", ";", "$", "object", "=", "$", "this", "->", "owner", ";", "if", "(", "$", "includeSelf", ")", "{", "$", "ances...
Return all the parents of this class in a set ordered from the closest to furtherest parent. @param bool $includeSelf @return ArrayList
[ "Return", "all", "the", "parents", "of", "this", "class", "in", "a", "set", "ordered", "from", "the", "closest", "to", "furtherest", "parent", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Hierarchy/Hierarchy.php#L518-L531
train
silverstripe/silverstripe-framework
src/Dev/Install/Installer.php
Installer.writeConfigEnv
protected function writeConfigEnv($config) { if (!$config['usingEnv']) { return; } $path = $this->getBaseDir() . '.env'; $vars = []; // Retain existing vars $env = new EnvironmentLoader(); if (file_exists($path)) { $vars = $env->loadF...
php
protected function writeConfigEnv($config) { if (!$config['usingEnv']) { return; } $path = $this->getBaseDir() . '.env'; $vars = []; // Retain existing vars $env = new EnvironmentLoader(); if (file_exists($path)) { $vars = $env->loadF...
[ "protected", "function", "writeConfigEnv", "(", "$", "config", ")", "{", "if", "(", "!", "$", "config", "[", "'usingEnv'", "]", ")", "{", "return", ";", "}", "$", "path", "=", "$", "this", "->", "getBaseDir", "(", ")", ".", "'.env'", ";", "$", "var...
Write all .env files @param $config
[ "Write", "all", ".", "env", "files" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/Installer.php#L281-L341
train
silverstripe/silverstripe-framework
src/Dev/Install/Installer.php
Installer.writeToFile
public function writeToFile($filename, $content, $absolute = false) { // Get absolute / relative paths by either combining or removing base from path list($absolutePath, $relativePath) = $absolute ? [ $filename, substr($filename, strlen($this->getBaseDir()...
php
public function writeToFile($filename, $content, $absolute = false) { // Get absolute / relative paths by either combining or removing base from path list($absolutePath, $relativePath) = $absolute ? [ $filename, substr($filename, strlen($this->getBaseDir()...
[ "public", "function", "writeToFile", "(", "$", "filename", ",", "$", "content", ",", "$", "absolute", "=", "false", ")", "{", "// Get absolute / relative paths by either combining or removing base from path", "list", "(", "$", "absolutePath", ",", "$", "relativePath", ...
Write file to given location @param string $filename @param string $content @param bool $absolute If $filename is absolute path set to true @return bool
[ "Write", "file", "to", "given", "location" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/Installer.php#L439-L459
train
silverstripe/silverstripe-framework
src/Dev/Install/Installer.php
Installer.createHtaccess
public function createHtaccess() { $start = "### SILVERSTRIPE START ###\n"; $end = "\n### SILVERSTRIPE END ###"; $base = dirname($_SERVER['SCRIPT_NAME']); $base = Convert::slashes($base, '/'); if ($base != '.') { $baseClause = "RewriteBase '$base'\n"; } ...
php
public function createHtaccess() { $start = "### SILVERSTRIPE START ###\n"; $end = "\n### SILVERSTRIPE END ###"; $base = dirname($_SERVER['SCRIPT_NAME']); $base = Convert::slashes($base, '/'); if ($base != '.') { $baseClause = "RewriteBase '$base'\n"; } ...
[ "public", "function", "createHtaccess", "(", ")", "{", "$", "start", "=", "\"### SILVERSTRIPE START ###\\n\"", ";", "$", "end", "=", "\"\\n### SILVERSTRIPE END ###\"", ";", "$", "base", "=", "dirname", "(", "$", "_SERVER", "[", "'SCRIPT_NAME'", "]", ")", ";", ...
Ensure root .htaccess is setup
[ "Ensure", "root", ".", "htaccess", "is", "setup" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/Installer.php#L464-L555
train
silverstripe/silverstripe-framework
src/Dev/Install/Installer.php
Installer.createWebConfig
public function createWebConfig() { $content = <<<TEXT <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <security> <requestFiltering> <hiddenSegments applyToWebDAV="false"> <add segment="silverstripe-cache" /> ...
php
public function createWebConfig() { $content = <<<TEXT <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <security> <requestFiltering> <hiddenSegments applyToWebDAV="false"> <add segment="silverstripe-cache" /> ...
[ "public", "function", "createWebConfig", "(", ")", "{", "$", "content", "=", " <<<TEXT\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n <system.webServer>\n <security>\n <requestFiltering>\n <hiddenSegments applyToWebDAV=\"false\">\n ...
Writes basic configuration to the web.config for IIS so that rewriting capability can be use.
[ "Writes", "basic", "configuration", "to", "the", "web", ".", "config", "for", "IIS", "so", "that", "rewriting", "capability", "can", "be", "use", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/Installer.php#L561-L597
train
silverstripe/silverstripe-framework
src/View/GenericTemplateGlobalProvider.php
GenericTemplateGlobalProvider.ModulePath
public static function ModulePath($name) { // BC for a couple fo the key modules in the old syntax. Reduces merge brittleness but can // be removed before 4.0 stable $legacyMapping = [ 'framework' => 'silverstripe/framework', 'frameworkadmin' => 'silverstripe/admin', ...
php
public static function ModulePath($name) { // BC for a couple fo the key modules in the old syntax. Reduces merge brittleness but can // be removed before 4.0 stable $legacyMapping = [ 'framework' => 'silverstripe/framework', 'frameworkadmin' => 'silverstripe/admin', ...
[ "public", "static", "function", "ModulePath", "(", "$", "name", ")", "{", "// BC for a couple fo the key modules in the old syntax. Reduces merge brittleness but can", "// be removed before 4.0 stable", "$", "legacyMapping", "=", "[", "'framework'", "=>", "'silverstripe/framework'"...
Given some pre-defined modules, return the filesystem path of the module. @param string $name Name of module to find path of @return string
[ "Given", "some", "pre", "-", "defined", "modules", "return", "the", "filesystem", "path", "of", "the", "module", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/GenericTemplateGlobalProvider.php#L24-L37
train
silverstripe/silverstripe-framework
src/View/SSViewer_BasicIteratorSupport.php
SSViewer_BasicIteratorSupport.FirstLast
public function FirstLast() { if ($this->First() && $this->Last()) { return 'first last'; } if ($this->First()) { return 'first'; } if ($this->Last()) { return 'last'; } return null; }
php
public function FirstLast() { if ($this->First() && $this->Last()) { return 'first last'; } if ($this->First()) { return 'first'; } if ($this->Last()) { return 'last'; } return null; }
[ "public", "function", "FirstLast", "(", ")", "{", "if", "(", "$", "this", "->", "First", "(", ")", "&&", "$", "this", "->", "Last", "(", ")", ")", "{", "return", "'first last'", ";", "}", "if", "(", "$", "this", "->", "First", "(", ")", ")", "{...
Returns 'first' or 'last' if this is the first or last object in the set. @return string|null
[ "Returns", "first", "or", "last", "if", "this", "is", "the", "first", "or", "last", "object", "in", "the", "set", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer_BasicIteratorSupport.php#L80-L92
train
silverstripe/silverstripe-framework
src/Core/Manifest/Module.php
Module.getShortName
public function getShortName() { // If installed in the root directory we need to infer from composer if ($this->path === $this->basePath && $this->composerData) { // Sometimes we customise installer name if (isset($this->composerData['extra']['installer-name'])) { ...
php
public function getShortName() { // If installed in the root directory we need to infer from composer if ($this->path === $this->basePath && $this->composerData) { // Sometimes we customise installer name if (isset($this->composerData['extra']['installer-name'])) { ...
[ "public", "function", "getShortName", "(", ")", "{", "// If installed in the root directory we need to infer from composer", "if", "(", "$", "this", "->", "path", "===", "$", "this", "->", "basePath", "&&", "$", "this", "->", "composerData", ")", "{", "// Sometimes ...
Gets "short" name of this module. This is the base directory this module is installed in. If installed in root, this will be generated from the composer name instead @return string
[ "Gets", "short", "name", "of", "this", "module", ".", "This", "is", "the", "base", "directory", "this", "module", "is", "installed", "in", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/Module.php#L110-L129
train
silverstripe/silverstripe-framework
src/Core/Manifest/Module.php
Module.getResource
public function getResource($path) { $path = Path::normalise($path, true); if (empty($path)) { throw new InvalidArgumentException('$path is required'); } if (isset($this->resources[$path])) { return $this->resources[$path]; } return $this->reso...
php
public function getResource($path) { $path = Path::normalise($path, true); if (empty($path)) { throw new InvalidArgumentException('$path is required'); } if (isset($this->resources[$path])) { return $this->resources[$path]; } return $this->reso...
[ "public", "function", "getResource", "(", "$", "path", ")", "{", "$", "path", "=", "Path", "::", "normalise", "(", "$", "path", ",", "true", ")", ";", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(...
Get resource for this module @param string $path @return ModuleResource
[ "Get", "resource", "for", "this", "module" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/Module.php#L215-L225
train
silverstripe/silverstripe-framework
src/ORM/Connect/Database.php
Database.setSchemaManager
public function setSchemaManager(DBSchemaManager $schemaManager) { $this->schemaManager = $schemaManager; if ($this->schemaManager) { $this->schemaManager->setDatabase($this); } }
php
public function setSchemaManager(DBSchemaManager $schemaManager) { $this->schemaManager = $schemaManager; if ($this->schemaManager) { $this->schemaManager->setDatabase($this); } }
[ "public", "function", "setSchemaManager", "(", "DBSchemaManager", "$", "schemaManager", ")", "{", "$", "this", "->", "schemaManager", "=", "$", "schemaManager", ";", "if", "(", "$", "this", "->", "schemaManager", ")", "{", "$", "this", "->", "schemaManager", ...
Injector injection point for schema manager @param DBSchemaManager $schemaManager
[ "Injector", "injection", "point", "for", "schema", "manager" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/Database.php#L88-L95
train