Updating code style

This commit is contained in:
Daniel Hensby 2018-05-02 11:54:59 +01:00
parent ed17eb2bd8
commit a393de8d8d
No known key found for this signature in database
GPG Key ID: D8DEBC4C8E7BC8B9

View File

@ -50,17 +50,19 @@ class ContentController extends Controller
protected $dataRecord;
private static $extensions = array('SilverStripe\\CMS\\Controllers\\OldPageRedirector');
private static $extensions = [
'SilverStripe\\CMS\\Controllers\\OldPageRedirector',
];
private static $allowed_actions = array(
private static $allowed_actions = [
'successfullyinstalled',
'deleteinstallfiles', // secured through custom code
'LoginForm'
);
'LoginForm',
];
private static $casting = array(
private static $casting = [
'SilverStripeNavigator' => 'HTMLFragment',
);
];
/**
* The ContentController will take the URLSegment parameter from the URL and use that to look
@ -192,10 +194,10 @@ class ContentController extends Controller
Translatable::disable_locale_filter();
}
// look for a page with this URLSegment
$child = SiteTree::get()->filter(array(
$child = SiteTree::get()->filter([
'ParentID' => $this->ID,
'URLSegment' => rawurlencode($action)
))->first();
'URLSegment' => rawurlencode($action),
])->first();
if (class_exists('Translatable')) {
Translatable::enable_locale_filter();
}
@ -273,13 +275,13 @@ class ContentController extends Controller
public function getMenu($level = 1)
{
if ($level == 1) {
$result = SiteTree::get()->filter(array(
$result = SiteTree::get()->filter([
"ShowInMenus" => 1,
"ParentID" => 0
));
"ParentID" => 0,
]);
} else {
$parent = $this->data();
$stack = array($parent);
$stack = [$parent];
if ($parent) {
while (($parent = $parent->Parent()) && $parent->exists()) {
@ -292,7 +294,7 @@ class ContentController extends Controller
}
}
$visible = array();
$visible = [];
// Remove all entries the can not be viewed by the current user
// We might need to create a show in menu permission
@ -483,19 +485,19 @@ HTML;
}
global $project;
$data = new ArrayData(array(
$data = new ArrayData([
'Project' => Convert::raw2xml($project),
'Username' => Convert::raw2xml($this->getRequest()->getSession()->get('username')),
'Password' => Convert::raw2xml($this->getRequest()->getSession()->get('password')),
));
]);
return array(
return [
"Title" => _t("SilverStripe\\CMS\\Controllers\\ContentController.INSTALL_SUCCESS", "Installation Successful!"),
"Content" => $data->renderWith([
'type' => 'Includes',
'Install_successfullyinstalled'
'Install_successfullyinstalled',
]),
);
];
}
public function deleteinstallfiles()
@ -510,12 +512,12 @@ HTML;
// We can't delete index.php as it might be necessary for URL routing without mod_rewrite.
// There's no safe way to detect usage of mod_rewrite across webservers,
// so we have to assume the file is required.
$installfiles = array(
$installfiles = [
'install.php',
'config-form.css',
'config-form.html',
'index.html'
);
'index.html',
];
$unsuccessful = new ArrayList();
foreach ($installfiles as $installfile) {
@ -524,23 +526,23 @@ HTML;
}
if (file_exists(BASE_PATH . '/' . $installfile)) {
$unsuccessful->push(new ArrayData(array('File' => $installfile)));
$unsuccessful->push(new ArrayData(['File' => $installfile]));
}
}
$data = new ArrayData(array(
$data = new ArrayData([
'Username' => Convert::raw2xml($this->getRequest()->getSession()->get('username')),
'Password' => Convert::raw2xml($this->getRequest()->getSession()->get('password')),
'UnsuccessfulFiles' => $unsuccessful
));
'UnsuccessfulFiles' => $unsuccessful,
]);
$content->setValue($data->renderWith([
'type' => 'Includes',
'Install_deleteinstallfiles'
'Install_deleteinstallfiles',
]));
return array(
return [
"Title" => $title,
"Content" => $content,
);
];
}
}