_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q17600 | GridField.getColumnAttributes | train | public function getColumnAttributes($record, $column)
{
if (!$this->columnDispatch) {
$this->buildColumnDispatch();
}
if (!empty($this->columnDispatch[$column])) {
$attributes = array();
foreach ($this->columnDispatch[$column] as $handler) {
... | php | {
"resource": ""
} |
q17601 | GridField.getColumnMetadata | train | public function getColumnMetadata($column)
{
if (!$this->columnDispatch) {
$this->buildColumnDispatch();
}
if (!empty($this->columnDispatch[$column])) {
$metaData = array();
foreach ($this->columnDispatch[$column] as $handler) {
/**
... | php | {
"resource": ""
} |
q17602 | GridField.buildColumnDispatch | train | protected function buildColumnDispatch()
{
$this->columnDispatch = array();
foreach ($this->getComponents() as $item) {
if ($item instanceof GridField_ColumnProvider) {
$columns = $item->getColumnsHandled($this);
| php | {
"resource": ""
} |
q17603 | GridField.gridFieldAlterAction | train | public function gridFieldAlterAction($data, $form, HTTPRequest $request)
{
$data = $request->requestVars();
// Protection against CSRF attacks
$token = $this
->getForm()
->getSecurityToken();
if (!$token->checkRequest($request)) {
$this->httpError... | php | {
"resource": ""
} |
q17604 | GridField.handleRequest | train | public function handleRequest(HTTPRequest $request)
{
if ($this->brokenOnConstruct) {
user_error(
sprintf(
"parent::__construct() needs to be called on %s::__construct()",
__CLASS__
),
E_USER_WARNING
... | php | {
"resource": ""
} |
q17605 | DefaultAdminService.setDefaultAdmin | train | public static function setDefaultAdmin($username, $password)
{
// don't overwrite if already set
if (static::hasDefaultAdmin()) {
throw new BadMethodCallException(
"Default admin already exists. Use clearDefaultAdmin() first."
);
}
if (empty($... | php | {
"resource": ""
} |
q17606 | DefaultAdminService.hasDefaultAdmin | train | public static function hasDefaultAdmin()
{
// Check environment if not explicitly set
if (!isset(static::$has_default_admin)) {
| php | {
"resource": ""
} |
q17607 | DefaultAdminService.findOrCreateAdmin | train | public function findOrCreateAdmin($email, $name = null)
{
$this->extend('beforeFindOrCreateAdmin', $email, $name);
// Find member
/** @var Member $admin */
$admin = Member::get()
->filter('Email', $email)
->first();
// Find or create admin group
... | php | {
"resource": ""
} |
q17608 | DefaultAdminService.findOrCreateAdminGroup | train | protected function findOrCreateAdminGroup()
{
// Check pre-existing group
$adminGroup = Permission::get_groups_by_permission('ADMIN')->first();
if ($adminGroup) {
return $adminGroup;
}
// Check if default records create the group
Group::singleton()->requi... | php | {
"resource": ""
} |
q17609 | LostPasswordHandler.redirectToLostPassword | train | public function redirectToLostPassword()
{
$lostPasswordLink = Security::singleton()->Link('lostpassword');
| php | {
"resource": ""
} |
q17610 | LostPasswordHandler.forgotPassword | train | public function forgotPassword($data, $form)
{
// Run a first pass validation check on the data
$dataValidation = $this->validateForgotPasswordData($data, $form);
if ($dataValidation instanceof HTTPResponse) {
return $dataValidation;
}
/** @var Member $member */
... | php | {
"resource": ""
} |
q17611 | LostPasswordHandler.validateForgotPasswordData | train | protected function validateForgotPasswordData(array $data, LostPasswordForm $form)
{
if (empty($data['Email'])) {
$form->sessionMessage(
_t(
'SilverStripe\\Security\\Member.ENTEREMAIL',
| php | {
"resource": ""
} |
q17612 | LostPasswordHandler.getMemberFromData | train | protected function getMemberFromData(array $data)
{
if (!empty($data['Email'])) {
$uniqueIdentifier = | php | {
"resource": ""
} |
q17613 | LostPasswordHandler.sendEmail | train | protected function sendEmail($member, $token)
{
/** @var Email $email */
$email = Email::create()
->setHTMLTemplate('SilverStripe\\Control\\Email\\ForgotPasswordEmail')
->setData($member)
| php | {
"resource": ""
} |
q17614 | LostPasswordHandler.redirectToSuccess | train | protected function redirectToSuccess(array $data)
{
$link = $this->link('passwordsent');
| php | {
"resource": ""
} |
q17615 | Map.unshift | train | public function unshift($key, $value)
{
$oldItems = $this->firstItems;
$this->firstItems = array(
$key => $value
);
if ($oldItems) { | php | {
"resource": ""
} |
q17616 | Map.push | train | public function push($key, $value)
{
$oldItems = $this->lastItems;
$this->lastItems = array(
$key => $value
);
if ($oldItems) { | php | {
"resource": ""
} |
q17617 | Map.getIterator | train | public function getIterator()
{
return new Map_Iterator(
$this->list->getIterator(),
$this->keyField,
| php | {
"resource": ""
} |
q17618 | GridField_FormAction.getNameFromParent | train | protected function getNameFromParent()
{
$base = $this->gridField;
$name = array();
do {
array_unshift($name, $base->getName());
| php | {
"resource": ""
} |
q17619 | Security.getAuthenticator | train | protected function getAuthenticator($name = 'default')
{
$authenticators = $this->authenticators;
if (isset($authenticators[$name])) {
| php | {
"resource": ""
} |
q17620 | Security.getApplicableAuthenticators | train | public function getApplicableAuthenticators($service = Authenticator::LOGIN)
{
$authenticators = $this->getAuthenticators();
/** @var Authenticator $authenticator */
foreach ($authenticators as $name => $authenticator) {
if (!($authenticator->supportedServices() & $service)) {
... | php | {
"resource": ""
} |
q17621 | Security.getLoginForms | train | public function getLoginForms()
{
Deprecation::notice('5.0.0', 'Now handled by delegateToMultipleHandlers');
return array_map(
function (Authenticator $authenticator) {
return [
| php | {
"resource": ""
} |
q17622 | Security.Link | train | public function Link($action = null)
{
/** @skipUpgrade */
$link = Controller::join_links(Director::baseURL(), "Security", $action);
| php | {
"resource": ""
} |
q17623 | Security.preLogin | train | protected function preLogin()
{
// Event handler for pre-login, with an option to let it break you out of the login form
$eventResults = $this->extend('onBeforeSecurityLogin');
// If there was a redirection, return
if ($this->redirectedTo()) {
return $this->getResponse();... | php | {
"resource": ""
} |
q17624 | Security.getResponseController | train | protected function getResponseController($title)
{
// Use the default setting for which Page to use to render the security page
$pageClass = $this->config()->get('page_class');
if (!$pageClass || !class_exists($pageClass)) {
return $this;
}
// Create new instance... | php | {
"resource": ""
} |
q17625 | Security.generateTabbedFormSet | train | protected function generateTabbedFormSet($forms)
{
if (count($forms) === 1) {
return $forms;
}
$viewData = new ArrayData([
'Forms' => new ArrayList($forms),
]);
| php | {
"resource": ""
} |
q17626 | Security.setSessionMessage | train | public function setSessionMessage(
$message,
$messageType = ValidationResult::TYPE_WARNING,
$messageCast = ValidationResult::CAST_TEXT
) {
Controller::curr()
->getRequest()
->getSession()
| php | {
"resource": ""
} |
q17627 | Security.logout | train | public function logout($request = null, $service = Authenticator::LOGOUT)
{
$authName = null;
if (!$request) {
$request = $this->getRequest();
}
$handlers = $this->getServiceAuthenticatorsFromRequest($service, $request);
$link = $this->Link('logout');
a... | php | {
"resource": ""
} |
q17628 | Security.getServiceAuthenticatorsFromRequest | train | protected function getServiceAuthenticatorsFromRequest($service, HTTPRequest $request)
{
$authName = null;
if ($request->param('ID')) {
$authName = $request->param('ID');
}
// Delegate to a single named handler - e.g. Security/login/<authname>/
if ($authName && ... | php | {
"resource": ""
} |
q17629 | Security.aggregateTabbedForms | train | protected function aggregateTabbedForms(array $results)
{
$forms = [];
foreach ($results as $authName => $singleResult) {
// The result *must* be an array with a Form key
if (!is_array($singleResult) || !isset($singleResult['Form'])) {
user_error('Authenticato... | php | {
"resource": ""
} |
q17630 | Security.delegateToMultipleHandlers | train | protected function delegateToMultipleHandlers(array $handlers, $title, array $templates, callable $aggregator)
{
// Simpler case for a single authenticator
if (count($handlers) === 1) {
return $this->delegateToHandler(array_values($handlers)[0], $title, $templates);
}
/... | php | {
"resource": ""
} |
q17631 | Security.delegateToHandler | train | protected function delegateToHandler(RequestHandler $handler, $title, array $templates = [])
{
$result = $handler->handleRequest($this->getRequest());
| php | {
"resource": ""
} |
q17632 | Security.renderWrappedController | train | protected function renderWrappedController($title, array $fragments, array $templates)
{
$controller = $this->getResponseController($title);
// if the controller calls Director::redirect(), this will break early
if (($response = $controller->getResponse()) && $response->isFinished()) {
... | php | {
"resource": ""
} |
q17633 | Security.lostpassword | train | public function lostpassword()
{
$handlers = [];
$authenticators = $this->getApplicableAuthenticators(Authenticator::RESET_PASSWORD);
/** @var Authenticator $authenticator */
foreach ($authenticators as $authenticator) {
$handlers[] = $authenticator->getLostPasswordHandle... | php | {
"resource": ""
} |
q17634 | Security.getTemplatesFor | train | public function getTemplatesFor($action)
{
$templates = SSViewer::get_templates_by_class(static::class, "_{$action}", __CLASS__);
return array_merge(
$templates,
[
| php | {
"resource": ""
} |
q17635 | Security.setDefaultAdmin | train | public static function setDefaultAdmin($username, $password)
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::setDefaultAdmin($username, $password)');
| php | {
"resource": ""
} |
q17636 | Security.logout_url | train | public static function logout_url()
{
$logoutUrl = Controller::join_links(Director::baseURL(), self::config()->get('logout_url'));
| php | {
"resource": ""
} |
q17637 | MultiSelectField.setValue | train | public function setValue($value, $obj = null)
{
// If we're not passed a value directly,
// we can look for it in a relation method on | php | {
"resource": ""
} |
q17638 | MultiSelectField.loadFrom | train | public function loadFrom(DataObjectInterface $record)
{
$fieldName = $this->getName();
if (empty($fieldName) || empty($record)) {
return;
}
$relation = $record->hasMethod($fieldName)
? $record->$fieldName()
: null;
// Detect DB relation o... | php | {
"resource": ""
} |
q17639 | MultiSelectField.stringDecode | train | protected function stringDecode($value)
{
// Handle empty case
if (empty($value)) {
return array();
}
// If json deserialisation fails, then fallover to legacy format
$result = json_decode($value, true);
if ($result !== false) {
| php | {
"resource": ""
} |
q17640 | MultiSelectField.csvEncode | train | protected function csvEncode($value)
{
if (!$value) {
return null;
}
return implode(
',',
array_map(
function ($x) {
| php | {
"resource": ""
} |
q17641 | ClassLoader.getItemPath | train | public function getItemPath($class)
{
foreach (array_reverse($this->manifests) as $manifest) {
/** @var ClassManifest $manifestInst */
$manifestInst = $manifest['instance'];
if ($path = $manifestInst->getItemPath($class)) {
return | php | {
"resource": ""
} |
q17642 | ClassLoader.init | train | public function init($includeTests = false, $forceRegen = false)
{
foreach ($this->manifests as $manifest) {
| php | {
"resource": ""
} |
q17643 | Permission.check | train | public static function check($code, $arg = "any", $member = null, $strict = true)
{
if (!$member) {
if (!Security::getCurrentUser()) {
return false;
}
| php | {
"resource": ""
} |
q17644 | Permission.permissions_for_member | train | public static function permissions_for_member($memberID)
{
$groupList = self::groupList($memberID);
if ($groupList) {
$groupCSV = implode(", ", $groupList);
$allowed = array_unique(DB::query("
SELECT \"Code\"
FROM \"Permission\"
WHERE \"Type\" = " . self::GRANT_... | php | {
"resource": ""
} |
q17645 | Permission.groupList | train | public static function groupList($memberID = null)
{
// Default to current member, with session-caching
if (!$memberID) {
$member = Security::getCurrentUser();
if ($member && isset($_SESSION['Permission_groupList'][$member->ID])) {
return $_SESSION['Permission... | php | {
"resource": ""
} |
q17646 | Permission.get_members_by_permission | train | public static function get_members_by_permission($code)
{
$toplevelGroups = self::get_groups_by_permission($code);
if (!$toplevelGroups) {
return new ArrayList();
}
$groupIDs = array();
foreach ($toplevelGroups as $group) {
$familyIDs = $group->collat... | php | {
"resource": ""
} |
q17647 | Permission.get_groups_by_permission | train | public static function get_groups_by_permission($codes)
{
$codeParams = is_array($codes) ? $codes : array($codes);
$codeClause = DB::placeholders($codeParams);
// Via Roles are groups that have the permission via a role
/** @skipUpgrade */
return Group::get()
->w... | php | {
"resource": ""
} |
q17648 | Permission.sort_permissions | train | public static function sort_permissions($a, $b)
{
if ($a['sort'] == $b['sort']) {
// Same sort value, do alpha | php | {
"resource": ""
} |
q17649 | Permission.get_declared_permissions_list | train | public static function get_declared_permissions_list()
{
if (!self::$declared_permissions) {
return null;
}
if (self::$declared_permissions_list) {
return self::$declared_permissions_list;
}
self::$declared_permissions_list = array();
| php | {
"resource": ""
} |
q17650 | Permission.traverse_declared_permissions | train | protected static function traverse_declared_permissions($declared, &$list)
{
if (!is_array($declared)) {
return;
}
foreach ($declared as $perm => $value) {
if ($value instanceof Permission_Group) {
$list[] = | php | {
"resource": ""
} |
q17651 | GridFieldConfig.getComponentsByType | train | public function getComponentsByType($type)
{
$components = new ArrayList();
foreach ($this->components as $component) {
if ($component instanceof $type) {
| php | {
"resource": ""
} |
q17652 | GridFieldConfig.getComponentByType | train | public function getComponentByType($type)
{
foreach ($this->components as $component) {
| php | {
"resource": ""
} |
q17653 | Validator.validate | train | public function validate()
{
$this->resetResult();
if ($this->getEnabled()) {
| php | {
"resource": ""
} |
q17654 | EmbedShortcodeProvider.handle_shortcode | train | public static function handle_shortcode($arguments, $content, $parser, $shortcode, $extra = array())
{
// Get service URL
if (!empty($content)) {
$serviceURL = $content;
} elseif (!empty($arguments['url'])) {
$serviceURL = $arguments['url'];
} else {
... | php | {
"resource": ""
} |
q17655 | EmbedShortcodeProvider.videoEmbed | train | protected static function videoEmbed($arguments, $content)
{
// Ensure outer div has given width (but leave height auto)
if (!empty($arguments['width'])) {
$arguments['style'] = 'width: ' . intval($arguments['width']) . 'px;';
}
// Convert caption to <p>
if (!emp... | php | {
"resource": ""
} |
q17656 | CompositeField.getSchemaDataDefaults | train | public function getSchemaDataDefaults()
{
$defaults = parent::getSchemaDataDefaults();
$children = $this->getChildren();
if ($children && $children->count()) {
$childSchema = [];
/** @var FormField $child */
foreach ($children as $child) {
... | php | {
"resource": ""
} |
q17657 | CompositeField.collateDataFields | train | public function collateDataFields(&$list, $saveableOnly = false)
{
foreach ($this->children as $field) {
if (! $field instanceof FormField) {
continue;
}
if ($field instanceof CompositeField) {
$field->collateDataFields($list, $saveableOnly... | php | {
"resource": ""
} |
q17658 | CompositeField.makeFieldReadonly | train | public function makeFieldReadonly($field)
{
$fieldName = ($field instanceof FormField) ? $field->getName() : $field;
// Iterate on items, looking for the applicable field
foreach ($this->children as $i => $item) {
if ($item instanceof CompositeField) {
if ($item-... | php | {
"resource": ""
} |
q17659 | SQLExpression.renameTable | train | public function renameTable($old, $new)
{
$this->replaceText("`$old`", "`$new`");
$this->replaceText("\"$old\"", "\"$new\"");
| php | {
"resource": ""
} |
q17660 | SQLExpression.sql | train | public function sql(&$parameters = array())
{
// Build each component as needed
$sql = DB::build_sql($this, $parameters);
if (empty($sql)) {
return null;
}
| php | {
"resource": ""
} |
q17661 | SQLExpression.copyTo | train | protected function copyTo(SQLExpression $object)
{
$target = array_keys(get_object_vars($object));
foreach (get_object_vars($this) as $variable => $value) {
| php | {
"resource": ""
} |
q17662 | CMSSecurity.getTargetMember | train | public function getTargetMember()
{
$tempid = $this->getRequest()->requestVar('tempid');
if ($tempid) {
| php | {
"resource": ""
} |
q17663 | CMSSecurity.redirectToExternalLogin | train | protected function redirectToExternalLogin()
{
$loginURL = Security::create()->Link('login');
$loginURLATT = Convert::raw2att($loginURL);
$loginURLJS = Convert::raw2js($loginURL);
$message = _t(
__CLASS__ . '.INVALIDUSER',
'<p>Invalid user. <a target="_top" hr... | php | {
"resource": ""
} |
q17664 | CMSSecurity.success | train | public function success()
{
// Ensure member is properly logged in
if (!Security::getCurrentUser() || !class_exists(AdminRootController::class)) {
return $this->redirectToExternalLogin();
}
// Get redirect url
$controller = $this->getResponseController(_t(__CLASS... | php | {
"resource": ""
} |
q17665 | ChangeDetectionMiddleware.sendNotModified | train | protected function sendNotModified(HTTPRequest $request, HTTPResponse $response)
{
// 304 is invalid for destructive requests
if (in_array($request->httpMethod(), ['POST', 'DELETE', 'PUT'])) {
$response->setStatusCode(412);
| php | {
"resource": ""
} |
q17666 | MoneyField.buildCurrencyField | train | protected function buildCurrencyField()
{
$name = $this->getName();
// Validate allowed currencies
$currencyValue = $this->fieldCurrency ? $this->fieldCurrency->dataValue() : null;
$allowedCurrencies = $this->getAllowedCurrencies();
if (count($allowedCurrencies) === 1) {
... | php | {
"resource": ""
} |
q17667 | MoneyField.getDBMoney | train | protected function getDBMoney()
{
return DBMoney::create_field('Money', [
'Currency' => | php | {
"resource": ""
} |
q17668 | MoneyField.setAllowedCurrencies | train | public function setAllowedCurrencies($currencies)
{
if (empty($currencies)) {
$currencies = [];
} elseif (is_string($currencies)) {
$currencies = [
$currencies => $currencies
];
} elseif (!is_array($currencies)) {
throw new Inva... | php | {
"resource": ""
} |
q17669 | DebugView.Breadcrumbs | train | public function Breadcrumbs()
{
$basePath = str_replace(Director::protocolAndHost(), '', Director::absoluteBaseURL());
$relPath = parse_url(
substr($_SERVER['REQUEST_URI'], strlen($basePath), strlen($_SERVER['REQUEST_URI'])),
PHP_URL_PATH
);
$parts = explode('... | php | {
"resource": ""
} |
q17670 | DebugView.renderHeader | train | public function renderHeader($httpRequest = null)
{
$url = htmlentities(
$_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'],
ENT_COMPAT,
'UTF-8'
);
$debugCSS = ModuleResourceLoader::singleton()
->resolveURL('silverstripe/framework:clie... | php | {
"resource": ""
} |
q17671 | DebugView.renderError | train | public function renderError($httpRequest, $errno, $errstr, $errfile, $errline)
{
$errorType = isset(self::$error_types[$errno]) ? self::$error_types[$errno] : self::$unknown_error;
$httpRequestEnt = htmlentities($httpRequest, ENT_COMPAT, 'UTF-8');
if (ini_get('html_errors')) {
$e... | php | {
"resource": ""
} |
q17672 | DebugView.renderSourceFragment | train | public function renderSourceFragment($lines, $errline)
{
$output = '<div class="info"><h3>Source</h3>';
$output .= '<pre>';
foreach ($lines as $offset => $line) {
$line = htmlentities($line, ENT_COMPAT, 'UTF-8');
if ($offset == $errline) {
$output | php | {
"resource": ""
} |
q17673 | DebugView.renderTrace | train | public function renderTrace($trace)
{
$output = '<div class="info">';
$output .= '<h3>Trace</h3>';
| php | {
"resource": ""
} |
q17674 | DebugView.renderVariable | train | public function renderVariable($val, $caller)
{
$output = '<pre style="background-color:#ccc;padding:5px;font-size:14px;line-height:18px;">';
$output .= "<span style=\"font-size: 12px;color:#666;\">" . | php | {
"resource": ""
} |
q17675 | SQLConditionalExpression.addFrom | train | public function addFrom($from)
{
if (is_array($from)) {
$this->from = array_merge($this->from, $from);
} elseif (!empty($from)) {
| php | {
"resource": ""
} |
q17676 | SQLConditionalExpression.addLeftJoin | train | public function addLeftJoin($table, $onPredicate, $tableAlias = '', $order = 20, $parameters = array())
{
if (!$tableAlias) {
$tableAlias = $table;
}
$this->from[$tableAlias] = array(
'type' => 'LEFT',
| php | {
"resource": ""
} |
q17677 | SQLConditionalExpression.addInnerJoin | train | public function addInnerJoin($table, $onPredicate, $tableAlias = null, $order = 20, $parameters = array())
{
if (!$tableAlias) {
$tableAlias = $table;
}
$this->from[$tableAlias] = array(
'type' => 'INNER',
| php | {
"resource": ""
} |
q17678 | SQLConditionalExpression.queriedTables | train | public function queriedTables()
{
$tables = array();
foreach ($this->from as $key => $tableClause) {
if (is_array($tableClause)) {
$table = '"' . $tableClause['table'] . '"';
} elseif (is_string($tableClause) && preg_match('/JOIN +("[^"]+") +(AS|ON) +/i', $ta... | php | {
"resource": ""
} |
q17679 | SQLConditionalExpression.getJoins | train | public function getJoins(&$parameters = array())
{
if (func_num_args() == 0) {
Deprecation::notice(
'4.0',
'SQLConditionalExpression::getJoins() now may produce parameters which are necessary to
execute this query'
);
}
// Sort the... | php | {
"resource": ""
} |
q17680 | SQLConditionalExpression.setWhere | train | public function setWhere($where)
{
$where = func_num_args() > 1 | php | {
"resource": ""
} |
q17681 | SQLConditionalExpression.filtersOnID | train | public function filtersOnID()
{
$regexp = '/^(.*\.)?("|`)?ID("|`)?\s?(=|IN)/';
foreach ($this->getWhereParameterised($parameters) as | php | {
"resource": ""
} |
q17682 | DefaultCacheFactory.isAPCUSupported | train | protected function isAPCUSupported()
{
static $apcuSupported = null;
if (null === $apcuSupported) {
// Need to check for CLI because Symfony won't: https://github.com/symfony/symfony/pull/25080
$apcuSupported = Director::is_cli() | php | {
"resource": ""
} |
q17683 | NumericField.getFormatter | train | protected function getFormatter()
{
if ($this->getHTML5()) {
// Locale-independent html5 number formatter
$formatter = NumberFormatter::create(
i18n::config()->uninherited('default_locale'),
NumberFormatter::DECIMAL
);
$formatte... | php | {
"resource": ""
} |
q17684 | NumericField.Value | train | public function Value()
{
// Show invalid value back to user in case of error
if ($this->value === null || $this->value === false) {
return $this->originalValue;
}
$formatter = | php | {
"resource": ""
} |
q17685 | NumericField.cast | train | protected function cast($value)
{
if (strlen($value) === 0) {
return null;
| php | {
"resource": ""
} |
q17686 | FormMessage.setMessage | train | public function setMessage(
$message,
$messageType = ValidationResult::TYPE_ERROR,
$messageCast = ValidationResult::CAST_TEXT
) {
if (!in_array($messageCast, [ValidationResult::CAST_TEXT, ValidationResult::CAST_HTML])) {
throw new InvalidArgumentException("Invalid message | php | {
"resource": ""
} |
q17687 | FormMessage.getSchemaMessage | train | public function getSchemaMessage()
{
$message = $this->getMessage();
if (!$message) {
return null;
}
// Form schema messages treat simple strings as plain | php | {
"resource": ""
} |
q17688 | TrustedProxyMiddleware.isTrustedProxy | train | protected function isTrustedProxy(HTTPRequest $request)
{
$trustedIPs = $this->getTrustedProxyIPs();
// Disabled
if (empty($trustedIPs) || $trustedIPs === 'none') {
return false;
}
// Allow all
if ($trustedIPs === '*') {
return true;
... | php | {
"resource": ""
} |
q17689 | TrustedProxyMiddleware.getIPFromHeaderValue | train | protected function getIPFromHeaderValue($headerValue)
{
// Sometimes the IP from a load balancer could be "x.x.x.x, y.y.y.y, z.z.z.z"
// so we need to find the most likely candidate
$ips = preg_split('/\s*,\s*/', $headerValue);
// Prioritise filters
$filters = [
... | php | {
"resource": ""
} |
q17690 | ModuleYamlLoader.normaliseMessages | train | protected function normaliseMessages($messages, $locale)
{
foreach ($messages as $key => $value) {
$messages[$key] = | php | {
"resource": ""
} |
q17691 | ModuleYamlLoader.normaliseMessage | train | protected function normaliseMessage($key, $value, $locale)
{
if (!is_array($value)) {
return $value;
}
if (isset($value['default'])) {
return $value['default'];
| php | {
"resource": ""
} |
q17692 | RelationList.forForeignID | train | public function forForeignID($id)
{
// Turn a 1-element array into a simple value
if (is_array($id) && sizeof($id) == 1) {
$id = reset($id);
}
// Calculate the new filter
$filter = $this->foreignIDFilter($id);
$list = $this->alterDataQuery(function (Data... | php | {
"resource": ""
} |
q17693 | BasicAuthMiddleware.checkMatchingURL | train | protected function checkMatchingURL(HTTPRequest $request)
{
// Null if no permissions enabled
$patterns = $this->getURLPatterns();
if (!$patterns) {
return null;
}
// Filter redirect based on url
$relativeURL = $request->getURL(true);
| php | {
"resource": ""
} |
q17694 | SelectField.getListMap | train | protected function getListMap($source)
{
// Extract source as an array
if ($source instanceof SS_List) {
$source = $source->map();
}
if ($source instanceof Map) {
$source = $source->toArray();
}
| php | {
"resource": ""
} |
q17695 | SelectField.isSelectedValue | train | public function isSelectedValue($dataValue, $userValue)
{
if ($dataValue === $userValue) {
return true;
}
// Allow null to match empty strings
if ($dataValue === '' && $userValue === null) {
return true;
}
// Safety check against casting arra... | php | {
"resource": ""
} |
q17696 | SelectField.castedCopy | train | public function castedCopy($classOrCopy)
{
$field = parent::castedCopy($classOrCopy);
if ($field instanceof SelectField) {
| php | {
"resource": ""
} |
q17697 | ChangePasswordHandler.redirectBackToForm | train | public function redirectBackToForm()
{
// Redirect back to form
| php | {
"resource": ""
} |
q17698 | ChangePasswordHandler.checkPassword | train | protected function checkPassword($member, $password)
{
if (empty($password)) {
return false;
}
// With a valid user and password, check the password is correct
$authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::CHECK_PASSWORD);
for... | php | {
"resource": ""
} |
q17699 | SQLAssignmentRow.addAssignments | train | public function addAssignments(array $assignments)
{
$assignments = $this->normaliseAssignments($assignments);
$this->assignments | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.