mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1828 from robbieaverill/pulls/4.0/remove-create-function
Remove create_function implementations, replace with closures
This commit is contained in:
commit
b1c194467d
@ -1984,7 +1984,9 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
|
||||
// This filter ensures that the ParentID dropdown selection does not show this node,
|
||||
// or its descendents, as this causes vanishing bugs
|
||||
$parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
|
||||
$parentIDField->setFilterFunction(function ($node) {
|
||||
return $node->ID != $this->ID;
|
||||
});
|
||||
$parentTypeSelector->addExtraClass('parentTypeSelector');
|
||||
|
||||
$tabBehaviour->setTitle(_t(__CLASS__.'.TABBEHAVIOUR', "Behavior"));
|
||||
|
@ -210,7 +210,7 @@ class VirtualPage extends Page
|
||||
"SilverStripe\\CMS\\Model\\SiteTree"
|
||||
);
|
||||
// filter doesn't let you select children of virtual pages as as source page
|
||||
//$copyContentFromField->setFilterFunction(create_function('$item', 'return !($item instanceof VirtualPage);'));
|
||||
//$copyContentFromField->setFilterFunction(function ($item) { return !($item instanceof VirtualPage); });
|
||||
|
||||
// Setup virtual fields
|
||||
if ($virtualFields = $this->getVirtualFields()) {
|
||||
|
@ -148,12 +148,12 @@ class SearchForm extends Form
|
||||
|
||||
$keywords = $request->requestVar('Search');
|
||||
|
||||
$andProcessor = create_function('$matches', '
|
||||
return " +" . $matches[2] . " +" . $matches[4] . " ";
|
||||
');
|
||||
$notProcessor = create_function('$matches', '
|
||||
return " -" . $matches[3];
|
||||
');
|
||||
$andProcessor = function ($matches) {
|
||||
return ' +' . $matches[2] . ' +' . $matches[4] . ' ';
|
||||
};
|
||||
$notProcessor = function ($matches) {
|
||||
return ' -' . $matches[3];
|
||||
};
|
||||
|
||||
$keywords = preg_replace_callback('/()("[^()"]+")( and )("[^"()]+")()/i', $andProcessor, $keywords);
|
||||
$keywords = preg_replace_callback('/(^| )([^() ]+)( and )([^ ()]+)( |$)/i', $andProcessor, $keywords);
|
||||
|
Loading…
Reference in New Issue
Block a user