_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q18300
Convert.raw2htmlname
train
public static function raw2htmlname($val) { if (is_array($val)) { foreach ($val as $k => $v) { $val[$k] = self::raw2htmlname($v); }
php
{ "resource": "" }
q18301
Convert.raw2xml
train
public static function raw2xml($val) { if (is_array($val)) { foreach ($val as $k => $v) { $val[$k] = self::raw2xml($v); }
php
{ "resource": "" }
q18302
Convert.raw2js
train
public static function raw2js($val) { if (is_array($val)) { foreach ($val as $k => $v) { $val[$k] = self::raw2js($v); } return $val; } return str_replace( // Intercepts some characters
php
{ "resource": "" }
q18303
Convert.xml2raw
train
public static function xml2raw($val) { if (is_array($val)) { foreach ($val as $k => $v) { $val[$k] = self::xml2raw($v); } return $val; } // More complex text
php
{ "resource": "" }
q18304
Convert.html2raw
train
public static function html2raw($data, $preserveLinks = false, $wordWrap = 0, $config = null) { $defaultConfig = array( 'PreserveLinks' => false, 'ReplaceBoldAsterisk' => true, 'CompressWhitespace' => true, 'ReplaceImagesWithAlt' => true, ); if...
php
{ "resource": "" }
q18305
Convert.upperCamelToLowerCamel
train
public static function upperCamelToLowerCamel($str) { $return = null; $matches = null; if (preg_match('/(^[A-Z]{1,})([A-Z]{1})([a-z]+.*)/', $str, $matches)) { // If string has trailing lowercase after more than one leading uppercase characters, // match everything but...
php
{ "resource": "" }
q18306
Convert.memstring2bytes
train
public static function memstring2bytes($memString) { // Remove non-unit characters from the size $unit = preg_replace('/[^bkmgtpezy]/i', '', $memString); // Remove non-numeric characters from the size $size = preg_replace('/[^0-9\.\-]/', '', $memString); if ($unit) { ...
php
{ "resource": "" }
q18307
Convert.slashes
train
public static function slashes($path, $separator = DIRECTORY_SEPARATOR, $multiple = true) { if ($multiple)
php
{ "resource": "" }
q18308
AuthenticationMiddleware.process
train
public function process(HTTPRequest $request, callable $delegate) { try { $this ->getAuthenticationHandler() ->authenticateRequest($request); } catch (ValidationException $e) { return new HTTPResponse(
php
{ "resource": "" }
q18309
DBEnum.formField
train
public function formField($title = null, $name = null, $hasEmpty = false, $value = "", $emptyString = null) { if (!$title) { $title = $this->getName(); } if (!$name) { $name = $this->getName();
php
{ "resource": "" }
q18310
DBEnum.getEnumObsolete
train
public function getEnumObsolete() { // Without a table or field specified, we can only retrieve known enum values $table = $this->getTable(); $name = $this->getName(); if (empty($table) || empty($name)) { return $this->getEnum(); } // Ensure the table lev...
php
{ "resource": "" }
q18311
DBEnum.setEnum
train
public function setEnum($enum) { if (!is_array($enum)) { $enum = preg_split( '/\s*,\s*/', // trim commas only if they are on the right with a newline following it
php
{ "resource": "" }
q18312
GridFieldAddExistingAutocompleter.handleAction
train
public function handleAction(GridField $gridField, $actionName, $arguments, $data) { switch ($actionName) { case 'addto': if (isset($data['relationID']) && $data['relationID']) {
php
{ "resource": "" }
q18313
InstallEnvironmentAware.initBaseDir
train
protected function initBaseDir($basePath) { if ($basePath) { $this->setBaseDir($basePath); } elseif (defined('BASE_PATH')) {
php
{ "resource": "" }
q18314
InstallEnvironmentAware.getPublicDir
train
public function getPublicDir() { $base = $this->getBaseDir(); $public = Path::join($base, 'public') . DIRECTORY_SEPARATOR;
php
{ "resource": "" }
q18315
InstallEnvironmentAware.checkModuleExists
train
public function checkModuleExists($dirname) { // Mysite is base-only and doesn't need _config.php to be counted if (in_array($dirname, ['mysite', 'app'])) { return file_exists($this->getBaseDir() . $dirname); } $paths = [ "vendor/silverstripe/{$dirname}/", ...
php
{ "resource": "" }
q18316
InstallEnvironmentAware.isIIS
train
public function isIIS($fromVersion = 7) { $webserver = $this->findWebserver(); if (preg_match('#.*IIS/(?<version>[.\\d]+)$#', $webserver,
php
{ "resource": "" }
q18317
InstallEnvironmentAware.findWebserver
train
public function findWebserver() { // Try finding from SERVER_SIGNATURE or SERVER_SOFTWARE if (!empty($_SERVER['SERVER_SIGNATURE'])) { $webserver = $_SERVER['SERVER_SIGNATURE']; } elseif (!empty($_SERVER['SERVER_SOFTWARE'])) {
php
{ "resource": "" }
q18318
Configurable.set_stat
train
public function set_stat($name, $value) { Deprecation::notice('5.0', 'Use ->config()->set()');
php
{ "resource": "" }
q18319
PDOStatementHandle.typeCorrectedFetchAll
train
public function typeCorrectedFetchAll() { if ($this->columnMeta === null) { $columnCount = $this->statement->columnCount(); $this->columnMeta = []; for ($i = 0; $i<$columnCount; $i++) { $this->columnMeta[$i] = $this->statement->getColumnMeta($i); ...
php
{ "resource": "" }
q18320
Backtrace.filter_backtrace
train
public static function filter_backtrace($bt, $ignoredFunctions = null) { $defaultIgnoredFunctions = array( 'SilverStripe\\Logging\\Log::log', 'SilverStripe\\Dev\\Backtrace::backtrace', 'SilverStripe\\Dev\\Backtrace::filtered_backtrace', 'Zend_Log_Writer_Abstra...
php
{ "resource": "" }
q18321
Backtrace.backtrace
train
public static function backtrace($returnVal = false, $ignoreAjax = false, $ignoredFunctions = null) { $plainText = Director::is_cli() || (Director::is_ajax() && !$ignoreAjax); $result = self::get_rendered_backtrace(debug_backtrace(), $plainText, $ignoredFunctions);
php
{ "resource": "" }
q18322
Backtrace.full_func_name
train
public static function full_func_name($item, $showArgs = false, $argCharLimit = 10000) { $funcName = ''; if (isset($item['class'])) { $funcName .= $item['class']; } if (isset($item['type'])) { $funcName .= $item['type']; } if (isset($item['func...
php
{ "resource": "" }
q18323
Backtrace.get_rendered_backtrace
train
public static function get_rendered_backtrace($bt, $plainText = false, $ignoredFunctions = null) { if (empty($bt)) { return ''; } $bt = self::filter_backtrace($bt, $ignoredFunctions); $result = ($plainText) ? '' : '<ul>'; foreach ($bt as $item) { if ($...
php
{ "resource": "" }
q18324
CoreConfigFactory.createRoot
train
public function createRoot() { $instance = new CachedConfigCollection(); // Override nested config to use delta collection $instance->setNestFactory(function ($collection) { return DeltaConfigCollection::createFromCollection($collection, Config::NO_DELTAS); }); ...
php
{ "resource": "" }
q18325
CoreConfigFactory.createCore
train
public function createCore() { $config = new MemoryConfigCollection(); // Set default middleware $config->setMiddlewares([ new InheritanceMiddleware(Config::UNINHERITED), new ExtensionMiddleware(Config::EXCLUDE_EXTRA_SOURCES), ]); // Transform
php
{ "resource": "" }
q18326
DataObjectSchema.reset
train
public function reset() { $this->tableNames = []; $this->databaseFields = []; $this->databaseIndexes = [];
php
{ "resource": "" }
q18327
DataObjectSchema.tableName
train
public function tableName($class) { $tables = $this->getTableNames(); $class = ClassInfo::class_name($class); if (isset($tables[$class])) {
php
{ "resource": "" }
q18328
DataObjectSchema.fieldSpecs
train
public function fieldSpecs($classOrInstance, $options = 0) { $class = ClassInfo::class_name($classOrInstance); // Validate options if (!is_int($options)) { throw new InvalidArgumentException("Invalid options " . var_export($options, true)); } $uninherited = ($opt...
php
{ "resource": "" }
q18329
DataObjectSchema.fieldSpec
train
public function fieldSpec($classOrInstance, $fieldName, $options = 0) { $specs = $this->fieldSpecs($classOrInstance, $options);
php
{ "resource": "" }
q18330
DataObjectSchema.tableClass
train
public function tableClass($table) { $tables = $this->getTableNames(); $class = array_search($table, $tables, true); if ($class) { return $class; } // If there is no class for this table, strip table modifiers (e.g. _Live / _Versions) // from the end and ...
php
{ "resource": "" }
q18331
DataObjectSchema.cacheTableNames
train
protected function cacheTableNames() { if ($this->tableNames) { return; } $this->tableNames = []; foreach (ClassInfo::subclassesFor(DataObject::class) as $class) { if ($class === DataObject::class) { continue; } $table =...
php
{ "resource": "" }
q18332
DataObjectSchema.buildTableName
train
protected function buildTableName($class) { $table = Config::inst()->get($class, 'table_name', Config::UNINHERITED); // Generate default table name if ($table) { return $table; } if (strpos($class, '\\') === false) { return $class; } ...
php
{ "resource": "" }
q18333
DataObjectSchema.databaseFields
train
public function databaseFields($class, $aggregated = true) { $class = ClassInfo::class_name($class); if ($class === DataObject::class) { return []; } $this->cacheDatabaseFields($class); $fields = $this->databaseFields[$class]; if (!$aggregated) { ...
php
{ "resource": "" }
q18334
DataObjectSchema.databaseField
train
public function databaseField($class, $field, $aggregated = true) { $fields = $this->databaseFields($class, $aggregated);
php
{ "resource": "" }
q18335
DataObjectSchema.classHasTable
train
public function classHasTable($class) { if (!is_subclass_of($class, DataObject::class)) {
php
{ "resource": "" }
q18336
DataObjectSchema.compositeFields
train
public function compositeFields($class, $aggregated = true) { $class = ClassInfo::class_name($class); if ($class === DataObject::class) { return []; } $this->cacheDatabaseFields($class); // Get fields for this class $compositeFields = $this->compositeFiel...
php
{ "resource": "" }
q18337
DataObjectSchema.compositeField
train
public function compositeField($class, $field, $aggregated = true) { $fields = $this->compositeFields($class, $aggregated);
php
{ "resource": "" }
q18338
DataObjectSchema.cacheDatabaseFields
train
protected function cacheDatabaseFields($class) { // Skip if already cached if (isset($this->databaseFields[$class]) && isset($this->compositeFields[$class])) { return; } $compositeFields = array(); $dbFields = array(); // Ensure fixed fields appear at the...
php
{ "resource": "" }
q18339
DataObjectSchema.cacheDatabaseIndexes
train
protected function cacheDatabaseIndexes($class) { if (!array_key_exists($class, $this->databaseIndexes)) { $this->databaseIndexes[$class] = array_merge(
php
{ "resource": "" }
q18340
DataObjectSchema.cacheDefaultDatabaseIndexes
train
protected function cacheDefaultDatabaseIndexes($class) { if (array_key_exists($class, $this->defaultDatabaseIndexes)) { return $this->defaultDatabaseIndexes[$class]; } $this->defaultDatabaseIndexes[$class] = []; $fieldSpecs = $this->fieldSpecs($class, self::UNINHERITED);...
php
{ "resource": "" }
q18341
DataObjectSchema.buildCustomDatabaseIndexes
train
protected function buildCustomDatabaseIndexes($class) { $indexes = []; $classIndexes = Config::inst()->get($class, 'indexes', Config::UNINHERITED) ?: []; foreach ($classIndexes as $indexName => $indexSpec) { if (array_key_exists($indexName, $indexes)) { throw new ...
php
{ "resource": "" }
q18342
DataObjectSchema.manyManyComponent
train
public function manyManyComponent($class, $component) { $classes = ClassInfo::ancestry($class); foreach ($classes as $parentClass) { // Check if the component is defined in many_many on this class $otherManyMany = Config::inst()->get($parentClass, 'many_many', Config::UNINHER...
php
{ "resource": "" }
q18343
DataObjectSchema.parseBelongsManyManyComponent
train
protected function parseBelongsManyManyComponent($parentClass, $component, $specification) { $childClass = $specification; $relationName = null; if (strpos($specification, '.') !== false) { list($childClass, $relationName) = explode('.', $specification, 2); } // ...
php
{ "resource": "" }
q18344
DataObjectSchema.manyManyExtraFieldsForComponent
train
public function manyManyExtraFieldsForComponent($class, $component) { // Get directly declared many_many_extraFields $extraFields = Config::inst()->get($class, 'many_many_extraFields'); if (isset($extraFields[$component])) { return $extraFields[$component]; } // ...
php
{ "resource": "" }
q18345
DataObjectSchema.hasManyComponent
train
public function hasManyComponent($class, $component, $classOnly = true) { $hasMany = (array)Config::inst()->get($class, 'has_many'); if (!isset($hasMany[$component])) { return null; } // Remove has_one specifier if given $hasMany = $hasMany[$component];
php
{ "resource": "" }
q18346
DataObjectSchema.hasOneComponent
train
public function hasOneComponent($class, $component) { $hasOnes = Config::forClass($class)->get('has_one'); if (!isset($hasOnes[$component])) { return null; } // Validate
php
{ "resource": "" }
q18347
DataObjectSchema.belongsToComponent
train
public function belongsToComponent($class, $component, $classOnly = true) { $belongsTo = (array)Config::forClass($class)->get('belongs_to'); if (!isset($belongsTo[$component])) { return null; } // Remove has_one specifier if given $belongsTo = $belongsTo[$compone...
php
{ "resource": "" }
q18348
DataObjectSchema.getManyManyInverseRelationship
train
protected function getManyManyInverseRelationship($childClass, $parentClass) { $otherManyMany = Config::inst()->get($childClass, 'many_many', Config::UNINHERITED); if (!$otherManyMany) { return null; } foreach ($otherManyMany as $inverseComponentName => $manyManySpec) { ...
php
{ "resource": "" }
q18349
DataObjectSchema.getRemoteJoinField
train
public function getRemoteJoinField($class, $component, $type = 'has_many', &$polymorphic = false) { // Extract relation from current object if ($type === 'has_many') { $remoteClass = $this->hasManyComponent($class, $component, false); } else { $remoteClass = $this->be...
php
{ "resource": "" }
q18350
DataObjectSchema.checkManyManyFieldClass
train
protected function checkManyManyFieldClass($parentClass, $component, $joinClass, $specification, $key) { // Ensure value for this key exists if (empty($specification[$key])) { throw new InvalidArgumentException( "many_many relation {$parentClass}.{$component} has missing ...
php
{ "resource": "" }
q18351
DataObjectSchema.checkRelationClass
train
protected function checkRelationClass($class, $component, $relationClass, $type) { if (!is_string($component) || is_numeric($component)) { throw new InvalidArgumentException( "{$class} has invalid {$type} relation name" ); } if (!is_string($relationCla...
php
{ "resource": "" }
q18352
SSTemplateParser.construct
train
function construct($matchrule, $name, $arguments = null) { $res = parent::construct($matchrule, $name, $arguments);
php
{ "resource": "" }
q18353
SSTemplateParser.setClosedBlocks
train
public function setClosedBlocks($closedBlocks) { $this->closedBlocks = array();
php
{ "resource": "" }
q18354
SSTemplateParser.setOpenBlocks
train
public function setOpenBlocks($openBlocks) { $this->openBlocks = array(); foreach ((array) $openBlocks as $name => $callable) {
php
{ "resource": "" }
q18355
SSTemplateParser.validateExtensionBlock
train
protected function validateExtensionBlock($name, $callable, $type) { if (!is_string($name)) { throw new InvalidArgumentException( sprintf( "Name argument for %s must be a string", $type ) ); } elseif (!is...
php
{ "resource": "" }
q18356
SSTemplateParser.CallArguments_Argument
train
function CallArguments_Argument(&$res, $sub) { if (!empty($res['php'])) { $res['php'] .= ', '; }
php
{ "resource": "" }
q18357
SSTemplateParser.ClosedBlock_Handle_Loop
train
function ClosedBlock_Handle_Loop(&$res) { if ($res['ArgumentCount'] > 1) { throw new SSTemplateParseException('Either no or too many arguments in control block. Must be one ' . 'argument only.', $this); } //loop without arguments loops on the current scope ...
php
{ "resource": "" }
q18358
SSTemplateParser.ClosedBlock_Handle_With
train
function ClosedBlock_Handle_With(&$res) { if ($res['ArgumentCount'] != 1) { throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' . 'argument only.', $this); } $arg = $res['Arguments'][0]; if ($arg['ArgumentMode'...
php
{ "resource": "" }
q18359
SSTemplateParser.Text__finalise
train
function Text__finalise(&$res) { $text = $res['text']; // Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes $text = stripslashes($text); $text = addcslashes($text, '\'\\'); // TODO: This is pretty ugly & gets applied on...
php
{ "resource": "" }
q18360
SSTemplateParser.compileString
train
public function compileString($string, $templateName = "", $includeDebuggingComments = false, $topTemplate = true) { if (!trim($string)) { $code = ''; } else { parent::__construct($string); $this->includeDebuggingComments = $includeDebuggingComments; ...
php
{ "resource": "" }
q18361
CoreKernel.sessionEnvironment
train
protected function sessionEnvironment() { // Check isDev in querystring if (isset($_GET['isDev'])) { if (isset($_SESSION)) { unset($_SESSION['isTest']); // In case we are changing from test mode $_SESSION['isDev'] = $_GET['isDev']; } ...
php
{ "resource": "" }
q18362
CoreKernel.bootConfigs
train
protected function bootConfigs() { global $project; $projectBefore = $project; $config = ModuleManifest::config(); // After loading all other app manifests, include _config.php files $this->getModuleLoader()->getManifest()->activateConfig();
php
{ "resource": "" }
q18363
CoreKernel.bootDatabaseEnvVars
train
protected function bootDatabaseEnvVars() { // Set default database config $databaseConfig = $this->getDatabaseConfig();
php
{ "resource": "" }
q18364
CoreKernel.validateDatabase
train
protected function validateDatabase() { $databaseConfig = DB::getConfig(); // Gracefully fail if no DB is configured if (empty($databaseConfig['database'])) {
php
{ "resource": "" }
q18365
CoreKernel.detectLegacyEnvironment
train
protected function detectLegacyEnvironment() { // Is there an _ss_environment.php file? if (!file_exists($this->basePath . '/_ss_environment.php') && !file_exists(dirname($this->basePath) . '/_ss_environment.php') ) { return; } // Build error response...
php
{ "resource": "" }
q18366
CoreKernel.redirectToInstaller
train
protected function redirectToInstaller() { // Error if installer not available if (!file_exists(Director::publicFolder() . '/install.php')) { throw new HTTPResponse_Exception(
php
{ "resource": "" }
q18367
CoreKernel.getDatabaseConfig
train
protected function getDatabaseConfig() { /** @skipUpgrade */ $databaseConfig = [ "type" => Environment::getEnv('SS_DATABASE_CLASS') ?: 'MySQLDatabase', "server" => Environment::getEnv('SS_DATABASE_SERVER') ?: 'localhost', "username" => Environment::getEnv('SS_DATA...
php
{ "resource": "" }
q18368
CoreKernel.getDatabaseName
train
protected function getDatabaseName() { // Check globals global $database; if (!empty($database)) { return $this->getDatabasePrefix() . $database . $this->getDatabaseSuffix(); } global $databaseConfig; if (!empty($databaseConfig['database'])) { ...
php
{ "resource": "" }
q18369
CoreKernel.bootPHP
train
protected function bootPHP() { if ($this->getEnvironment() === self::LIVE) { // limited to fatal errors and warnings in live mode error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT | E_NOTICE)); } else { // Report all errors in dev / test mode error_rep...
php
{ "resource": "" }
q18370
CoreKernel.bootManifests
train
protected function bootManifests($flush) { // Setup autoloader $this->getClassLoader()->init($this->getIncludeTests(), $flush); // Find modules $this->getModuleLoader()->init($this->getIncludeTests(), $flush); // Flush config if ($flush) { $config = $thi...
php
{ "resource": "" }
q18371
CoreKernel.bootErrorHandling
train
protected function bootErrorHandling() { // Register error handler $errorHandler = Injector::inst()->get(ErrorHandler::class); $errorHandler->start(); // Register error log file $errorLog = Environment::getEnv('SS_ERROR_LOG'); if ($errorLog) { $logger = I...
php
{ "resource": "" }
q18372
MySQLSchemaManager.renameTable
train
public function renameTable($oldTableName, $newTableName) { if (!$this->hasTable($oldTableName)) { throw new LogicException('Table ' . $oldTableName . ' does not exist.');
php
{ "resource": "" }
q18373
MySQLSchemaManager.runTableCheckCommand
train
protected function runTableCheckCommand($sql) { $testResults = $this->query($sql); foreach ($testResults as $testRecord) { if (strtolower($testRecord['Msg_text']) !=
php
{ "resource": "" }
q18374
MySQLSchemaManager.renameField
train
public function renameField($tableName, $oldName, $newName) { $fieldList = $this->fieldList($tableName); if (array_key_exists($oldName, $fieldList)) {
php
{ "resource": "" }
q18375
MySQLSchemaManager.createIndex
train
public function createIndex($tableName, $indexName, $indexSpec) { $this->query("ALTER TABLE \"$tableName\" ADD " .
php
{ "resource": "" }
q18376
MySQLSchemaManager.getIndexSqlDefinition
train
protected function getIndexSqlDefinition($indexName, $indexSpec) { if ($indexSpec['type'] == 'using') { return sprintf('index "%s" using (%s)', $indexName, $this->implodeColumnList($indexSpec['columns'])); } else {
php
{ "resource": "" }
q18377
MySQLSchemaManager.varchar
train
public function varchar($values) { //For reference, this is what typically gets passed to this function: //$parts=Array('datatype'=>'varchar', 'precision'=>$this->size, 'character set'=>'utf8', 'collate'=> //'utf8_general_ci'); //DB::requireField($this->tableName, $this->name, "varch...
php
{ "resource": "" }
q18378
Path.join
train
public static function join(...$parts) { // In case $parts passed as an array in first parameter if (count($parts) === 1 && is_array($parts[0])) { $parts = $parts[0]; } // Cleanup and join all parts $parts = array_filter(array_map('trim', $parts));
php
{ "resource": "" }
q18379
Member_GroupSet.foreignIDFilter
train
public function foreignIDFilter($id = null) { if ($id === null) { $id = $this->getForeignID(); } // Find directly applied groups $manyManyFilter = parent::foreignIDFilter($id); $query = SQLSelect::create('"Group_Members"."GroupID"', '"Group_Members"', $manyManyFi...
php
{ "resource": "" }
q18380
Member_GroupSet.canAddGroups
train
protected function canAddGroups($itemIDs) { if (empty($itemIDs)) { return true; }
php
{ "resource": "" }
q18381
CSSContentParser.selector2xpath
train
public function selector2xpath($selector) { $parts = preg_split('/\\s+/', $selector); $xpath = ""; foreach ($parts as $part) { if (preg_match('/^([A-Za-z][A-Za-z0-9]*)/', $part, $matches)) { $xpath .= "//$matches[1]"; } else { $xpath .=...
php
{ "resource": "" }
q18382
FormAction.getSchemaDataDefaults
train
public function getSchemaDataDefaults() { $defaults = parent::getSchemaDataDefaults(); $defaults['attributes']['type'] = $this->getUseButtonTag() ? 'button' : 'submit';
php
{ "resource": "" }
q18383
i18n.get_closest_translation
train
public static function get_closest_translation($locale) { // Check if exact match $pool = self::getSources()->getKnownLocales(); if (isset($pool[$locale])) { return $locale; } // Fallback to best locale for common language $localesData = static::getData()...
php
{ "resource": "" }
q18384
i18n.with_locale
train
public static function with_locale($locale, $callback) { $oldLocale = self::$current_locale; static::set_locale($locale); try {
php
{ "resource": "" }
q18385
NullableField.setValue
train
public function setValue($value, $data = null) { $id = $this->getIsNullId(); if (is_array($data) && array_key_exists($id, $data) && $data[$id]) { $value = null; }
php
{ "resource": "" }
q18386
HTML.createTag
train
public static function createTag($tag, $attributes, $content = null) { $tag = strtolower($tag); // Build list of arguments $preparedAttributes = ''; foreach ($attributes as $attributeKey => $attributeValue) { // Only set non-empty strings (ensures strlen(0) > 0) ...
php
{ "resource": "" }
q18387
Config_ForClass.merge
train
public function merge($name, $value) { Config::modify()->merge($this->class,
php
{ "resource": "" }
q18388
Config_ForClass.set
train
public function set($name, $value) { Config::modify()->set($this->class,
php
{ "resource": "" }
q18389
DebugViewFriendlyErrorFormatter.output
train
public function output($statusCode) { // TODO: Refactor into a content-type option if (Director::is_ajax()) { return $this->getTitle(); } $renderer = Debug::create_debug_view(); $output = $renderer->renderHeader(); $output .= $renderer->renderInfo("Websit...
php
{ "resource": "" }
q18390
GridFieldDetailForm_ItemRequest.getFormActions
train
protected function getFormActions() { $actions = new FieldList(); if ($this->record->ID !== 0) { // existing record if ($this->record->canEdit()) { $actions->push(FormAction::create('doSave', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Save', 'Save')) ...
php
{ "resource": "" }
q18391
GridFieldDetailForm_ItemRequest.doPrevious
train
public function doPrevious($data, $form) { $this->getToplevelController()->getResponse()->addHeader('X-Pjax', 'Content');
php
{ "resource": "" }
q18392
GridFieldDetailForm_ItemRequest.doNext
train
public function doNext($data, $form) { $this->getToplevelController()->getResponse()->addHeader('X-Pjax', 'Content');
php
{ "resource": "" }
q18393
GridFieldDetailForm_ItemRequest.doNew
train
public function doNew($data, $form) { return
php
{ "resource": "" }
q18394
GridFieldDetailForm_ItemRequest.getEditLink
train
public function getEditLink($id) { return Controller::join_links( $this->gridField->Link(), 'item', $id,
php
{ "resource": "" }
q18395
GridFieldDetailForm_ItemRequest.redirectAfterSave
train
protected function redirectAfterSave($isNewRecord) { $controller = $this->getToplevelController(); if ($isNewRecord) { return $controller->redirect($this->Link()); } elseif ($this->gridField->getList()->byID($this->record->ID)) { // Return new view, as we can't do a "...
php
{ "resource": "" }
q18396
GridFieldDetailForm_ItemRequest.saveFormIntoRecord
train
protected function saveFormIntoRecord($data, $form) { $list = $this->gridField->getList(); // Check object matches the correct classname if (isset($data['ClassName']) && $data['ClassName'] != $this->record->ClassName) { $newClassName = $data['ClassName']; // The reco...
php
{ "resource": "" }
q18397
GridFieldDetailForm_ItemRequest.getTemplates
train
public function getTemplates() { $templates = SSViewer::get_templates_by_class($this, '', __CLASS__);
php
{ "resource": "" }
q18398
Deprecation.get_enabled
train
public static function get_enabled() { // Deprecation is only available on dev if (!Director::isDev()) { return false; } if (isset(self::$enabled)) {
php
{ "resource": "" }
q18399
Deprecation.restore_settings
train
public static function restore_settings($settings) { self::$notice_level = $settings['level'];
php
{ "resource": "" }