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/ORM/Connect/MySQLiConnector.php
MySQLiConnector.parsePreparedParameters
public function parsePreparedParameters($parameters, &$blobs) { $types = ''; $values = array(); $blobs = array(); $parametersCount = count($parameters); for ($index = 0; $index < $parametersCount; $index++) { $value = $parameters[$index]; $phpType = ge...
php
public function parsePreparedParameters($parameters, &$blobs) { $types = ''; $values = array(); $blobs = array(); $parametersCount = count($parameters); for ($index = 0; $index < $parametersCount; $index++) { $value = $parameters[$index]; $phpType = ge...
[ "public", "function", "parsePreparedParameters", "(", "$", "parameters", ",", "&", "$", "blobs", ")", "{", "$", "types", "=", "''", ";", "$", "values", "=", "array", "(", ")", ";", "$", "blobs", "=", "array", "(", ")", ";", "$", "parametersCount", "=...
Prepares the list of parameters in preparation for passing to mysqli_stmt_bind_param @param array $parameters List of parameters @param array &$blobs Out parameter for list of blobs to bind separately @return array List of parameters appropriate for mysqli_stmt_bind_param function
[ "Prepares", "the", "list", "of", "parameters", "in", "preparation", "for", "passing", "to", "mysqli_stmt_bind_param" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLiConnector.php#L196-L250
train
silverstripe/silverstripe-framework
src/ORM/Connect/MySQLiConnector.php
MySQLiConnector.bindParameters
public function bindParameters(mysqli_stmt $statement, array $parameters) { // Because mysqli_stmt::bind_param arguments must be passed by reference // we need to do a bit of hackery $boundNames = []; $parametersCount = count($parameters); for ($i = 0; $i < $parametersCount; ...
php
public function bindParameters(mysqli_stmt $statement, array $parameters) { // Because mysqli_stmt::bind_param arguments must be passed by reference // we need to do a bit of hackery $boundNames = []; $parametersCount = count($parameters); for ($i = 0; $i < $parametersCount; ...
[ "public", "function", "bindParameters", "(", "mysqli_stmt", "$", "statement", ",", "array", "$", "parameters", ")", "{", "// Because mysqli_stmt::bind_param arguments must be passed by reference", "// we need to do a bit of hackery", "$", "boundNames", "=", "[", "]", ";", "...
Binds a list of parameters to a statement @param mysqli_stmt $statement MySQLi statement @param array $parameters List of parameters to pass to bind_param
[ "Binds", "a", "list", "of", "parameters", "to", "a", "statement" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLiConnector.php#L258-L270
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBTime.php
DBTime.Short
public function Short() { if (!$this->value) { return null; } $formatter = $this->getFormatter(IntlDateFormatter::SHORT); return $formatter->format($this->getTimestamp()); }
php
public function Short() { if (!$this->value) { return null; } $formatter = $this->getFormatter(IntlDateFormatter::SHORT); return $formatter->format($this->getTimestamp()); }
[ "public", "function", "Short", "(", ")", "{", "if", "(", "!", "$", "this", "->", "value", ")", "{", "return", "null", ";", "}", "$", "formatter", "=", "$", "this", "->", "getFormatter", "(", "IntlDateFormatter", "::", "SHORT", ")", ";", "return", "$"...
Returns the date in the localised short format @return string
[ "Returns", "the", "date", "in", "the", "localised", "short", "format" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBTime.php#L90-L97
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBTime.php
DBTime.Format
public function Format($format) { if (!$this->value) { return null; } $formatter = $this->getFormatter(); $formatter->setPattern($format); return $formatter->format($this->getTimestamp()); }
php
public function Format($format) { if (!$this->value) { return null; } $formatter = $this->getFormatter(); $formatter->setPattern($format); return $formatter->format($this->getTimestamp()); }
[ "public", "function", "Format", "(", "$", "format", ")", "{", "if", "(", "!", "$", "this", "->", "value", ")", "{", "return", "null", ";", "}", "$", "formatter", "=", "$", "this", "->", "getFormatter", "(", ")", ";", "$", "formatter", "->", "setPat...
Return the time using a particular formatting string. @param string $format Format code string. See http://userguide.icu-project.org/formatparse/datetime @return string The time in the requested format
[ "Return", "the", "time", "using", "a", "particular", "formatting", "string", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBTime.php#L120-L128
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBTime.php
DBTime.FormatFromSettings
public function FormatFromSettings($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // Fall back to nice if (!$member) { return $this->Nice(); } // Get user format $format = $member->getTimeFormat(); r...
php
public function FormatFromSettings($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // Fall back to nice if (!$member) { return $this->Nice(); } // Get user format $format = $member->getTimeFormat(); r...
[ "public", "function", "FormatFromSettings", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "// Fall back to nice", "if", "(", "!", "$", "me...
Return a time formatted as per a CMS user's settings. @param Member $member @return string A time formatted as per user-defined settings.
[ "Return", "a", "time", "formatted", "as", "per", "a", "CMS", "user", "s", "settings", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBTime.php#L154-L168
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.get_conn
public static function get_conn($name = 'default') { if (isset(self::$connections[$name])) { return self::$connections[$name]; } // lazy connect $config = static::getConfig($name); if ($config) { return static::connect($config, $name); } ...
php
public static function get_conn($name = 'default') { if (isset(self::$connections[$name])) { return self::$connections[$name]; } // lazy connect $config = static::getConfig($name); if ($config) { return static::connect($config, $name); } ...
[ "public", "static", "function", "get_conn", "(", "$", "name", "=", "'default'", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "connections", "[", "$", "name", "]", ")", ")", "{", "return", "self", "::", "$", "connections", "[", "$", "name", ...
Get the global database connection. @param string $name An optional name given to a connection in the DB::setConn() call. If omitted, the default connection is returned. @return Database
[ "Get", "the", "global", "database", "connection", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L99-L112
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.get_schema
public static function get_schema($name = 'default') { $connection = self::get_conn($name); if ($connection) { return $connection->getSchemaManager(); } return null; }
php
public static function get_schema($name = 'default') { $connection = self::get_conn($name); if ($connection) { return $connection->getSchemaManager(); } return null; }
[ "public", "static", "function", "get_schema", "(", "$", "name", "=", "'default'", ")", "{", "$", "connection", "=", "self", "::", "get_conn", "(", "$", "name", ")", ";", "if", "(", "$", "connection", ")", "{", "return", "$", "connection", "->", "getSch...
Retrieves the schema manager for the current database @param string $name An optional name given to a connection in the DB::setConn() call. If omitted, the default connection is returned. @return DBSchemaManager
[ "Retrieves", "the", "schema", "manager", "for", "the", "current", "database" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L131-L138
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.get_connector
public static function get_connector($name = 'default') { $connection = self::get_conn($name); if ($connection) { return $connection->getConnector(); } return null; }
php
public static function get_connector($name = 'default') { $connection = self::get_conn($name); if ($connection) { return $connection->getConnector(); } return null; }
[ "public", "static", "function", "get_connector", "(", "$", "name", "=", "'default'", ")", "{", "$", "connection", "=", "self", "::", "get_conn", "(", "$", "name", ")", ";", "if", "(", "$", "connection", ")", "{", "return", "$", "connection", "->", "get...
Retrieves the connector object for the current database @param string $name An optional name given to a connection in the DB::setConn() call. If omitted, the default connection is returned. @return DBConnector
[ "Retrieves", "the", "connector", "object", "for", "the", "current", "database" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L167-L174
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.set_alternative_database_name
public static function set_alternative_database_name($name = null) { // Ignore if disabled if (!Config::inst()->get(static::class, 'alternative_database_enabled')) { return; } // Skip if CLI if (Director::is_cli()) { return; } // Valida...
php
public static function set_alternative_database_name($name = null) { // Ignore if disabled if (!Config::inst()->get(static::class, 'alternative_database_enabled')) { return; } // Skip if CLI if (Director::is_cli()) { return; } // Valida...
[ "public", "static", "function", "set_alternative_database_name", "(", "$", "name", "=", "null", ")", "{", "// Ignore if disabled", "if", "(", "!", "Config", "::", "inst", "(", ")", "->", "get", "(", "static", "::", "class", ",", "'alternative_database_enabled'",...
Set an alternative database in a browser cookie, with the cookie lifetime set to the browser session. This is useful for integration testing on temporary databases. There is a strict naming convention for temporary databases to avoid abuse: <prefix> (default: 'ss_') + tmpdb + <7 digits> As an additional security measu...
[ "Set", "an", "alternative", "database", "in", "a", "browser", "cookie", "with", "the", "cookie", "lifetime", "set", "to", "the", "browser", "session", ".", "This", "is", "useful", "for", "integration", "testing", "on", "temporary", "databases", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L191-L220
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.get_alternative_database_name
public static function get_alternative_database_name() { // Ignore if disabled if (!Config::inst()->get(static::class, 'alternative_database_enabled')) { return false; } // Skip if CLI if (Director::is_cli()) { return false; } // Skip i...
php
public static function get_alternative_database_name() { // Ignore if disabled if (!Config::inst()->get(static::class, 'alternative_database_enabled')) { return false; } // Skip if CLI if (Director::is_cli()) { return false; } // Skip i...
[ "public", "static", "function", "get_alternative_database_name", "(", ")", "{", "// Ignore if disabled", "if", "(", "!", "Config", "::", "inst", "(", ")", "->", "get", "(", "static", "::", "class", ",", "'alternative_database_enabled'", ")", ")", "{", "return", ...
Get the name of the database in use @return string|false Name of temp database, or false if not set
[ "Get", "the", "name", "of", "the", "database", "in", "use" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L227-L254
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.valid_alternative_database_name
public static function valid_alternative_database_name($name) { if (Director::isLive() || empty($name)) { return false; } $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; $pattern = strtolower(sprintf('/^%stmpdb\d{7}$/', $prefix)); return (bool)preg_...
php
public static function valid_alternative_database_name($name) { if (Director::isLive() || empty($name)) { return false; } $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; $pattern = strtolower(sprintf('/^%stmpdb\d{7}$/', $prefix)); return (bool)preg_...
[ "public", "static", "function", "valid_alternative_database_name", "(", "$", "name", ")", "{", "if", "(", "Director", "::", "isLive", "(", ")", "||", "empty", "(", "$", "name", ")", ")", "{", "return", "false", ";", "}", "$", "prefix", "=", "Environment"...
Determines if the name is valid, as a security measure against setting arbitrary databases. @param string $name @return bool
[ "Determines", "if", "the", "name", "is", "valid", "as", "a", "security", "measure", "against", "setting", "arbitrary", "databases", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L263-L272
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.connect
public static function connect($databaseConfig, $label = 'default') { // This is used by the "testsession" module to test up a test session using an alternative name if ($name = self::get_alternative_database_name()) { $databaseConfig['database'] = $name; } if (!isset($d...
php
public static function connect($databaseConfig, $label = 'default') { // This is used by the "testsession" module to test up a test session using an alternative name if ($name = self::get_alternative_database_name()) { $databaseConfig['database'] = $name; } if (!isset($d...
[ "public", "static", "function", "connect", "(", "$", "databaseConfig", ",", "$", "label", "=", "'default'", ")", "{", "// This is used by the \"testsession\" module to test up a test session using an alternative name", "if", "(", "$", "name", "=", "self", "::", "get_alter...
Specify connection to a database Given the database configuration, this method will create the correct subclass of {@link SS_Database}. @param array $databaseConfig A map of options. The 'type' is the name of the subclass of SS_Database to use. For the rest of the options, see the specific class. @param string $label...
[ "Specify", "connection", "to", "a", "database" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L285-L307
train
silverstripe/silverstripe-framework
src/ORM/DB.php
DB.create_field
public static function create_field($table, $field, $spec) { return self::get_schema()->createField($table, $field, $spec); }
php
public static function create_field($table, $field, $spec) { return self::get_schema()->createField($table, $field, $spec); }
[ "public", "static", "function", "create_field", "(", "$", "table", ",", "$", "field", ",", "$", "spec", ")", "{", "return", "self", "::", "get_schema", "(", ")", "->", "createField", "(", "$", "table", ",", "$", "field", ",", "$", "spec", ")", ";", ...
Create a new field on a table. @param string $table Name of the table. @param string $field Name of the field to add. @param string $spec The field specification, eg 'INTEGER NOT NULL'
[ "Create", "a", "new", "field", "on", "a", "table", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DB.php#L559-L562
train
silverstripe/silverstripe-framework
src/ORM/Connect/Query.php
Query.column
public function column($column = null) { $result = array(); while ($record = $this->next()) { if ($column) { $result[] = $record[$column]; } else { $result[] = $record[key($record)]; } } return $result; }
php
public function column($column = null) { $result = array(); while ($record = $this->next()) { if ($column) { $result[] = $record[$column]; } else { $result[] = $record[key($record)]; } } return $result; }
[ "public", "function", "column", "(", "$", "column", "=", "null", ")", "{", "$", "result", "=", "array", "(", ")", ";", "while", "(", "$", "record", "=", "$", "this", "->", "next", "(", ")", ")", "{", "if", "(", "$", "column", ")", "{", "$", "...
Return an array containing all the values from a specific column. If no column is set, then the first will be returned @param string $column @return array
[ "Return", "an", "array", "containing", "all", "the", "values", "from", "a", "specific", "column", ".", "If", "no", "column", "is", "set", "then", "the", "first", "will", "be", "returned" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/Query.php#L61-L74
train
silverstripe/silverstripe-framework
src/ORM/Connect/Query.php
Query.keyedColumn
public function keyedColumn() { $column = array(); foreach ($this as $record) { $val = $record[key($record)]; $column[$val] = $val; } return $column; }
php
public function keyedColumn() { $column = array(); foreach ($this as $record) { $val = $record[key($record)]; $column[$val] = $val; } return $column; }
[ "public", "function", "keyedColumn", "(", ")", "{", "$", "column", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "record", ")", "{", "$", "val", "=", "$", "record", "[", "key", "(", "$", "record", ")", "]", ";", "$", "col...
Return an array containing all values in the leftmost column, where the keys are the same as the values. @return array
[ "Return", "an", "array", "containing", "all", "values", "in", "the", "leftmost", "column", "where", "the", "keys", "are", "the", "same", "as", "the", "values", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/Query.php#L82-L90
train
silverstripe/silverstripe-framework
src/ORM/Connect/Query.php
Query.map
public function map() { $column = array(); foreach ($this as $record) { $key = reset($record); $val = next($record); $column[$key] = $val; } return $column; }
php
public function map() { $column = array(); foreach ($this as $record) { $key = reset($record); $val = next($record); $column[$key] = $val; } return $column; }
[ "public", "function", "map", "(", ")", "{", "$", "column", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "record", ")", "{", "$", "key", "=", "reset", "(", "$", "record", ")", ";", "$", "val", "=", "next", "(", "$", "re...
Return a map from the first column to the second column. @return array
[ "Return", "a", "map", "from", "the", "first", "column", "to", "the", "second", "column", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/Query.php#L97-L106
train
silverstripe/silverstripe-framework
src/ORM/Connect/Query.php
Query.table
public function table() { $first = true; $result = "<table>\n"; foreach ($this as $record) { if ($first) { $result .= "<tr>"; foreach ($record as $k => $v) { $result .= "<th>" . Convert::raw2xml($k) . "</th> "; ...
php
public function table() { $first = true; $result = "<table>\n"; foreach ($this as $record) { if ($first) { $result .= "<tr>"; foreach ($record as $k => $v) { $result .= "<th>" . Convert::raw2xml($k) . "</th> "; ...
[ "public", "function", "table", "(", ")", "{", "$", "first", "=", "true", ";", "$", "result", "=", "\"<table>\\n\"", ";", "foreach", "(", "$", "this", "as", "$", "record", ")", "{", "if", "(", "$", "first", ")", "{", "$", "result", ".=", "\"<tr>\"",...
Return an HTML table containing the full result-set @return string
[ "Return", "an", "HTML", "table", "containing", "the", "full", "result", "-", "set" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/Query.php#L137-L165
train
silverstripe/silverstripe-framework
src/Security/InheritedPermissions.php
InheritedPermissions.flushMemberCache
public function flushMemberCache($memberIDs = null) { if (!$this->cacheService) { return; } // Hard flush, e.g. flush=1 if (!$memberIDs) { $this->cacheService->clear(); } if ($memberIDs && is_array($memberIDs)) { foreach ([self::V...
php
public function flushMemberCache($memberIDs = null) { if (!$this->cacheService) { return; } // Hard flush, e.g. flush=1 if (!$memberIDs) { $this->cacheService->clear(); } if ($memberIDs && is_array($memberIDs)) { foreach ([self::V...
[ "public", "function", "flushMemberCache", "(", "$", "memberIDs", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "cacheService", ")", "{", "return", ";", "}", "// Hard flush, e.g. flush=1", "if", "(", "!", "$", "memberIDs", ")", "{", "$", "this...
Clear the cache for this instance only @param array $memberIDs A list of member IDs
[ "Clear", "the", "cache", "for", "this", "instance", "only" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/InheritedPermissions.php#L132-L151
train
silverstripe/silverstripe-framework
src/Security/InheritedPermissions.php
InheritedPermissions.prePopulatePermissionCache
public function prePopulatePermissionCache($permission = 'edit', $ids = []) { switch ($permission) { case self::EDIT: $this->canEditMultiple($ids, Security::getCurrentUser(), false); break; case self::VIEW: $this->canViewMultiple($ids, ...
php
public function prePopulatePermissionCache($permission = 'edit', $ids = []) { switch ($permission) { case self::EDIT: $this->canEditMultiple($ids, Security::getCurrentUser(), false); break; case self::VIEW: $this->canViewMultiple($ids, ...
[ "public", "function", "prePopulatePermissionCache", "(", "$", "permission", "=", "'edit'", ",", "$", "ids", "=", "[", "]", ")", "{", "switch", "(", "$", "permission", ")", "{", "case", "self", "::", "EDIT", ":", "$", "this", "->", "canEditMultiple", "(",...
Force pre-calculation of a list of permissions for optimisation @param string $permission @param array $ids
[ "Force", "pre", "-", "calculation", "of", "a", "list", "of", "permissions", "for", "optimisation" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/InheritedPermissions.php#L209-L224
train
silverstripe/silverstripe-framework
src/Security/InheritedPermissions.php
InheritedPermissions.checkDefaultPermissions
protected function checkDefaultPermissions($type, Member $member = null) { $defaultPermissions = $this->getDefaultPermissions(); if (!$defaultPermissions) { return false; } switch ($type) { case self::VIEW: return $defaultPermissions->canView($...
php
protected function checkDefaultPermissions($type, Member $member = null) { $defaultPermissions = $this->getDefaultPermissions(); if (!$defaultPermissions) { return false; } switch ($type) { case self::VIEW: return $defaultPermissions->canView($...
[ "protected", "function", "checkDefaultPermissions", "(", "$", "type", ",", "Member", "$", "member", "=", "null", ")", "{", "$", "defaultPermissions", "=", "$", "this", "->", "getDefaultPermissions", "(", ")", ";", "if", "(", "!", "$", "defaultPermissions", "...
Determine default permission for a givion check @param string $type Method to check @param Member $member @return bool
[ "Determine", "default", "permission", "for", "a", "givion", "check" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/InheritedPermissions.php#L651-L667
train
silverstripe/silverstripe-framework
src/Security/InheritedPermissions.php
InheritedPermissions.isVersioned
protected function isVersioned() { if (!class_exists(Versioned::class)) { return false; } /** @var Versioned|DataObject $singleton */ $singleton = DataObject::singleton($this->getBaseClass()); return $singleton->hasExtension(Versioned::class) && $singleton->hasSta...
php
protected function isVersioned() { if (!class_exists(Versioned::class)) { return false; } /** @var Versioned|DataObject $singleton */ $singleton = DataObject::singleton($this->getBaseClass()); return $singleton->hasExtension(Versioned::class) && $singleton->hasSta...
[ "protected", "function", "isVersioned", "(", ")", "{", "if", "(", "!", "class_exists", "(", "Versioned", "::", "class", ")", ")", "{", "return", "false", ";", "}", "/** @var Versioned|DataObject $singleton */", "$", "singleton", "=", "DataObject", "::", "singlet...
Check if this model has versioning @return bool
[ "Check", "if", "this", "model", "has", "versioning" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/InheritedPermissions.php#L674-L682
train
silverstripe/silverstripe-framework
src/Security/InheritedPermissions.php
InheritedPermissions.getCachePermissions
protected function getCachePermissions($cacheKey) { // Check local cache if (isset($this->cachePermissions[$cacheKey])) { return $this->cachePermissions[$cacheKey]; } // Check persistent cache if ($this->cacheService) { $result = $this->cacheService->...
php
protected function getCachePermissions($cacheKey) { // Check local cache if (isset($this->cachePermissions[$cacheKey])) { return $this->cachePermissions[$cacheKey]; } // Check persistent cache if ($this->cacheService) { $result = $this->cacheService->...
[ "protected", "function", "getCachePermissions", "(", "$", "cacheKey", ")", "{", "// Check local cache", "if", "(", "isset", "(", "$", "this", "->", "cachePermissions", "[", "$", "cacheKey", "]", ")", ")", "{", "return", "$", "this", "->", "cachePermissions", ...
Gets the permission from cache @param string $cacheKey @return mixed
[ "Gets", "the", "permission", "from", "cache" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/InheritedPermissions.php#L721-L740
train
silverstripe/silverstripe-framework
src/ORM/ManyManyThroughQueryManipulator.php
ManyManyThroughQueryManipulator.extractInheritableQueryParameters
public function extractInheritableQueryParameters(DataQuery $query) { $params = $query->getQueryParams(); // Remove `Foreign.` query parameters for created objects, // as this would interfere with relations on those objects. foreach (array_keys($params) as $key) { if (st...
php
public function extractInheritableQueryParameters(DataQuery $query) { $params = $query->getQueryParams(); // Remove `Foreign.` query parameters for created objects, // as this would interfere with relations on those objects. foreach (array_keys($params) as $key) { if (st...
[ "public", "function", "extractInheritableQueryParameters", "(", "DataQuery", "$", "query", ")", "{", "$", "params", "=", "$", "query", "->", "getQueryParams", "(", ")", ";", "// Remove `Foreign.` query parameters for created objects,", "// as this would interfere with relatio...
Calculate the query parameters that should be inherited from the base many_many to the nested has_many list. @param DataQuery $query @return mixed
[ "Calculate", "the", "query", "parameters", "that", "should", "be", "inherited", "from", "the", "base", "many_many", "to", "the", "nested", "has_many", "list", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/ManyManyThroughQueryManipulator.php#L199-L215
train
silverstripe/silverstripe-framework
src/ORM/Connect/MySQLStatement.php
MySQLStatement.bind
protected function bind() { $variables = array(); // Bind each field while ($field = $this->metadata->fetch_field()) { $this->columns[] = $field->name; $this->types[$field->name] = $field->type; // Note that while boundValues isn't initialised at this poi...
php
protected function bind() { $variables = array(); // Bind each field while ($field = $this->metadata->fetch_field()) { $this->columns[] = $field->name; $this->types[$field->name] = $field->type; // Note that while boundValues isn't initialised at this poi...
[ "protected", "function", "bind", "(", ")", "{", "$", "variables", "=", "array", "(", ")", ";", "// Bind each field", "while", "(", "$", "field", "=", "$", "this", "->", "metadata", "->", "fetch_field", "(", ")", ")", "{", "$", "this", "->", "columns", ...
Binds this statement to the variables
[ "Binds", "this", "statement", "to", "the", "variables" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLStatement.php#L62-L83
train
silverstripe/silverstripe-framework
src/ORM/Filters/SearchFilter.php
SearchFilter.addRelation
protected function addRelation($name) { if (strstr($name, '.')) { $parts = explode('.', $name); $this->name = array_pop($parts); $this->relation = $parts; } else { $this->name = $name; } }
php
protected function addRelation($name) { if (strstr($name, '.')) { $parts = explode('.', $name); $this->name = array_pop($parts); $this->relation = $parts; } else { $this->name = $name; } }
[ "protected", "function", "addRelation", "(", "$", "name", ")", "{", "if", "(", "strstr", "(", "$", "name", ",", "'.'", ")", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "this", "->", "name", "=", "array_pop...
Called by constructor to convert a string pathname into a well defined relationship sequence. @param string $name
[ "Called", "by", "constructor", "to", "convert", "a", "string", "pathname", "into", "a", "well", "defined", "relationship", "sequence", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/SearchFilter.php#L105-L114
train
silverstripe/silverstripe-framework
src/ORM/Filters/SearchFilter.php
SearchFilter.setModifiers
public function setModifiers(array $modifiers) { $modifiers = array_map('strtolower', $modifiers); // Validate modifiers are supported $allowed = $this->getSupportedModifiers(); $unsupported = array_diff($modifiers, $allowed); if ($unsupported) { throw new Invali...
php
public function setModifiers(array $modifiers) { $modifiers = array_map('strtolower', $modifiers); // Validate modifiers are supported $allowed = $this->getSupportedModifiers(); $unsupported = array_diff($modifiers, $allowed); if ($unsupported) { throw new Invali...
[ "public", "function", "setModifiers", "(", "array", "$", "modifiers", ")", "{", "$", "modifiers", "=", "array_map", "(", "'strtolower'", ",", "$", "modifiers", ")", ";", "// Validate modifiers are supported", "$", "allowed", "=", "$", "this", "->", "getSupported...
Set the current modifiers to apply to the filter @param array $modifiers
[ "Set", "the", "current", "modifiers", "to", "apply", "to", "the", "filter" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/SearchFilter.php#L179-L193
train
silverstripe/silverstripe-framework
src/ORM/Filters/SearchFilter.php
SearchFilter.getDbName
public function getDbName() { // Special handler for "NULL" relations if ($this->name === "NULL") { return $this->name; } // Ensure that we're dealing with a DataObject. if (!is_subclass_of($this->model, DataObject::class)) { throw new InvalidArgument...
php
public function getDbName() { // Special handler for "NULL" relations if ($this->name === "NULL") { return $this->name; } // Ensure that we're dealing with a DataObject. if (!is_subclass_of($this->model, DataObject::class)) { throw new InvalidArgument...
[ "public", "function", "getDbName", "(", ")", "{", "// Special handler for \"NULL\" relations", "if", "(", "$", "this", "->", "name", "===", "\"NULL\"", ")", "{", "return", "$", "this", "->", "name", ";", "}", "// Ensure that we're dealing with a DataObject.", "if", ...
Normalizes the field name to table mapping. @return string
[ "Normalizes", "the", "field", "name", "to", "table", "mapping", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/SearchFilter.php#L258-L310
train
silverstripe/silverstripe-framework
src/ORM/Filters/SearchFilter.php
SearchFilter.getDbFormattedValue
public function getDbFormattedValue() { // SRM: This code finds the table where the field named $this->name lives // Todo: move to somewhere more appropriate, such as DataMapper, the magical class-to-be? if ($this->aggregate) { return intval($this->value); } /**...
php
public function getDbFormattedValue() { // SRM: This code finds the table where the field named $this->name lives // Todo: move to somewhere more appropriate, such as DataMapper, the magical class-to-be? if ($this->aggregate) { return intval($this->value); } /**...
[ "public", "function", "getDbFormattedValue", "(", ")", "{", "// SRM: This code finds the table where the field named $this->name lives", "// Todo: move to somewhere more appropriate, such as DataMapper, the magical class-to-be?", "if", "(", "$", "this", "->", "aggregate", ")", "{", "...
Return the value of the field as processed by the DBField class @return string
[ "Return", "the", "value", "of", "the", "field", "as", "processed", "by", "the", "DBField", "class" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/SearchFilter.php#L317-L330
train
silverstripe/silverstripe-framework
src/ORM/Filters/SearchFilter.php
SearchFilter.applyAggregate
public function applyAggregate(DataQuery $query, $having) { $schema = DataObject::getSchema(); $baseTable = $schema->baseDataTable($query->dataClass()); return $query ->having($having) ->groupby("\"{$baseTable}\".\"ID\""); }
php
public function applyAggregate(DataQuery $query, $having) { $schema = DataObject::getSchema(); $baseTable = $schema->baseDataTable($query->dataClass()); return $query ->having($having) ->groupby("\"{$baseTable}\".\"ID\""); }
[ "public", "function", "applyAggregate", "(", "DataQuery", "$", "query", ",", "$", "having", ")", "{", "$", "schema", "=", "DataObject", "::", "getSchema", "(", ")", ";", "$", "baseTable", "=", "$", "schema", "->", "baseDataTable", "(", "$", "query", "->"...
Given an escaped HAVING clause, add it along with the appropriate GROUP BY clause @param DataQuery $query @param string $having @return DataQuery
[ "Given", "an", "escaped", "HAVING", "clause", "add", "it", "along", "with", "the", "appropriate", "GROUP", "BY", "clause" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/SearchFilter.php#L338-L346
train
silverstripe/silverstripe-framework
src/ORM/Filters/SearchFilter.php
SearchFilter.exclude
public function exclude(DataQuery $query) { if (($key = array_search('not', $this->modifiers)) !== false) { unset($this->modifiers[$key]); return $this->apply($query); } if (is_array($this->value)) { return $this->excludeMany($query); } else { ...
php
public function exclude(DataQuery $query) { if (($key = array_search('not', $this->modifiers)) !== false) { unset($this->modifiers[$key]); return $this->apply($query); } if (is_array($this->value)) { return $this->excludeMany($query); } else { ...
[ "public", "function", "exclude", "(", "DataQuery", "$", "query", ")", "{", "if", "(", "(", "$", "key", "=", "array_search", "(", "'not'", ",", "$", "this", "->", "modifiers", ")", ")", "!==", "false", ")", "{", "unset", "(", "$", "this", "->", "mod...
Exclude filter criteria from a SQL query. @param DataQuery $query @return DataQuery
[ "Exclude", "filter", "criteria", "from", "a", "SQL", "query", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/SearchFilter.php#L392-L403
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBConnector.php
DBConnector.databaseError
protected function databaseError($msg, $errorLevel = E_USER_ERROR, $sql = null, $parameters = array()) { // Prevent errors when error checking is set at zero level if (empty($errorLevel)) { return; } // Format query if given if (!empty($sql)) { $forma...
php
protected function databaseError($msg, $errorLevel = E_USER_ERROR, $sql = null, $parameters = array()) { // Prevent errors when error checking is set at zero level if (empty($errorLevel)) { return; } // Format query if given if (!empty($sql)) { $forma...
[ "protected", "function", "databaseError", "(", "$", "msg", ",", "$", "errorLevel", "=", "E_USER_ERROR", ",", "$", "sql", "=", "null", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "// Prevent errors when error checking is set at zero level", "if", "(...
Error handler for database errors. All database errors will call this function to report the error. It isn't a static function; it will be called on the object itself and as such can be overridden in a subclass. Subclasses should run all errors through this function. @todo hook this into a more well-structured error ...
[ "Error", "handler", "for", "database", "errors", ".", "All", "database", "errors", "will", "call", "this", "function", "to", "report", "the", "error", ".", "It", "isn", "t", "a", "static", "function", ";", "it", "will", "be", "called", "on", "the", "obje...
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBConnector.php#L47-L68
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBConnector.php
DBConnector.isQueryDDL
public function isQueryDDL($sql) { $operations = Config::inst()->get(static::class, 'ddl_operations'); return $this->isQueryType($sql, $operations); }
php
public function isQueryDDL($sql) { $operations = Config::inst()->get(static::class, 'ddl_operations'); return $this->isQueryType($sql, $operations); }
[ "public", "function", "isQueryDDL", "(", "$", "sql", ")", "{", "$", "operations", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "static", "::", "class", ",", "'ddl_operations'", ")", ";", "return", "$", "this", "->", "isQueryType", "(", "$",...
Determine if this SQL statement is a DDL operation @param string $sql @return bool
[ "Determine", "if", "this", "SQL", "statement", "is", "a", "DDL", "operation" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBConnector.php#L91-L95
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBConnector.php
DBConnector.isQueryType
protected function isQueryType($sql, $type) { if (!preg_match('/^(?<operation>\w+)\b/', $sql, $matches)) { return false; } $operation = $matches['operation']; if (is_array($type)) { return in_array(strtolower($operation), $type); } else { r...
php
protected function isQueryType($sql, $type) { if (!preg_match('/^(?<operation>\w+)\b/', $sql, $matches)) { return false; } $operation = $matches['operation']; if (is_array($type)) { return in_array(strtolower($operation), $type); } else { r...
[ "protected", "function", "isQueryType", "(", "$", "sql", ",", "$", "type", ")", "{", "if", "(", "!", "preg_match", "(", "'/^(?<operation>\\w+)\\b/'", ",", "$", "sql", ",", "$", "matches", ")", ")", "{", "return", "false", ";", "}", "$", "operation", "=...
Determine if a query is of the given type @param string $sql Raw SQL @param string|array $type Type or list of types (first word in the query). Must be lowercase @return bool
[ "Determine", "if", "a", "query", "is", "of", "the", "given", "type" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBConnector.php#L117-L128
train
silverstripe/silverstripe-framework
src/ORM/Connect/DBConnector.php
DBConnector.parameterValues
protected function parameterValues($parameters) { $values = array(); foreach ($parameters as $value) { $values[] = is_array($value) ? $value['value'] : $value; } return $values; }
php
protected function parameterValues($parameters) { $values = array(); foreach ($parameters as $value) { $values[] = is_array($value) ? $value['value'] : $value; } return $values; }
[ "protected", "function", "parameterValues", "(", "$", "parameters", ")", "{", "$", "values", "=", "array", "(", ")", ";", "foreach", "(", "$", "parameters", "as", "$", "value", ")", "{", "$", "values", "[", "]", "=", "is_array", "(", "$", "value", ")...
Extracts only the parameter values for error reporting @param array $parameters @return array List of parameter values
[ "Extracts", "only", "the", "parameter", "values", "for", "error", "reporting" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBConnector.php#L136-L143
train
silverstripe/silverstripe-framework
src/Security/SecurityToken.php
SecurityToken.getSession
protected function getSession() { $injector = Injector::inst(); if ($injector->has(HTTPRequest::class)) { return $injector->get(HTTPRequest::class)->getSession(); } elseif (Controller::has_curr()) { return Controller::curr()->getRequest()->getSession(); } ...
php
protected function getSession() { $injector = Injector::inst(); if ($injector->has(HTTPRequest::class)) { return $injector->get(HTTPRequest::class)->getSession(); } elseif (Controller::has_curr()) { return Controller::curr()->getRequest()->getSession(); } ...
[ "protected", "function", "getSession", "(", ")", "{", "$", "injector", "=", "Injector", "::", "inst", "(", ")", ";", "if", "(", "$", "injector", "->", "has", "(", "HTTPRequest", "::", "class", ")", ")", "{", "return", "$", "injector", "->", "get", "(...
Returns the current session instance from the injector @return Session @throws Exception If the HTTPRequest class hasn't been registered as a service and no controllers exist
[ "Returns", "the", "current", "session", "instance", "from", "the", "injector" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/SecurityToken.php#L183-L192
train
silverstripe/silverstripe-framework
src/Security/SecurityToken.php
SecurityToken.getRequestToken
protected function getRequestToken($request) { $name = $this->getName(); $header = 'X-' . ucwords(strtolower($name)); if ($token = $request->getHeader($header)) { return $token; } // Get from request var return $request->requestVar($name); }
php
protected function getRequestToken($request) { $name = $this->getName(); $header = 'X-' . ucwords(strtolower($name)); if ($token = $request->getHeader($header)) { return $token; } // Get from request var return $request->requestVar($name); }
[ "protected", "function", "getRequestToken", "(", "$", "request", ")", "{", "$", "name", "=", "$", "this", "->", "getName", "(", ")", ";", "$", "header", "=", "'X-'", ".", "ucwords", "(", "strtolower", "(", "$", "name", ")", ")", ";", "if", "(", "$"...
Get security token from request @param HTTPRequest $request @return string
[ "Get", "security", "token", "from", "request" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/SecurityToken.php#L237-L247
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBString.php
DBString.setOptions
public function setOptions(array $options = []) { parent::setOptions($options); if (array_key_exists('nullifyEmpty', $options)) { $this->options['nullifyEmpty'] = (bool) $options['nullifyEmpty']; } if (array_key_exists('default', $options)) { $this->setDefaul...
php
public function setOptions(array $options = []) { parent::setOptions($options); if (array_key_exists('nullifyEmpty', $options)) { $this->options['nullifyEmpty'] = (bool) $options['nullifyEmpty']; } if (array_key_exists('default', $options)) { $this->setDefaul...
[ "public", "function", "setOptions", "(", "array", "$", "options", "=", "[", "]", ")", "{", "parent", "::", "setOptions", "(", "$", "options", ")", ";", "if", "(", "array_key_exists", "(", "'nullifyEmpty'", ",", "$", "options", ")", ")", "{", "$", "this...
Update the optional parameters for this field. @param array $options Array of options The options allowed are: <ul><li>"nullifyEmpty" This is a boolean flag. True (the default) means that empty strings are automatically converted to nulls to be stored in the database. Set it to false to ensure that nulls and empty str...
[ "Update", "the", "optional", "parameters", "for", "this", "field", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBString.php#L45-L57
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBString.php
DBString.LimitCharactersToClosestWord
public function LimitCharactersToClosestWord($limit = 20, $add = '...') { // Safely convert to plain text $value = $this->Plain(); // Determine if value exceeds limit before limiting characters if (mb_strlen($value) <= $limit) { return $value; } // Limit...
php
public function LimitCharactersToClosestWord($limit = 20, $add = '...') { // Safely convert to plain text $value = $this->Plain(); // Determine if value exceeds limit before limiting characters if (mb_strlen($value) <= $limit) { return $value; } // Limit...
[ "public", "function", "LimitCharactersToClosestWord", "(", "$", "limit", "=", "20", ",", "$", "add", "=", "'...'", ")", "{", "// Safely convert to plain text", "$", "value", "=", "$", "this", "->", "Plain", "(", ")", ";", "// Determine if value exceeds limit befor...
Limit this field's content by a number of characters and truncate the field to the closest complete word. All HTML tags are stripped from the field. @param int $limit Number of characters to limit by @param string $add Ellipsis to add to the end of truncated string @return string Plain text value with limited characte...
[ "Limit", "this", "field", "s", "content", "by", "a", "number", "of", "characters", "and", "truncate", "the", "field", "to", "the", "closest", "complete", "word", ".", "All", "HTML", "tags", "are", "stripped", "from", "the", "field", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBString.php#L143-L163
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBString.php
DBString.LimitWordCount
public function LimitWordCount($numWords = 26, $add = '...') { $value = $this->Plain(); $words = explode(' ', $value); if (count($words) <= $numWords) { return $value; } // Limit $words = array_slice($words, 0, $numWords); return implode(' ', $wor...
php
public function LimitWordCount($numWords = 26, $add = '...') { $value = $this->Plain(); $words = explode(' ', $value); if (count($words) <= $numWords) { return $value; } // Limit $words = array_slice($words, 0, $numWords); return implode(' ', $wor...
[ "public", "function", "LimitWordCount", "(", "$", "numWords", "=", "26", ",", "$", "add", "=", "'...'", ")", "{", "$", "value", "=", "$", "this", "->", "Plain", "(", ")", ";", "$", "words", "=", "explode", "(", "' '", ",", "$", "value", ")", ";",...
Limit this field's content by a number of words. @param int $numWords Number of words to limit by. @param string $add Ellipsis to add to the end of truncated string. @return string
[ "Limit", "this", "field", "s", "content", "by", "a", "number", "of", "words", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBString.php#L173-L184
train
silverstripe/silverstripe-framework
src/View/SSViewer_Scope.php
SSViewer_Scope.locally
public function locally() { list( $this->item, $this->itemIterator, $this->itemIteratorTotal, $this->popIndex, $this->upIndex, $this->currentIndex ) = $this->itemStack[$this->localIndex]; // Remember any un-completed (...
php
public function locally() { list( $this->item, $this->itemIterator, $this->itemIteratorTotal, $this->popIndex, $this->upIndex, $this->currentIndex ) = $this->itemStack[$this->localIndex]; // Remember any un-completed (...
[ "public", "function", "locally", "(", ")", "{", "list", "(", "$", "this", "->", "item", ",", "$", "this", "->", "itemIterator", ",", "$", "this", "->", "itemIteratorTotal", ",", "$", "this", "->", "popIndex", ",", "$", "this", "->", "upIndex", ",", "...
Called at the start of every lookup chain by SSTemplateParser to indicate a new lookup from local scope @return self
[ "Called", "at", "the", "start", "of", "every", "lookup", "chain", "by", "SSTemplateParser", "to", "indicate", "a", "new", "lookup", "from", "local", "scope" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer_Scope.php#L131-L147
train
silverstripe/silverstripe-framework
src/View/SSViewer_Scope.php
SSViewer_Scope.resetLocalScope
public function resetLocalScope() { // Restore previous un-completed lookup chain if set $previousLocalState = $this->localStack ? array_pop($this->localStack) : null; array_splice($this->itemStack, $this->localIndex + 1, count($this->itemStack), $previousLocalState); list( ...
php
public function resetLocalScope() { // Restore previous un-completed lookup chain if set $previousLocalState = $this->localStack ? array_pop($this->localStack) : null; array_splice($this->itemStack, $this->localIndex + 1, count($this->itemStack), $previousLocalState); list( ...
[ "public", "function", "resetLocalScope", "(", ")", "{", "// Restore previous un-completed lookup chain if set", "$", "previousLocalState", "=", "$", "this", "->", "localStack", "?", "array_pop", "(", "$", "this", "->", "localStack", ")", ":", "null", ";", "array_spl...
Reset the local scope - restores saved state to the "global" item stack. Typically called after a lookup chain has been completed
[ "Reset", "the", "local", "scope", "-", "restores", "saved", "state", "to", "the", "global", "item", "stack", ".", "Typically", "called", "after", "a", "lookup", "chain", "has", "been", "completed" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer_Scope.php#L153-L167
train
silverstripe/silverstripe-framework
src/View/SSViewer_Scope.php
SSViewer_Scope.self
public function self() { $result = $this->itemIterator ? $this->itemIterator->current() : $this->item; $this->resetLocalScope(); return $result; }
php
public function self() { $result = $this->itemIterator ? $this->itemIterator->current() : $this->item; $this->resetLocalScope(); return $result; }
[ "public", "function", "self", "(", ")", "{", "$", "result", "=", "$", "this", "->", "itemIterator", "?", "$", "this", "->", "itemIterator", "->", "current", "(", ")", ":", "$", "this", "->", "item", ";", "$", "this", "->", "resetLocalScope", "(", ")"...
Gets the current object and resets the scope. @return object
[ "Gets", "the", "current", "object", "and", "resets", "the", "scope", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer_Scope.php#L240-L246
train
silverstripe/silverstripe-framework
src/View/SSViewer_Scope.php
SSViewer_Scope.next
public function next() { if (!$this->item) { return false; } if (!$this->itemIterator) { if (is_array($this->item)) { $this->itemIterator = new ArrayIterator($this->item); } else { $this->itemIterator = $this->item->getIter...
php
public function next() { if (!$this->item) { return false; } if (!$this->itemIterator) { if (is_array($this->item)) { $this->itemIterator = new ArrayIterator($this->item); } else { $this->itemIterator = $this->item->getIter...
[ "public", "function", "next", "(", ")", "{", "if", "(", "!", "$", "this", "->", "item", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "this", "->", "itemIterator", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "item", "...
Fast-forwards the current iterator to the next item @return mixed
[ "Fast", "-", "forwards", "the", "current", "iterator", "to", "the", "next", "item" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer_Scope.php#L285-L313
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.isDBTemp
protected function isDBTemp($name) { $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; $result = preg_match( sprintf('/^%stmpdb_[0-9]+_[0-9]+$/i', preg_quote($prefix, '/')), $name ); return $result === 1; }
php
protected function isDBTemp($name) { $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; $result = preg_match( sprintf('/^%stmpdb_[0-9]+_[0-9]+$/i', preg_quote($prefix, '/')), $name ); return $result === 1; }
[ "protected", "function", "isDBTemp", "(", "$", "name", ")", "{", "$", "prefix", "=", "Environment", "::", "getEnv", "(", "'SS_DATABASE_PREFIX'", ")", "?", ":", "'ss_'", ";", "$", "result", "=", "preg_match", "(", "sprintf", "(", "'/^%stmpdb_[0-9]+_[0-9]+$/i'",...
Check if the given name matches the temp_db pattern @param string $name @return bool
[ "Check", "if", "the", "given", "name", "matches", "the", "temp_db", "pattern" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L50-L58
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.rollbackTransaction
public function rollbackTransaction() { // Ensure a rollback can be performed $success = static::getConn()->supportsTransactions() && static::getConn()->transactionDepth(); if (!$success) { return false; } try { // Explicit false = gnostic ...
php
public function rollbackTransaction() { // Ensure a rollback can be performed $success = static::getConn()->supportsTransactions() && static::getConn()->transactionDepth(); if (!$success) { return false; } try { // Explicit false = gnostic ...
[ "public", "function", "rollbackTransaction", "(", ")", "{", "// Ensure a rollback can be performed", "$", "success", "=", "static", "::", "getConn", "(", ")", "->", "supportsTransactions", "(", ")", "&&", "static", "::", "getConn", "(", ")", "->", "transactionDept...
Rollback a transaction (or trash all data if the DB doesn't support databases @return bool True if successfully rolled back, false otherwise. On error the DB is killed and must be re-created. Note that calling rollbackTransaction() when there is no transaction is counted as a failure, user code should either kill or f...
[ "Rollback", "a", "transaction", "(", "or", "trash", "all", "data", "if", "the", "DB", "doesn", "t", "support", "databases" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L105-L122
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.kill
public function kill() { // Nothing to kill if (!$this->isUsed()) { return; } // Rollback any transactions (note: Success ignored) $this->rollbackTransaction(); // Check the database actually exists $dbConn = $this->getConn(); $dbName = $...
php
public function kill() { // Nothing to kill if (!$this->isUsed()) { return; } // Rollback any transactions (note: Success ignored) $this->rollbackTransaction(); // Check the database actually exists $dbConn = $this->getConn(); $dbName = $...
[ "public", "function", "kill", "(", ")", "{", "// Nothing to kill", "if", "(", "!", "$", "this", "->", "isUsed", "(", ")", ")", "{", "return", ";", "}", "// Rollback any transactions (note: Success ignored)", "$", "this", "->", "rollbackTransaction", "(", ")", ...
Destroy the current temp database
[ "Destroy", "the", "current", "temp", "database" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L127-L154
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.clearAllData
public function clearAllData() { if (!$this->isUsed()) { return; } $this->getConn()->clearAllData(); // Some DataExtensions keep a static cache of information that needs to // be reset whenever the database is cleaned out $classes = array_merge( ...
php
public function clearAllData() { if (!$this->isUsed()) { return; } $this->getConn()->clearAllData(); // Some DataExtensions keep a static cache of information that needs to // be reset whenever the database is cleaned out $classes = array_merge( ...
[ "public", "function", "clearAllData", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isUsed", "(", ")", ")", "{", "return", ";", "}", "$", "this", "->", "getConn", "(", ")", "->", "clearAllData", "(", ")", ";", "// Some DataExtensions keep a static c...
Remove all content from the temporary database.
[ "Remove", "all", "content", "from", "the", "temporary", "database", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L159-L179
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.build
public function build() { // Disable PHPUnit error handling $oldErrorHandler = set_error_handler(null); // Create a temporary database, and force the connection to use UTC for time $dbConn = $this->getConn(); $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; ...
php
public function build() { // Disable PHPUnit error handling $oldErrorHandler = set_error_handler(null); // Create a temporary database, and force the connection to use UTC for time $dbConn = $this->getConn(); $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; ...
[ "public", "function", "build", "(", ")", "{", "// Disable PHPUnit error handling", "$", "oldErrorHandler", "=", "set_error_handler", "(", "null", ")", ";", "// Create a temporary database, and force the connection to use UTC for time", "$", "dbConn", "=", "$", "this", "->",...
Create temp DB without creating extra objects @return string DB name
[ "Create", "temp", "DB", "without", "creating", "extra", "objects" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L186-L218
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.rebuildTables
protected function rebuildTables($extraDataObjects = []) { DataObject::reset(); // clear singletons, they're caching old extension info which is used in DatabaseAdmin->doBuild() Injector::inst()->unregisterObjects(DataObject::class); $dataClasses = ClassInfo::subclassesFor(DataObje...
php
protected function rebuildTables($extraDataObjects = []) { DataObject::reset(); // clear singletons, they're caching old extension info which is used in DatabaseAdmin->doBuild() Injector::inst()->unregisterObjects(DataObject::class); $dataClasses = ClassInfo::subclassesFor(DataObje...
[ "protected", "function", "rebuildTables", "(", "$", "extraDataObjects", "=", "[", "]", ")", "{", "DataObject", "::", "reset", "(", ")", ";", "// clear singletons, they're caching old extension info which is used in DatabaseAdmin->doBuild()", "Injector", "::", "inst", "(", ...
Rebuild all database tables @param array $extraDataObjects
[ "Rebuild", "all", "database", "tables" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L225-L261
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.deleteAll
public function deleteAll() { $schema = $this->getConn()->getSchemaManager(); foreach ($schema->databaseList() as $dbName) { if ($this->isDBTemp($dbName)) { $schema->dropDatabase($dbName); $schema->alterationMessage("Dropped database \"$dbName\"", 'deleted...
php
public function deleteAll() { $schema = $this->getConn()->getSchemaManager(); foreach ($schema->databaseList() as $dbName) { if ($this->isDBTemp($dbName)) { $schema->dropDatabase($dbName); $schema->alterationMessage("Dropped database \"$dbName\"", 'deleted...
[ "public", "function", "deleteAll", "(", ")", "{", "$", "schema", "=", "$", "this", "->", "getConn", "(", ")", "->", "getSchemaManager", "(", ")", ";", "foreach", "(", "$", "schema", "->", "databaseList", "(", ")", "as", "$", "dbName", ")", "{", "if",...
Clear all temp DBs on this connection Note: This will output results to stdout unless suppressOutput is set on the current db schema
[ "Clear", "all", "temp", "DBs", "on", "this", "connection" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L269-L279
train
silverstripe/silverstripe-framework
src/ORM/Connect/TempDatabase.php
TempDatabase.resetDBSchema
public function resetDBSchema(array $extraDataObjects = []) { // Skip if no DB if (!$this->isUsed()) { return; } try { $this->rebuildTables($extraDataObjects); } catch (DatabaseException $ex) { // In case of error during build force a hard...
php
public function resetDBSchema(array $extraDataObjects = []) { // Skip if no DB if (!$this->isUsed()) { return; } try { $this->rebuildTables($extraDataObjects); } catch (DatabaseException $ex) { // In case of error during build force a hard...
[ "public", "function", "resetDBSchema", "(", "array", "$", "extraDataObjects", "=", "[", "]", ")", "{", "// Skip if no DB", "if", "(", "!", "$", "this", "->", "isUsed", "(", ")", ")", "{", "return", ";", "}", "try", "{", "$", "this", "->", "rebuildTable...
Reset the testing database's schema. @param array $extraDataObjects List of extra dataobjects to build
[ "Reset", "the", "testing", "database", "s", "schema", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/TempDatabase.php#L286-L302
train
silverstripe/silverstripe-framework
src/Control/Middleware/AllowedHostsMiddleware.php
AllowedHostsMiddleware.setAllowedHosts
public function setAllowedHosts($allowedHosts) { if (is_string($allowedHosts)) { $allowedHosts = preg_split('/ *, */', $allowedHosts); } $this->allowedHosts = $allowedHosts; return $this; }
php
public function setAllowedHosts($allowedHosts) { if (is_string($allowedHosts)) { $allowedHosts = preg_split('/ *, */', $allowedHosts); } $this->allowedHosts = $allowedHosts; return $this; }
[ "public", "function", "setAllowedHosts", "(", "$", "allowedHosts", ")", "{", "if", "(", "is_string", "(", "$", "allowedHosts", ")", ")", "{", "$", "allowedHosts", "=", "preg_split", "(", "'/ *, */'", ",", "$", "allowedHosts", ")", ";", "}", "$", "this", ...
Sets the list of allowed Host header values Can also specify a comma separated list @param array|string $allowedHosts @return $this
[ "Sets", "the", "list", "of", "allowed", "Host", "header", "values", "Can", "also", "specify", "a", "comma", "separated", "list" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/Middleware/AllowedHostsMiddleware.php#L36-L43
train
silverstripe/silverstripe-framework
src/Dev/Debug.php
Debug.caller
public static function caller() { $bt = debug_backtrace(); $caller = isset($bt[2]) ? $bt[2] : array(); $caller['line'] = $bt[1]['line']; $caller['file'] = $bt[1]['file']; if (!isset($caller['class'])) { $caller['class'] = ''; } if (!isset($caller['...
php
public static function caller() { $bt = debug_backtrace(); $caller = isset($bt[2]) ? $bt[2] : array(); $caller['line'] = $bt[1]['line']; $caller['file'] = $bt[1]['file']; if (!isset($caller['class'])) { $caller['class'] = ''; } if (!isset($caller['...
[ "public", "static", "function", "caller", "(", ")", "{", "$", "bt", "=", "debug_backtrace", "(", ")", ";", "$", "caller", "=", "isset", "(", "$", "bt", "[", "2", "]", ")", "?", "$", "bt", "[", "2", "]", ":", "array", "(", ")", ";", "$", "call...
Returns the caller for a specific method @return array
[ "Returns", "the", "caller", "for", "a", "specific", "method" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Debug.php#L60-L76
train
silverstripe/silverstripe-framework
src/Dev/Debug.php
Debug.endshow
public static function endshow($val, $showHeader = true, HTTPRequest $request = null) { // Don't show on live if (Director::isLive()) { return; } echo static::create_debug_view($request) ->debugVariable($val, static::caller(), $showHeader); die(); ...
php
public static function endshow($val, $showHeader = true, HTTPRequest $request = null) { // Don't show on live if (Director::isLive()) { return; } echo static::create_debug_view($request) ->debugVariable($val, static::caller(), $showHeader); die(); ...
[ "public", "static", "function", "endshow", "(", "$", "val", ",", "$", "showHeader", "=", "true", ",", "HTTPRequest", "$", "request", "=", "null", ")", "{", "// Don't show on live", "if", "(", "Director", "::", "isLive", "(", ")", ")", "{", "return", ";",...
Close out the show dumper. Does not work on live mode @param mixed $val @param bool $showHeader @param HTTPRequest $request
[ "Close", "out", "the", "show", "dumper", ".", "Does", "not", "work", "on", "live", "mode" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Debug.php#L86-L97
train
silverstripe/silverstripe-framework
src/Dev/Debug.php
Debug.message
public static function message($message, $showHeader = true, HTTPRequest $request = null) { // Don't show on live if (Director::isLive()) { return; } echo static::create_debug_view($request) ->renderMessage($message, static::caller(), $showHeader); }
php
public static function message($message, $showHeader = true, HTTPRequest $request = null) { // Don't show on live if (Director::isLive()) { return; } echo static::create_debug_view($request) ->renderMessage($message, static::caller(), $showHeader); }
[ "public", "static", "function", "message", "(", "$", "message", ",", "$", "showHeader", "=", "true", ",", "HTTPRequest", "$", "request", "=", "null", ")", "{", "// Don't show on live", "if", "(", "Director", "::", "isLive", "(", ")", ")", "{", "return", ...
Show a debugging message. Does not work on live mode @param string $message @param bool $showHeader @param HTTPRequest|null $request
[ "Show", "a", "debugging", "message", ".", "Does", "not", "work", "on", "live", "mode" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Debug.php#L133-L142
train
silverstripe/silverstripe-framework
src/Dev/Debug.php
Debug.create_debug_view
public static function create_debug_view(HTTPRequest $request = null) { $service = static::supportsHTML($request) ? DebugView::class : CliDebugView::class; return Injector::inst()->get($service); }
php
public static function create_debug_view(HTTPRequest $request = null) { $service = static::supportsHTML($request) ? DebugView::class : CliDebugView::class; return Injector::inst()->get($service); }
[ "public", "static", "function", "create_debug_view", "(", "HTTPRequest", "$", "request", "=", "null", ")", "{", "$", "service", "=", "static", "::", "supportsHTML", "(", "$", "request", ")", "?", "DebugView", "::", "class", ":", "CliDebugView", "::", "class"...
Create an instance of an appropriate DebugView object. @param HTTPRequest $request Optional request to target this view for @return DebugView
[ "Create", "an", "instance", "of", "an", "appropriate", "DebugView", "object", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Debug.php#L150-L156
train
silverstripe/silverstripe-framework
src/Dev/Debug.php
Debug.supportsHTML
protected static function supportsHTML(HTTPRequest $request = null) { // No HTML output in CLI if (Director::is_cli()) { return false; } // Get current request if registered if (!$request && Injector::inst()->has(HTTPRequest::class)) { $request = Inje...
php
protected static function supportsHTML(HTTPRequest $request = null) { // No HTML output in CLI if (Director::is_cli()) { return false; } // Get current request if registered if (!$request && Injector::inst()->has(HTTPRequest::class)) { $request = Inje...
[ "protected", "static", "function", "supportsHTML", "(", "HTTPRequest", "$", "request", "=", "null", ")", "{", "// No HTML output in CLI", "if", "(", "Director", "::", "is_cli", "(", ")", ")", "{", "return", "false", ";", "}", "// Get current request if registered"...
Determine if the given request supports html output @param HTTPRequest $request @return bool
[ "Determine", "if", "the", "given", "request", "supports", "html", "output" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Debug.php#L164-L196
train
silverstripe/silverstripe-framework
src/Dev/Debug.php
Debug.require_developer_login
public static function require_developer_login() { // Don't require login for dev mode if (Director::isDev()) { return; } if (isset($_SESSION['loggedInAs'])) { // We have to do some raw SQL here, because this method is called in Object::defineMethods(). ...
php
public static function require_developer_login() { // Don't require login for dev mode if (Director::isDev()) { return; } if (isset($_SESSION['loggedInAs'])) { // We have to do some raw SQL here, because this method is called in Object::defineMethods(). ...
[ "public", "static", "function", "require_developer_login", "(", ")", "{", "// Don't require login for dev mode", "if", "(", "Director", "::", "isDev", "(", ")", ")", "{", "return", ";", "}", "if", "(", "isset", "(", "$", "_SESSION", "[", "'loggedInAs'", "]", ...
Check if the user has permissions to run URL debug tools, else redirect them to log in.
[ "Check", "if", "the", "user", "has", "permissions", "to", "run", "URL", "debug", "tools", "else", "redirect", "them", "to", "log", "in", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Debug.php#L202-L246
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.javascript
public function javascript($file, $options = array()) { $file = ModuleResourceLoader::singleton()->resolvePath($file); // Get type $type = null; if (isset($this->javascript[$file]['type'])) { $type = $this->javascript[$file]['type']; } if (isset($options[...
php
public function javascript($file, $options = array()) { $file = ModuleResourceLoader::singleton()->resolvePath($file); // Get type $type = null; if (isset($this->javascript[$file]['type'])) { $type = $this->javascript[$file]['type']; } if (isset($options[...
[ "public", "function", "javascript", "(", "$", "file", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "file", "=", "ModuleResourceLoader", "::", "singleton", "(", ")", "->", "resolvePath", "(", "$", "file", ")", ";", "// Get type", "$", "ty...
Register the given JavaScript file as required. @param string $file Either relative to docroot or in the form "vendor/package:resource" @param array $options List of options. Available options include: - 'provides' : List of scripts files included in this file - 'async' : Boolean value to set async attribute to script...
[ "Register", "the", "given", "JavaScript", "file", "as", "required", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L404-L444
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.customScript
public function customScript($script, $uniquenessID = null) { if ($uniquenessID) { $this->customScript[$uniquenessID] = $script; } else { $this->customScript[] = $script; } }
php
public function customScript($script, $uniquenessID = null) { if ($uniquenessID) { $this->customScript[$uniquenessID] = $script; } else { $this->customScript[] = $script; } }
[ "public", "function", "customScript", "(", "$", "script", ",", "$", "uniquenessID", "=", "null", ")", "{", "if", "(", "$", "uniquenessID", ")", "{", "$", "this", "->", "customScript", "[", "$", "uniquenessID", "]", "=", "$", "script", ";", "}", "else",...
Register the given JavaScript code into the list of requirements @param string $script The script content as a string (without enclosing <script> tag) @param string $uniquenessID A unique ID that ensures a piece of code is only added once
[ "Register", "the", "given", "JavaScript", "code", "into", "the", "list", "of", "requirements" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L528-L535
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.customCSS
public function customCSS($script, $uniquenessID = null) { if ($uniquenessID) { $this->customCSS[$uniquenessID] = $script; } else { $this->customCSS[] = $script; } }
php
public function customCSS($script, $uniquenessID = null) { if ($uniquenessID) { $this->customCSS[$uniquenessID] = $script; } else { $this->customCSS[] = $script; } }
[ "public", "function", "customCSS", "(", "$", "script", ",", "$", "uniquenessID", "=", "null", ")", "{", "if", "(", "$", "uniquenessID", ")", "{", "$", "this", "->", "customCSS", "[", "$", "uniquenessID", "]", "=", "$", "script", ";", "}", "else", "{"...
Register the given CSS styles into the list of requirements @param string $script CSS selectors as a string (without enclosing <style> tag) @param string $uniquenessID A unique ID that ensures a piece of code is only added once
[ "Register", "the", "given", "CSS", "styles", "into", "the", "list", "of", "requirements" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L553-L560
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.css
public function css($file, $media = null) { $file = ModuleResourceLoader::singleton()->resolvePath($file); $this->css[$file] = [ "media" => $media ]; }
php
public function css($file, $media = null) { $file = ModuleResourceLoader::singleton()->resolvePath($file); $this->css[$file] = [ "media" => $media ]; }
[ "public", "function", "css", "(", "$", "file", ",", "$", "media", "=", "null", ")", "{", "$", "file", "=", "ModuleResourceLoader", "::", "singleton", "(", ")", "->", "resolvePath", "(", "$", "file", ")", ";", "$", "this", "->", "css", "[", "$", "fi...
Register the given stylesheet into the list of requirements. @param string $file The CSS file to load, relative to site root @param string $media Comma-separated list of media types to use in the link tag (e.g. 'screen,projector')
[ "Register", "the", "given", "stylesheet", "into", "the", "list", "of", "requirements", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L635-L642
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.clear
public function clear($fileOrID = null) { $types = [ 'javascript', 'css', 'customScript', 'customCSS', 'customHeadTags', 'combinedFiles', ]; foreach ($types as $type) { if ($fileOrID) { if (is...
php
public function clear($fileOrID = null) { $types = [ 'javascript', 'css', 'customScript', 'customCSS', 'customHeadTags', 'combinedFiles', ]; foreach ($types as $type) { if ($fileOrID) { if (is...
[ "public", "function", "clear", "(", "$", "fileOrID", "=", "null", ")", "{", "$", "types", "=", "[", "'javascript'", ",", "'css'", ",", "'customScript'", ",", "'customCSS'", ",", "'customHeadTags'", ",", "'combinedFiles'", ",", "]", ";", "foreach", "(", "$"...
Clear either a single or all requirements Caution: Clearing single rules added via customCSS and customScript only works if you originally specified a $uniquenessID. @param string|int $fileOrID
[ "Clear", "either", "a", "single", "or", "all", "requirements" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L692-L713
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.block
public function block($fileOrID) { if (is_string($fileOrID)) { $fileOrID = ModuleResourceLoader::singleton()->resolvePath($fileOrID); } $this->blocked[$fileOrID] = $fileOrID; }
php
public function block($fileOrID) { if (is_string($fileOrID)) { $fileOrID = ModuleResourceLoader::singleton()->resolvePath($fileOrID); } $this->blocked[$fileOrID] = $fileOrID; }
[ "public", "function", "block", "(", "$", "fileOrID", ")", "{", "if", "(", "is_string", "(", "$", "fileOrID", ")", ")", "{", "$", "fileOrID", "=", "ModuleResourceLoader", "::", "singleton", "(", ")", "->", "resolvePath", "(", "$", "fileOrID", ")", ";", ...
Block inclusion of a specific file The difference between this and {@link clear} is that the calling order does not matter; {@link clear} must be called after the initial registration, whereas {@link block} can be used in advance. This is useful, for example, to block scripts included by a superclass without having to...
[ "Block", "inclusion", "of", "a", "specific", "file" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L747-L753
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.includeInResponse
public function includeInResponse(HTTPResponse $response) { $this->processCombinedFiles(); $jsRequirements = array(); $cssRequirements = array(); foreach ($this->getJavascript() as $file => $attributes) { $path = $this->pathForFile($file); if ($path) { ...
php
public function includeInResponse(HTTPResponse $response) { $this->processCombinedFiles(); $jsRequirements = array(); $cssRequirements = array(); foreach ($this->getJavascript() as $file => $attributes) { $path = $this->pathForFile($file); if ($path) { ...
[ "public", "function", "includeInResponse", "(", "HTTPResponse", "$", "response", ")", "{", "$", "this", "->", "processCombinedFiles", "(", ")", ";", "$", "jsRequirements", "=", "array", "(", ")", ";", "$", "cssRequirements", "=", "array", "(", ")", ";", "f...
Attach requirements inclusion to X-Include-JS and X-Include-CSS headers on the given HTTP Response @param HTTPResponse $response
[ "Attach", "requirements", "inclusion", "to", "X", "-", "Include", "-", "JS", "and", "X", "-", "Include", "-", "CSS", "headers", "on", "the", "given", "HTTP", "Response" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L960-L988
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.pathForFile
protected function pathForFile($fileOrUrl) { // Since combined urls could be root relative, treat them as urls here. if (preg_match('{^(//)|(http[s]?:)}', $fileOrUrl) || Director::is_root_relative_url($fileOrUrl)) { return $fileOrUrl; } else { return Injector::inst()-...
php
protected function pathForFile($fileOrUrl) { // Since combined urls could be root relative, treat them as urls here. if (preg_match('{^(//)|(http[s]?:)}', $fileOrUrl) || Director::is_root_relative_url($fileOrUrl)) { return $fileOrUrl; } else { return Injector::inst()-...
[ "protected", "function", "pathForFile", "(", "$", "fileOrUrl", ")", "{", "// Since combined urls could be root relative, treat them as urls here.", "if", "(", "preg_match", "(", "'{^(//)|(http[s]?:)}'", ",", "$", "fileOrUrl", ")", "||", "Director", "::", "is_root_relative_u...
Finds the path for specified file @param string $fileOrUrl @return string|bool
[ "Finds", "the", "path", "for", "specified", "file" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1049-L1057
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.parseCombinedFile
protected function parseCombinedFile($file) { // Array with path and type keys if (is_array($file) && isset($file['path']) && isset($file['type'])) { return array($file['path'], $file['type']); } // Extract value from indexed array if (is_array($file)) { ...
php
protected function parseCombinedFile($file) { // Array with path and type keys if (is_array($file) && isset($file['path']) && isset($file['type'])) { return array($file['path'], $file['type']); } // Extract value from indexed array if (is_array($file)) { ...
[ "protected", "function", "parseCombinedFile", "(", "$", "file", ")", "{", "// Array with path and type keys", "if", "(", "is_array", "(", "$", "file", ")", "&&", "isset", "(", "$", "file", "[", "'path'", "]", ")", "&&", "isset", "(", "$", "file", "[", "'...
Return path and type of given combined file @param string|array $file Either a file path, or an array spec @return array array with two elements, path and type of file
[ "Return", "path", "and", "type", "of", "given", "combined", "file" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1177-L1200
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.processCombinedFiles
public function processCombinedFiles() { // Check if combining is enabled if (!$this->getCombinedFilesEnabled()) { return; } // Before scripts are modified, detect files that are provided by preceding ones $providedScripts = $this->getProvidedScripts(); ...
php
public function processCombinedFiles() { // Check if combining is enabled if (!$this->getCombinedFilesEnabled()) { return; } // Before scripts are modified, detect files that are provided by preceding ones $providedScripts = $this->getProvidedScripts(); ...
[ "public", "function", "processCombinedFiles", "(", ")", "{", "// Check if combining is enabled", "if", "(", "!", "$", "this", "->", "getCombinedFilesEnabled", "(", ")", ")", "{", "return", ";", "}", "// Before scripts are modified, detect files that are provided by precedin...
Do the heavy lifting involved in combining the combined files.
[ "Do", "the", "heavy", "lifting", "involved", "in", "combining", "the", "combined", "files", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1246-L1311
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.hashedCombinedFilename
protected function hashedCombinedFilename($combinedFile, $fileList) { $name = pathinfo($combinedFile, PATHINFO_FILENAME); $hash = $this->hashOfFiles($fileList); $extension = File::get_file_extension($combinedFile); return $name . '-' . substr($hash, 0, 7) . '.' . $extension; }
php
protected function hashedCombinedFilename($combinedFile, $fileList) { $name = pathinfo($combinedFile, PATHINFO_FILENAME); $hash = $this->hashOfFiles($fileList); $extension = File::get_file_extension($combinedFile); return $name . '-' . substr($hash, 0, 7) . '.' . $extension; }
[ "protected", "function", "hashedCombinedFilename", "(", "$", "combinedFile", ",", "$", "fileList", ")", "{", "$", "name", "=", "pathinfo", "(", "$", "combinedFile", ",", "PATHINFO_FILENAME", ")", ";", "$", "hash", "=", "$", "this", "->", "hashOfFiles", "(", ...
Given a filename and list of files, generate a new filename unique to these files @param string $combinedFile @param array $fileList @return string
[ "Given", "a", "filename", "and", "list", "of", "files", "generate", "a", "new", "filename", "unique", "to", "these", "files" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1400-L1406
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.getCombinedFilesEnabled
public function getCombinedFilesEnabled() { if (isset($this->combinedFilesEnabled)) { return $this->combinedFilesEnabled; } // Non-dev sites are always combined if (!Director::isDev()) { return true; } // Fallback to default return Co...
php
public function getCombinedFilesEnabled() { if (isset($this->combinedFilesEnabled)) { return $this->combinedFilesEnabled; } // Non-dev sites are always combined if (!Director::isDev()) { return true; } // Fallback to default return Co...
[ "public", "function", "getCombinedFilesEnabled", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "combinedFilesEnabled", ")", ")", "{", "return", "$", "this", "->", "combinedFilesEnabled", ";", "}", "// Non-dev sites are always combined", "if", "(", "...
Check if combined files are enabled @return bool
[ "Check", "if", "combined", "files", "are", "enabled" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1413-L1426
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.hashOfFiles
protected function hashOfFiles($fileList) { // Get hash based on hash of each file $hash = ''; foreach ($fileList as $file) { $absolutePath = Director::getAbsFile($file); if (file_exists($absolutePath)) { $hash .= sha1_file($absolutePath); ...
php
protected function hashOfFiles($fileList) { // Get hash based on hash of each file $hash = ''; foreach ($fileList as $file) { $absolutePath = Director::getAbsFile($file); if (file_exists($absolutePath)) { $hash .= sha1_file($absolutePath); ...
[ "protected", "function", "hashOfFiles", "(", "$", "fileList", ")", "{", "// Get hash based on hash of each file", "$", "hash", "=", "''", ";", "foreach", "(", "$", "fileList", "as", "$", "file", ")", "{", "$", "absolutePath", "=", "Director", "::", "getAbsFile...
For a given filelist, determine some discriminating value to determine if any of these files have changed. @param array $fileList List of files @return string SHA1 bashed file hash
[ "For", "a", "given", "filelist", "determine", "some", "discriminating", "value", "to", "determine", "if", "any", "of", "these", "files", "have", "changed", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1435-L1448
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.themedCSS
public function themedCSS($name, $media = null) { $path = ThemeResourceLoader::inst()->findThemedCSS($name, SSViewer::get_themes()); if ($path) { $this->css($path, $media); } else { throw new InvalidArgumentException( "The css file doesn't exist. Pleas...
php
public function themedCSS($name, $media = null) { $path = ThemeResourceLoader::inst()->findThemedCSS($name, SSViewer::get_themes()); if ($path) { $this->css($path, $media); } else { throw new InvalidArgumentException( "The css file doesn't exist. Pleas...
[ "public", "function", "themedCSS", "(", "$", "name", ",", "$", "media", "=", "null", ")", "{", "$", "path", "=", "ThemeResourceLoader", "::", "inst", "(", ")", "->", "findThemedCSS", "(", "$", "name", ",", "SSViewer", "::", "get_themes", "(", ")", ")",...
Registers the given themeable stylesheet as required. A CSS file in the current theme path name 'themename/css/$name.css' is first searched for, and it that doesn't exist and the module parameter is set then a CSS file with that name in the module is used. @param string $name The name of the file - eg '/css/File.css'...
[ "Registers", "the", "given", "themeable", "stylesheet", "as", "required", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1461-L1472
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.themedJavascript
public function themedJavascript($name, $type = null) { $path = ThemeResourceLoader::inst()->findThemedJavascript($name, SSViewer::get_themes()); if ($path) { $opts = []; if ($type) { $opts['type'] = $type; } $this->javascript($path, $o...
php
public function themedJavascript($name, $type = null) { $path = ThemeResourceLoader::inst()->findThemedJavascript($name, SSViewer::get_themes()); if ($path) { $opts = []; if ($type) { $opts['type'] = $type; } $this->javascript($path, $o...
[ "public", "function", "themedJavascript", "(", "$", "name", ",", "$", "type", "=", "null", ")", "{", "$", "path", "=", "ThemeResourceLoader", "::", "inst", "(", ")", "->", "findThemedJavascript", "(", "$", "name", ",", "SSViewer", "::", "get_themes", "(", ...
Registers the given themeable javascript as required. 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 ...
[ "Registers", "the", "given", "themeable", "javascript", "as", "required", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1485-L1500
train
silverstripe/silverstripe-framework
src/View/Requirements_Backend.php
Requirements_Backend.debug
public function debug() { Debug::show($this->javascript); Debug::show($this->css); Debug::show($this->customCSS); Debug::show($this->customScript); Debug::show($this->customHeadTags); Debug::show($this->combinedFiles); }
php
public function debug() { Debug::show($this->javascript); Debug::show($this->css); Debug::show($this->customCSS); Debug::show($this->customScript); Debug::show($this->customHeadTags); Debug::show($this->combinedFiles); }
[ "public", "function", "debug", "(", ")", "{", "Debug", "::", "show", "(", "$", "this", "->", "javascript", ")", ";", "Debug", "::", "show", "(", "$", "this", "->", "css", ")", ";", "Debug", "::", "show", "(", "$", "this", "->", "customCSS", ")", ...
Output debugging information.
[ "Output", "debugging", "information", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Requirements_Backend.php#L1505-L1513
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallConfig.php
InstallConfig.getDatabaseConfig
public function getDatabaseConfig($request, $databaseClasses, $realPassword = true) { // Get config from request if (isset($request['db']['type'])) { $type = $request['db']['type']; if (isset($request['db'][$type])) { $config = $request['db'][$type]; ...
php
public function getDatabaseConfig($request, $databaseClasses, $realPassword = true) { // Get config from request if (isset($request['db']['type'])) { $type = $request['db']['type']; if (isset($request['db'][$type])) { $config = $request['db'][$type]; ...
[ "public", "function", "getDatabaseConfig", "(", "$", "request", ",", "$", "databaseClasses", ",", "$", "realPassword", "=", "true", ")", "{", "// Get config from request", "if", "(", "isset", "(", "$", "request", "[", "'db'", "]", "[", "'type'", "]", ")", ...
Get database config from the current environment @param array $request Request object @param array $databaseClasses Supported database config @param bool $realPassword Set to true to get the real password. If false, any non-posted password will be redacted as '********'. Note: Posted passwords are considered disclosed...
[ "Get", "database", "config", "from", "the", "current", "environment" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallConfig.php#L42-L73
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallConfig.php
InstallConfig.getAdminConfig
public function getAdminConfig($request, $realPassword = true) { if (isset($request['admin'])) { $config = $request['admin']; if (isset($config['password']) && $config['password'] === Installer::PASSWORD_PLACEHOLDER) { $config['password'] = Environment::getEnv('SS_DEF...
php
public function getAdminConfig($request, $realPassword = true) { if (isset($request['admin'])) { $config = $request['admin']; if (isset($config['password']) && $config['password'] === Installer::PASSWORD_PLACEHOLDER) { $config['password'] = Environment::getEnv('SS_DEF...
[ "public", "function", "getAdminConfig", "(", "$", "request", ",", "$", "realPassword", "=", "true", ")", "{", "if", "(", "isset", "(", "$", "request", "[", "'admin'", "]", ")", ")", "{", "$", "config", "=", "$", "request", "[", "'admin'", "]", ";", ...
Get admin config from the environment @param array $request @param bool $realPassword Set to true to get the real password. If false, any non-posted password will be redacted as '********'. Note: Posted passwords are considered disclosed and never redacted. @return array
[ "Get", "admin", "config", "from", "the", "environment" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallConfig.php#L84-L100
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallConfig.php
InstallConfig.alreadyInstalled
public function alreadyInstalled() { if (file_exists($this->getEnvPath())) { return true; } if (!file_exists($this->getConfigPath())) { return false; } $configContents = file_get_contents($this->getConfigPath()); if (strstr($configContents, '$d...
php
public function alreadyInstalled() { if (file_exists($this->getEnvPath())) { return true; } if (!file_exists($this->getConfigPath())) { return false; } $configContents = file_get_contents($this->getConfigPath()); if (strstr($configContents, '$d...
[ "public", "function", "alreadyInstalled", "(", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "getEnvPath", "(", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "file_exists", "(", "$", "this", "->", "getConfigPath", "(", ...
Check if this site has already been installed @return bool
[ "Check", "if", "this", "site", "has", "already", "been", "installed" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallConfig.php#L107-L123
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallConfig.php
InstallConfig.getDatabaseClass
protected function getDatabaseClass($databaseClasses) { $envDatabase = Environment::getEnv('SS_DATABASE_CLASS'); if ($envDatabase) { return $envDatabase; } // Check supported versions foreach ($this->preferredDatabases as $candidate) { if (!empty($dat...
php
protected function getDatabaseClass($databaseClasses) { $envDatabase = Environment::getEnv('SS_DATABASE_CLASS'); if ($envDatabase) { return $envDatabase; } // Check supported versions foreach ($this->preferredDatabases as $candidate) { if (!empty($dat...
[ "protected", "function", "getDatabaseClass", "(", "$", "databaseClasses", ")", "{", "$", "envDatabase", "=", "Environment", "::", "getEnv", "(", "'SS_DATABASE_CLASS'", ")", ";", "if", "(", "$", "envDatabase", ")", "{", "return", "$", "envDatabase", ";", "}", ...
Database configs available for configuration @param array $databaseClasses @return string
[ "Database", "configs", "available", "for", "configuration" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallConfig.php#L147-L161
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallConfig.php
InstallConfig.getFrameworkVersion
public function getFrameworkVersion() { $composerLockPath = BASE_PATH . '/composer.lock'; if (!file_exists($composerLockPath)) { return 'unknown'; } $lockData = json_decode(file_get_contents($composerLockPath), true); if (json_last_error() || empty($lockData['pack...
php
public function getFrameworkVersion() { $composerLockPath = BASE_PATH . '/composer.lock'; if (!file_exists($composerLockPath)) { return 'unknown'; } $lockData = json_decode(file_get_contents($composerLockPath), true); if (json_last_error() || empty($lockData['pack...
[ "public", "function", "getFrameworkVersion", "(", ")", "{", "$", "composerLockPath", "=", "BASE_PATH", ".", "'/composer.lock'", ";", "if", "(", "!", "file_exists", "(", "$", "composerLockPath", ")", ")", "{", "return", "'unknown'", ";", "}", "$", "lockData", ...
Get string representation of the framework version @return string
[ "Get", "string", "representation", "of", "the", "framework", "version" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallConfig.php#L168-L184
train
silverstripe/silverstripe-framework
src/Core/Startup/AbstractConfirmationToken.php
AbstractConfirmationToken.prepare_tokens
public static function prepare_tokens($keys, HTTPRequest $request) { $target = null; foreach ($keys as $key) { $token = new static($key, $request); // Validate this token if ($token->reloadRequired() || $token->reloadRequiredIfError()) { $token->su...
php
public static function prepare_tokens($keys, HTTPRequest $request) { $target = null; foreach ($keys as $key) { $token = new static($key, $request); // Validate this token if ($token->reloadRequired() || $token->reloadRequiredIfError()) { $token->su...
[ "public", "static", "function", "prepare_tokens", "(", "$", "keys", ",", "HTTPRequest", "$", "request", ")", "{", "$", "target", "=", "null", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "$", "token", "=", "new", "static", "(", "$", ...
Given a list of token names, suppress all tokens that have not been validated, and return the non-validated token with the highest priority @param array $keys List of token keys in ascending priority (low to high) @param HTTPRequest $request @return static The token container for the unvalidated $key given with the hi...
[ "Given", "a", "list", "of", "token", "names", "suppress", "all", "tokens", "that", "have", "not", "been", "validated", "and", "return", "the", "non", "-", "validated", "token", "with", "the", "highest", "priority" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Startup/AbstractConfirmationToken.php#L40-L52
train
silverstripe/silverstripe-framework
src/Core/Startup/AbstractConfirmationToken.php
AbstractConfirmationToken.genToken
protected function genToken() { // Generate a new random token (as random as possible) $rg = new RandomGenerator(); $token = $rg->randomToken('md5'); // Store a file in the session save path (safer than /tmp, as open_basedir might limit that) file_put_contents($this->pathFor...
php
protected function genToken() { // Generate a new random token (as random as possible) $rg = new RandomGenerator(); $token = $rg->randomToken('md5'); // Store a file in the session save path (safer than /tmp, as open_basedir might limit that) file_put_contents($this->pathFor...
[ "protected", "function", "genToken", "(", ")", "{", "// Generate a new random token (as random as possible)", "$", "rg", "=", "new", "RandomGenerator", "(", ")", ";", "$", "token", "=", "$", "rg", "->", "randomToken", "(", "'md5'", ")", ";", "// Store a file in th...
Generate a new random token and store it @return string Token name
[ "Generate", "a", "new", "random", "token", "and", "store", "it" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Startup/AbstractConfirmationToken.php#L70-L80
train
silverstripe/silverstripe-framework
src/Core/Startup/AbstractConfirmationToken.php
AbstractConfirmationToken.reloadWithToken
public function reloadWithToken() { $location = $this->redirectURL(); $locationJS = Convert::raw2js($location); $locationATT = Convert::raw2att($location); $body = <<<HTML <script>location.href='$locationJS';</script> <noscript><meta http-equiv="refresh" content="0; url=$locationATT"...
php
public function reloadWithToken() { $location = $this->redirectURL(); $locationJS = Convert::raw2js($location); $locationATT = Convert::raw2att($location); $body = <<<HTML <script>location.href='$locationJS';</script> <noscript><meta http-equiv="refresh" content="0; url=$locationATT"...
[ "public", "function", "reloadWithToken", "(", ")", "{", "$", "location", "=", "$", "this", "->", "redirectURL", "(", ")", ";", "$", "locationJS", "=", "Convert", "::", "raw2js", "(", "$", "location", ")", ";", "$", "locationATT", "=", "Convert", "::", ...
Forces a reload of the request with the token included @return HTTPResponse
[ "Forces", "a", "reload", "of", "the", "request", "with", "the", "token", "included" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Startup/AbstractConfirmationToken.php#L131-L146
train
silverstripe/silverstripe-framework
src/Control/RequestHandler.php
RequestHandler.handleAction
protected function handleAction($request, $action) { $classMessage = Director::isLive() ? 'on this handler' : 'on class ' . static::class; if (!$this->hasMethod($action)) { return new HTTPResponse("Action '$action' isn't available $classMessage.", 404); } $res = $this->...
php
protected function handleAction($request, $action) { $classMessage = Director::isLive() ? 'on this handler' : 'on class ' . static::class; if (!$this->hasMethod($action)) { return new HTTPResponse("Action '$action' isn't available $classMessage.", 404); } $res = $this->...
[ "protected", "function", "handleAction", "(", "$", "request", ",", "$", "action", ")", "{", "$", "classMessage", "=", "Director", "::", "isLive", "(", ")", "?", "'on this handler'", ":", "'on class '", ".", "static", "::", "class", ";", "if", "(", "!", "...
Given a request, and an action name, call that action name on this RequestHandler Must not raise HTTPResponse_Exceptions - instead it should return @param $request @param $action @return HTTPResponse
[ "Given", "a", "request", "and", "an", "action", "name", "call", "that", "action", "name", "on", "this", "RequestHandler" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/RequestHandler.php#L310-L331
train
silverstripe/silverstripe-framework
src/Control/RequestHandler.php
RequestHandler.allowedActions
public function allowedActions($limitToClass = null) { if ($limitToClass) { $actions = Config::forClass($limitToClass)->get('allowed_actions', true); } else { $actions = $this->config()->get('allowed_actions'); } if (is_array($actions)) { if (arra...
php
public function allowedActions($limitToClass = null) { if ($limitToClass) { $actions = Config::forClass($limitToClass)->get('allowed_actions', true); } else { $actions = $this->config()->get('allowed_actions'); } if (is_array($actions)) { if (arra...
[ "public", "function", "allowedActions", "(", "$", "limitToClass", "=", "null", ")", "{", "if", "(", "$", "limitToClass", ")", "{", "$", "actions", "=", "Config", "::", "forClass", "(", "$", "limitToClass", ")", "->", "get", "(", "'allowed_actions'", ",", ...
Get a array of allowed actions defined on this controller, any parent classes or extensions. Caution: Since 3.1, allowed_actions definitions only apply to methods on the controller they're defined on, so it is recommended to use the $class argument when invoking this method. @param string $limitToClass @return array|...
[ "Get", "a", "array", "of", "allowed", "actions", "defined", "on", "this", "controller", "any", "parent", "classes", "or", "extensions", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/RequestHandler.php#L345-L372
train
silverstripe/silverstripe-framework
src/Control/RequestHandler.php
RequestHandler.hasAction
public function hasAction($action) { if ($action == 'index') { return true; } // Don't allow access to any non-public methods (inspect instance plus all extensions) $insts = array_merge([$this], (array) $this->getExtensionInstances()); foreach ($insts as $inst) {...
php
public function hasAction($action) { if ($action == 'index') { return true; } // Don't allow access to any non-public methods (inspect instance plus all extensions) $insts = array_merge([$this], (array) $this->getExtensionInstances()); foreach ($insts as $inst) {...
[ "public", "function", "hasAction", "(", "$", "action", ")", "{", "if", "(", "$", "action", "==", "'index'", ")", "{", "return", "true", ";", "}", "// Don't allow access to any non-public methods (inspect instance plus all extensions)", "$", "insts", "=", "array_merge"...
Checks if this request handler has a specific action, even if the current user cannot access it. Includes class ancestry and extensions in the checks. @param string $action @return bool
[ "Checks", "if", "this", "request", "handler", "has", "a", "specific", "action", "even", "if", "the", "current", "user", "cannot", "access", "it", ".", "Includes", "class", "ancestry", "and", "extensions", "in", "the", "checks", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/RequestHandler.php#L382-L423
train
silverstripe/silverstripe-framework
src/Control/RequestHandler.php
RequestHandler.definingClassForAction
protected function definingClassForAction($actionOrigCasing) { $action = strtolower($actionOrigCasing); $definingClass = null; $insts = array_merge([$this], (array) $this->getExtensionInstances()); foreach ($insts as $inst) { if (!method_exists($inst, $action)) { ...
php
protected function definingClassForAction($actionOrigCasing) { $action = strtolower($actionOrigCasing); $definingClass = null; $insts = array_merge([$this], (array) $this->getExtensionInstances()); foreach ($insts as $inst) { if (!method_exists($inst, $action)) { ...
[ "protected", "function", "definingClassForAction", "(", "$", "actionOrigCasing", ")", "{", "$", "action", "=", "strtolower", "(", "$", "actionOrigCasing", ")", ";", "$", "definingClass", "=", "null", ";", "$", "insts", "=", "array_merge", "(", "[", "$", "thi...
Return the class that defines the given action, so that we know where to check allowed_actions. @param string $actionOrigCasing @return string
[ "Return", "the", "class", "that", "defines", "the", "given", "action", "so", "that", "we", "know", "where", "to", "check", "allowed_actions", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/RequestHandler.php#L431-L446
train
silverstripe/silverstripe-framework
src/Control/RequestHandler.php
RequestHandler.Link
public function Link($action = null) { // Check configured url_segment $url = $this->config()->get('url_segment'); if ($url) { $link = Controller::join_links($url, $action, '/'); // Give extensions the chance to modify by reference $this->extend('updateLi...
php
public function Link($action = null) { // Check configured url_segment $url = $this->config()->get('url_segment'); if ($url) { $link = Controller::join_links($url, $action, '/'); // Give extensions the chance to modify by reference $this->extend('updateLi...
[ "public", "function", "Link", "(", "$", "action", "=", "null", ")", "{", "// Check configured url_segment", "$", "url", "=", "$", "this", "->", "config", "(", ")", "->", "get", "(", "'url_segment'", ")", ";", "if", "(", "$", "url", ")", "{", "$", "li...
Returns a link to this controller. Overload with your own Link rules if they exist. @param string $action Optional action @return string
[ "Returns", "a", "link", "to", "this", "controller", ".", "Overload", "with", "your", "own", "Link", "rules", "if", "they", "exist", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/RequestHandler.php#L562-L580
train
silverstripe/silverstripe-framework
src/Control/RequestHandler.php
RequestHandler.getReturnReferer
public function getReturnReferer() { $referer = $this->getReferer(); if ($referer && Director::is_site_url($referer)) { return $referer; } return null; }
php
public function getReturnReferer() { $referer = $this->getReferer(); if ($referer && Director::is_site_url($referer)) { return $referer; } return null; }
[ "public", "function", "getReturnReferer", "(", ")", "{", "$", "referer", "=", "$", "this", "->", "getReferer", "(", ")", ";", "if", "(", "$", "referer", "&&", "Director", "::", "is_site_url", "(", "$", "referer", ")", ")", "{", "return", "$", "referer"...
Returns the referer, if it is safely validated as an internal URL and can be redirected to. @internal called from {@see Form::getValidationErrorResponse} @return string|null
[ "Returns", "the", "referer", "if", "it", "is", "safely", "validated", "as", "an", "internal", "URL", "and", "can", "be", "redirected", "to", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Control/RequestHandler.php#L628-L635
train
silverstripe/silverstripe-framework
src/ORM/Queries/SQLUpdate.php
SQLUpdate.create
public static function create($table = null, $assignment = array(), $where = array()) { return Injector::inst()->createWithArgs(__CLASS__, func_get_args()); }
php
public static function create($table = null, $assignment = array(), $where = array()) { return Injector::inst()->createWithArgs(__CLASS__, func_get_args()); }
[ "public", "static", "function", "create", "(", "$", "table", "=", "null", ",", "$", "assignment", "=", "array", "(", ")", ",", "$", "where", "=", "array", "(", ")", ")", "{", "return", "Injector", "::", "inst", "(", ")", "->", "createWithArgs", "(", ...
Construct a new SQLUpdate object @param string $table Table name to update (ANSI quoted) @param array $assignment List of column assignments @param array $where List of where clauses @return static
[ "Construct", "a", "new", "SQLUpdate", "object" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLUpdate.php#L29-L32
train
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
TinyMCECombinedGenerator.generateContent
public function generateContent(TinyMCEConfig $config) { $tinymceDir = $config->getTinyMCEResource(); // List of string / ModuleResource references to embed $files = []; // Add core languages $language = $config->getOption('language'); if ($language) { $...
php
public function generateContent(TinyMCEConfig $config) { $tinymceDir = $config->getTinyMCEResource(); // List of string / ModuleResource references to embed $files = []; // Add core languages $language = $config->getOption('language'); if ($language) { $...
[ "public", "function", "generateContent", "(", "TinyMCEConfig", "$", "config", ")", "{", "$", "tinymceDir", "=", "$", "config", "->", "getTinyMCEResource", "(", ")", ";", "// List of string / ModuleResource references to embed", "$", "files", "=", "[", "]", ";", "/...
Build raw config for tinymce @param TinyMCEConfig $config @return string
[ "Build", "raw", "config", "for", "tinymce" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php#L78-L177
train
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
TinyMCECombinedGenerator.checkName
protected function checkName(TinyMCEConfig $config) { $configs = HTMLEditorConfig::get_available_configs_map(); foreach ($configs as $id => $name) { if (HTMLEditorConfig::get($id) === $config) { return $id; } } return 'custom'; }
php
protected function checkName(TinyMCEConfig $config) { $configs = HTMLEditorConfig::get_available_configs_map(); foreach ($configs as $id => $name) { if (HTMLEditorConfig::get($id) === $config) { return $id; } } return 'custom'; }
[ "protected", "function", "checkName", "(", "TinyMCEConfig", "$", "config", ")", "{", "$", "configs", "=", "HTMLEditorConfig", "::", "get_available_configs_map", "(", ")", ";", "foreach", "(", "$", "configs", "as", "$", "id", "=>", "$", "name", ")", "{", "i...
Check if this config is registered under a given key @param TinyMCEConfig $config @return string
[ "Check", "if", "this", "config", "is", "registered", "under", "a", "given", "key" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php#L211-L220
train
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
TinyMCECombinedGenerator.generateFilename
public function generateFilename(TinyMCEConfig $config) { $hash = substr(sha1(json_encode($config->getAttributes())), 0, 10); $name = $this->checkName($config); $url = str_replace( ['{name}', '{hash}'], [$name, $hash], $this->config()->get('filename_base')...
php
public function generateFilename(TinyMCEConfig $config) { $hash = substr(sha1(json_encode($config->getAttributes())), 0, 10); $name = $this->checkName($config); $url = str_replace( ['{name}', '{hash}'], [$name, $hash], $this->config()->get('filename_base')...
[ "public", "function", "generateFilename", "(", "TinyMCEConfig", "$", "config", ")", "{", "$", "hash", "=", "substr", "(", "sha1", "(", "json_encode", "(", "$", "config", "->", "getAttributes", "(", ")", ")", ")", ",", "0", ",", "10", ")", ";", "$", "...
Get filename to use for this config @param TinyMCEConfig $config @return mixed
[ "Get", "filename", "to", "use", "for", "this", "config" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php#L228-L238
train
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
TinyMCECombinedGenerator.resolveRelativeResource
protected function resolveRelativeResource($base, $resource) { // Return resource path based on relative resource path foreach (['', '.min.js', '.js'] as $ext) { // Map resource if ($base instanceof ModuleResource) { $next = $base->getRelativeResource($resourc...
php
protected function resolveRelativeResource($base, $resource) { // Return resource path based on relative resource path foreach (['', '.min.js', '.js'] as $ext) { // Map resource if ($base instanceof ModuleResource) { $next = $base->getRelativeResource($resourc...
[ "protected", "function", "resolveRelativeResource", "(", "$", "base", ",", "$", "resource", ")", "{", "// Return resource path based on relative resource path", "foreach", "(", "[", "''", ",", "'.min.js'", ",", "'.js'", "]", "as", "$", "ext", ")", "{", "// Map res...
Get relative resource for a given base and string @param ModuleResource|string $base @param string $resource @return ModuleResource|string
[ "Get", "relative", "resource", "for", "a", "given", "base", "and", "string" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php#L260-L276
train
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
TinyMCECombinedGenerator.resourceExists
protected function resourceExists($resource) { if (!$resource) { return false; } if ($resource instanceof ModuleResource) { return $resource->exists(); } $base = rtrim(Director::baseFolder(), '/'); return file_exists($base . '/' . $resource); ...
php
protected function resourceExists($resource) { if (!$resource) { return false; } if ($resource instanceof ModuleResource) { return $resource->exists(); } $base = rtrim(Director::baseFolder(), '/'); return file_exists($base . '/' . $resource); ...
[ "protected", "function", "resourceExists", "(", "$", "resource", ")", "{", "if", "(", "!", "$", "resource", ")", "{", "return", "false", ";", "}", "if", "(", "$", "resource", "instanceof", "ModuleResource", ")", "{", "return", "$", "resource", "->", "exi...
Check if the given resource exists @param string|ModuleResource $resource @return bool
[ "Check", "if", "the", "given", "resource", "exists" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php#L284-L294
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallRequirements.php
InstallRequirements.checkDatabase
public function checkDatabase($databaseConfig) { // Check if support is available if (!$this->requireDatabaseFunctions( $databaseConfig, array( "Database Configuration", "Database support", "Database support in PHP", ...
php
public function checkDatabase($databaseConfig) { // Check if support is available if (!$this->requireDatabaseFunctions( $databaseConfig, array( "Database Configuration", "Database support", "Database support in PHP", ...
[ "public", "function", "checkDatabase", "(", "$", "databaseConfig", ")", "{", "// Check if support is available", "if", "(", "!", "$", "this", "->", "requireDatabaseFunctions", "(", "$", "databaseConfig", ",", "array", "(", "\"Database Configuration\"", ",", "\"Databas...
Check the database configuration. These are done one after another starting with checking the database function exists in PHP, and continuing onto more difficult checks like database permissions. @param array $databaseConfig The list of database parameters @return boolean Validity of database configuration details
[ "Check", "the", "database", "configuration", ".", "These", "are", "done", "one", "after", "another", "starting", "with", "checking", "the", "database", "function", "exists", "in", "PHP", "and", "continuing", "onto", "more", "difficult", "checks", "like", "databa...
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallRequirements.php#L66-L159
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallRequirements.php
InstallRequirements.getOriginalIni
protected function getOriginalIni($settingName) { if (isset($this->originalIni[$settingName])) { return $this->originalIni[$settingName]; } return ini_get($settingName); }
php
protected function getOriginalIni($settingName) { if (isset($this->originalIni[$settingName])) { return $this->originalIni[$settingName]; } return ini_get($settingName); }
[ "protected", "function", "getOriginalIni", "(", "$", "settingName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "originalIni", "[", "$", "settingName", "]", ")", ")", "{", "return", "$", "this", "->", "originalIni", "[", "$", "settingName", "]"...
Get ini setting @param string $settingName @return mixed
[ "Get", "ini", "setting" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallRequirements.php#L531-L537
train
silverstripe/silverstripe-framework
src/Dev/Install/InstallRequirements.php
InstallRequirements.requireNoClasses
public function requireNoClasses($classNames, $testDetails) { $this->testing($testDetails); $badClasses = array(); foreach ($classNames as $className) { if (class_exists($className)) { $badClasses[] = $className; } } if ($badClasses) { ...
php
public function requireNoClasses($classNames, $testDetails) { $this->testing($testDetails); $badClasses = array(); foreach ($classNames as $className) { if (class_exists($className)) { $badClasses[] = $className; } } if ($badClasses) { ...
[ "public", "function", "requireNoClasses", "(", "$", "classNames", ",", "$", "testDetails", ")", "{", "$", "this", "->", "testing", "(", "$", "testDetails", ")", ";", "$", "badClasses", "=", "array", "(", ")", ";", "foreach", "(", "$", "classNames", "as",...
Require that the given class doesn't exist @param array $classNames @param array $testDetails @return bool
[ "Require", "that", "the", "given", "class", "doesn", "t", "exist" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/Install/InstallRequirements.php#L733-L748
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBDate.php
DBDate.DayOfMonth
public function DayOfMonth($includeOrdinal = false) { $number = $this->Format('d'); if ($includeOrdinal && $number) { $formatter = NumberFormatter::create(i18n::get_locale(), NumberFormatter::ORDINAL); return $formatter->format((int)$number); } return $number;...
php
public function DayOfMonth($includeOrdinal = false) { $number = $this->Format('d'); if ($includeOrdinal && $number) { $formatter = NumberFormatter::create(i18n::get_locale(), NumberFormatter::ORDINAL); return $formatter->format((int)$number); } return $number;...
[ "public", "function", "DayOfMonth", "(", "$", "includeOrdinal", "=", "false", ")", "{", "$", "number", "=", "$", "this", "->", "Format", "(", "'d'", ")", ";", "if", "(", "$", "includeOrdinal", "&&", "$", "number", ")", "{", "$", "formatter", "=", "Nu...
Returns the day of the month. @param bool $includeOrdinal Include ordinal suffix to day, e.g. "th" or "rd" @return string
[ "Returns", "the", "day", "of", "the", "month", "." ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBDate.php#L150-L158
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBDate.php
DBDate.Long
public function Long() { if (!$this->value) { return null; } $formatter = $this->getFormatter(IntlDateFormatter::LONG); return $formatter->format($this->getTimestamp()); }
php
public function Long() { if (!$this->value) { return null; } $formatter = $this->getFormatter(IntlDateFormatter::LONG); return $formatter->format($this->getTimestamp()); }
[ "public", "function", "Long", "(", ")", "{", "if", "(", "!", "$", "this", "->", "value", ")", "{", "return", "null", ";", "}", "$", "formatter", "=", "$", "this", "->", "getFormatter", "(", "IntlDateFormatter", "::", "LONG", ")", ";", "return", "$", ...
Returns the date in the localised long format @return string
[ "Returns", "the", "date", "in", "the", "localised", "long", "format" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBDate.php#L179-L186
train
silverstripe/silverstripe-framework
src/ORM/FieldType/DBDate.php
DBDate.Full
public function Full() { if (!$this->value) { return null; } $formatter = $this->getFormatter(IntlDateFormatter::FULL); return $formatter->format($this->getTimestamp()); }
php
public function Full() { if (!$this->value) { return null; } $formatter = $this->getFormatter(IntlDateFormatter::FULL); return $formatter->format($this->getTimestamp()); }
[ "public", "function", "Full", "(", ")", "{", "if", "(", "!", "$", "this", "->", "value", ")", "{", "return", "null", ";", "}", "$", "formatter", "=", "$", "this", "->", "getFormatter", "(", "IntlDateFormatter", "::", "FULL", ")", ";", "return", "$", ...
Returns the date in the localised full format @return string
[ "Returns", "the", "date", "in", "the", "localised", "full", "format" ]
ed7aaff7da61eefa172fe213ec25e35d2568bc20
https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBDate.php#L193-L200
train