diff --git a/src/Admin/GridFieldCategorisationConfig.php b/src/Admin/GridFieldCategorisationConfig.php
index 697b0f8..0a1cdf2 100644
--- a/src/Admin/GridFieldCategorisationConfig.php
+++ b/src/Admin/GridFieldCategorisationConfig.php
@@ -36,11 +36,11 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
$columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setFieldFormatting(
- array(
+ [
'BlogPostsCount' => function ($value, CategorisationObject $item) {
return $item->BlogPosts()->Count();
}
- )
+ ]
);
$this->changeColumnOrder();
@@ -57,12 +57,12 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
$columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setDisplayFields(
- array(
+ [
'Title' => 'Title',
'BlogPostsCount' => 'Posts',
'MergeAction' => 'MergeAction',
'Actions' => 'Actions'
- )
+ ]
);
}
}
diff --git a/src/Admin/GridFieldFormAction.php b/src/Admin/GridFieldFormAction.php
index dfcc629..40de0f3 100644
--- a/src/Admin/GridFieldFormAction.php
+++ b/src/Admin/GridFieldFormAction.php
@@ -9,7 +9,7 @@ class GridFieldFormAction extends GridField_FormAction
/**
* @var array
*/
- protected $extraAttributes = array();
+ protected $extraAttributes = [];
/**
* @param array $attributes
diff --git a/src/Admin/GridFieldMergeAction.php b/src/Admin/GridFieldMergeAction.php
index bdf2516..c8b87a5 100644
--- a/src/Admin/GridFieldMergeAction.php
+++ b/src/Admin/GridFieldMergeAction.php
@@ -45,7 +45,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
* @param string $parentMethod
* @param string $childMethod
*/
- public function __construct($records = array(), $parentType, $parentMethod, $childMethod)
+ public function __construct($records = [], $parentType, $parentMethod, $childMethod)
{
$this->records = $records;
$this->parentType = $parentType;
@@ -70,7 +70,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getColumnsHandled($gridField)
{
- return array('MergeAction');
+ return ['MergeAction'];
}
/**
@@ -88,15 +88,15 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
'MergeAction' . $record->ID,
'Move',
'merge',
- array(
+ [
'record' => $record->ID,
'target' => $prefix . '-target-record-' . $record->ID,
- )
+ ]
);
- $action->setExtraAttributes(array(
+ $action->setExtraAttributes([
'data-target' => $prefix . '-target-record-' . $record->ID
- ));
+ ]);
return $dropdown->Field() . $action->Field() . 'move posts to';
}
@@ -109,7 +109,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getColumnAttributes($gridField, $record, $columnName)
{
- return array('class' => 'MergeAction');
+ return ['class' => 'MergeAction'];
}
/**
@@ -117,7 +117,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getColumnMetadata($gridField, $columnName)
{
- return array('title' => 'Move posts to');
+ return ['title' => 'Move posts to'];
}
/**
@@ -125,7 +125,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getActions($gridField)
{
- return array('merge');
+ return ['merge'];
}
/**
diff --git a/src/Forms/GridField/GridFieldAddByDBField.php b/src/Forms/GridField/GridFieldAddByDBField.php
index 4ca5fc1..007589a 100644
--- a/src/Forms/GridField/GridFieldAddByDBField.php
+++ b/src/Forms/GridField/GridFieldAddByDBField.php
@@ -54,9 +54,9 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
*/
public function getActions($gridField)
{
- return array(
+ return [
'add',
- );
+ ];
}
/**
@@ -94,9 +94,9 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
__CLASS__ . '.AddFail',
'Unable to save {class} to the database.',
'Unable to add the DataObject.',
- array(
+ [
'class' => get_class($obj),
- )
+ ]
)
);
}
@@ -107,9 +107,9 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
__CLASS__ . '.PermissionFail',
'You don\'t have permission to create a {class}.',
'Unable to add the DataObject.',
- array(
+ [
'class' => get_class($obj)
- )
+ ]
)
);
}
@@ -198,12 +198,12 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
$addAction->setAttribute('data-icon', 'add');
$addAction->addExtraClass('btn btn-primary');
- $forTemplate = new ArrayData(array());
+ $forTemplate = new ArrayData([]);
$forTemplate->Fields = new ArrayList();
$forTemplate->Fields->push($textField);
$forTemplate->Fields->push($addAction);
- return array($this->targetFragment => $forTemplate->renderWith(self::class));
+ return [$this->targetFragment => $forTemplate->renderWith(self::class)];
}
}
diff --git a/src/Forms/GridField/GridFieldBlogPostState.php b/src/Forms/GridField/GridFieldBlogPostState.php
index 069de60..6913b22 100644
--- a/src/Forms/GridField/GridFieldBlogPostState.php
+++ b/src/Forms/GridField/GridFieldBlogPostState.php
@@ -38,9 +38,9 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
__CLASS__ . '.Draft',
' Saved as Draft on {date}',
'State for when a post is saved.',
- array(
+ [
'date' => $lastEdited->FormatFromSettings(),
- )
+ ]
);
}
@@ -51,22 +51,22 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
if (strtotime($record->PublishDate) > time()) {
return _t(
- __CLASS__ . '.Timer',
+ __CLASS__ . '.Timer',
' Publish at {date}',
'State for when a post is published.',
- array(
+ [
'date' => $publishDate->FormatFromSettings(),
- )
+ ]
) . $modifiedLabel;
}
return _t(
- __CLASS__ . '.Published',
+ __CLASS__ . '.Published',
' Published on {date}',
'State for when a post is published.',
- array(
+ [
'date' => $publishDate->FormatFromSettings(),
- )
+ ]
) . $modifiedLabel;
}
}
@@ -91,12 +91,12 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
$class = 'gridfield-icon published';
}
- return array(
+ return [
'class' => $class,
- );
+ ];
}
}
- return array();
+ return [];
}
}
diff --git a/src/Model/Blog.php b/src/Model/Blog.php
index 98899e9..0905257 100644
--- a/src/Model/Blog.php
+++ b/src/Model/Blog.php
@@ -87,48 +87,48 @@ class Blog extends Page implements PermissionProvider
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'PostsPerPage' => 'Int',
- );
+ ];
/**
* @var array
*/
- private static $has_many = array(
+ private static $has_many = [
'Tags' => BlogTag::class,
'Categories' => BlogCategory::class,
- );
+ ];
/**
* @var array
*/
- private static $many_many = array(
+ private static $many_many = [
'Editors' => Member::class,
'Writers' => Member::class,
'Contributors' => Member::class,
- );
+ ];
/**
* @var array
*/
- private static $allowed_children = array(
+ private static $allowed_children = [
BlogPost::class,
- );
+ ];
/**
* @var array
*/
- private static $extensions = array(
+ private static $extensions = [
BlogFilter::class,
- );
+ ];
/**
* @var array
*/
- private static $defaults = array(
+ private static $defaults = [
'ProvideComments' => false,
'PostsPerPage' => 10
- );
+ ];
/**
* @var string
@@ -182,10 +182,10 @@ class Blog extends Page implements PermissionProvider
*/
$fields->addFieldsToTab(
'Root.Categorisation',
- array(
+ [
$categories,
$tags
- )
+ ]
);
$fields->findOrMakeTab('Root.Categorisation')->addExtraClass('blog-cms-categorisation');
@@ -408,11 +408,11 @@ class Blog extends Page implements PermissionProvider
$fields->addFieldsToTab(
'Root.Users',
- array(
+ [
$editorField,
$writerField,
$contributorField
- )
+ ]
);
return $fields;
@@ -606,8 +606,8 @@ class Blog extends Page implements PermissionProvider
*/
public function providePermissions()
{
- return array(
- Blog::MANAGE_USERS => array(
+ return [
+ Blog::MANAGE_USERS => [
'name' => _t(
__CLASS__ . '.PERMISSION_MANAGE_USERS_DESCRIPTION',
'Manage users for individual blogs'
@@ -618,8 +618,8 @@ class Blog extends Page implements PermissionProvider
),
'category' => _t(__CLASS__ . '.PERMISSIONS_CATEGORY', 'Blog permissions'),
'sort' => 100
- )
- );
+ ]
+ ];
}
/**
@@ -644,7 +644,7 @@ class Blog extends Page implements PermissionProvider
// Must check if the method exists or else an error occurs when changing page type
if ($this->hasMethod('Editors')) {
- foreach (array($this->Editors(), $this->Writers(), $this->Contributors()) as $levels) {
+ foreach ([$this->Editors(), $this->Writers(), $this->Contributors()] as $levels) {
foreach ($levels as $user) {
if (!$user->inGroup($group)) {
$user->Groups()->add($group);
diff --git a/src/Model/BlogCategory.php b/src/Model/BlogCategory.php
index 50e6abc..ead746a 100644
--- a/src/Model/BlogCategory.php
+++ b/src/Model/BlogCategory.php
@@ -40,24 +40,24 @@ class BlogCategory extends DataObject implements CategorisationObject
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'Title' => 'Varchar(255)',
'URLSegment' => 'Varchar(255)'
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class,
- );
+ ];
/**
* @var array
*/
- private static $belongs_many_many = array(
+ private static $belongs_many_many = [
'BlogPosts' => BlogPost::class,
- );
+ ];
/**
* {@inheritdoc}
diff --git a/src/Model/BlogController.php b/src/Model/BlogController.php
index c0ad6f1..b63a887 100644
--- a/src/Model/BlogController.php
+++ b/src/Model/BlogController.php
@@ -14,31 +14,31 @@ class BlogController extends PageController
/**
* @var array
*/
- private static $allowed_actions = array(
+ private static $allowed_actions = [
'archive',
'tag',
'category',
'rss',
'profile'
- );
+ ];
/**
* @var array
*/
- private static $url_handlers = array(
+ private static $url_handlers = [
'tag/$Tag!/$Rss' => 'tag',
'category/$Category!/$Rss' => 'category',
'archive/$Year!/$Month/$Day' => 'archive',
'profile/$URLSegment!' => 'profile'
- );
+ ];
/**
* @var array
*/
- private static $casting = array(
+ private static $casting = [
'MetaTitle' => 'Text',
'FilterDescription' => 'Text'
- );
+ ];
/**
* The current Blog Post DataList query.
@@ -243,7 +243,7 @@ class BlogController extends PageController
$tag = $this->request->param('Tag');
if ($tag) {
return $dataRecord->Tags()
- ->filter('URLSegment', array($tag, rawurlencode($tag)))
+ ->filter('URLSegment', [$tag, rawurlencode($tag)])
->first();
}
return null;
@@ -287,7 +287,7 @@ class BlogController extends PageController
$category = $this->request->param('Category');
if ($category) {
return $dataRecord->Categories()
- ->filter('URLSegment', array($category, rawurlencode($category)))
+ ->filter('URLSegment', [$category, rawurlencode($category)])
->first();
}
return null;
@@ -319,7 +319,7 @@ class BlogController extends PageController
*/
public function getFilterDescription()
{
- $items = array();
+ $items = [];
$list = $this->PaginatedList();
$currentPage = $list->CurrentPage();
@@ -329,9 +329,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_PAGE',
'Page {page}',
null,
- array(
+ [
'page' => $currentPage
- )
+ ]
);
}
@@ -340,9 +340,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_AUTHOR',
'By {author}',
null,
- array(
+ [
'author' => $author->Title
- )
+ ]
);
}
@@ -351,9 +351,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_TAG',
'Tagged with {tag}',
null,
- array(
+ [
'tag' => $tag->Title
- )
+ ]
);
}
@@ -362,9 +362,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_CATEGORY',
'In category {category}',
null,
- array(
+ [
'category' => $category->Title
- )
+ ]
);
}
@@ -381,9 +381,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_DATE',
'In {date}',
null,
- array(
+ [
'date' => $date,
- )
+ ]
);
}
diff --git a/src/Model/BlogFilter.php b/src/Model/BlogFilter.php
index 5c78448..02238f1 100644
--- a/src/Model/BlogFilter.php
+++ b/src/Model/BlogFilter.php
@@ -96,10 +96,10 @@ class BlogFilter extends Lumberjack
$excluded = $this->owner->getExcludedSiteTreeClassNames();
if (!empty($excluded)) {
- $pages = BlogPost::get()->filter(array(
+ $pages = BlogPost::get()->filter([
'ParentID' => $this->owner->ID,
'ClassName' => $excluded
- ));
+ ]);
$gridField = BlogFilterGridField::create(
'ChildPages',
diff --git a/src/Model/BlogMemberExtension.php b/src/Model/BlogMemberExtension.php
index 9b81fc6..ff0c5b9 100644
--- a/src/Model/BlogMemberExtension.php
+++ b/src/Model/BlogMemberExtension.php
@@ -23,24 +23,24 @@ class BlogMemberExtension extends DataExtension
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'URLSegment' => 'Varchar',
'BlogProfileSummary' => 'Text'
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'BlogProfileImage' => Image::class
- );
+ ];
/**
* @var array
*/
- private static $belongs_many_many = array(
+ private static $belongs_many_many = [
'BlogPosts' => BlogPost::class
- );
+ ];
/**
* {@inheritdoc}
diff --git a/src/Model/BlogObject.php b/src/Model/BlogObject.php
index 54e4294..db5fc73 100644
--- a/src/Model/BlogObject.php
+++ b/src/Model/BlogObject.php
@@ -108,7 +108,7 @@ trait BlogObject
/**
* {@inheritdoc}
*/
- public function canCreate($member = null, $context = array())
+ public function canCreate($member = null, $context = [])
{
$extended = $this->extendedCan(__FUNCTION__, $member);
diff --git a/src/Model/BlogPost.php b/src/Model/BlogPost.php
index 2556df7..c413dee 100644
--- a/src/Model/BlogPost.php
+++ b/src/Model/BlogPost.php
@@ -58,77 +58,77 @@ class BlogPost extends Page
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'PublishDate' => 'Datetime',
'AuthorNames' => 'Varchar(1024)',
'Summary' => 'HTMLText'
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'FeaturedImage' => Image::class
- );
+ ];
/**
* @var array
*/
- private static $owns = array(
+ private static $owns = [
'FeaturedImage',
- );
+ ];
/**
* @var array
*/
- private static $many_many = array(
+ private static $many_many = [
'Categories' => BlogCategory::class,
'Tags' => BlogTag::class,
'Authors' => Member::class
- );
+ ];
/**
* @var array
*/
- private static $defaults = array(
+ private static $defaults = [
'ShowInMenus' => false,
'InheritSideBar' => true,
'ProvideComments' => true
- );
+ ];
/**
* @var array
*/
- private static $extensions = array(
+ private static $extensions = [
BlogPostFilter::class
- );
+ ];
/**
* @var array
*/
- private static $searchable_fields = array(
+ private static $searchable_fields = [
'Title'
- );
+ ];
/**
* @var array
*/
- private static $summary_fields = array(
+ private static $summary_fields = [
'Title'
- );
+ ];
/**
* @var array
*/
- private static $casting = array(
+ private static $casting = [
'Excerpt' => 'HTMLText',
'Date' => 'DBDatetime'
- );
+ ];
/**
* @var array
*/
- private static $allowed_children = array();
+ private static $allowed_children = [];
/**
* The default sorting lists BlogPosts with an empty PublishDate at the top.
@@ -215,7 +215,7 @@ class BlogPost extends Page
$this->beforeUpdateCMSFields(function ($fields) {
$uploadField = UploadField::create('FeaturedImage', _t(__CLASS__ . '.FeaturedImage', 'Featured Image'));
- $uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
+ $uploadField->getValidator()->setAllowedExtensions(['jpg', 'jpeg', 'png', 'gif']);
/**
* @var FieldList $fields
@@ -232,9 +232,9 @@ class BlogPost extends Page
$summaryHolder = ToggleCompositeField::create(
'CustomSummary',
_t(__CLASS__ . '.CUSTOMSUMMARY', 'Add A Custom Summary'),
- array(
+ [
$summary,
- )
+ ]
);
$summaryHolder->setHeadingLevel(4);
$summaryHolder->addExtraClass('custom-summary');
@@ -244,10 +244,10 @@ class BlogPost extends Page
$urlSegment = $fields->dataFieldByName('URLSegment');
$urlSegment->setURLPrefix($this->Parent()->RelativeLink());
- $fields->removeFieldsFromTab('Root.Main', array(
+ $fields->removeFieldsFromTab('Root.Main', [
'MenuTitle',
'URLSegment',
- ));
+ ]);
$authorField = ListboxField::create(
'Authors',
@@ -681,9 +681,9 @@ class BlogPost extends Page
$items = new ArrayList();
foreach ($this->Authors() as $author) {
// Add link for each author
- $author = $author->customise(array(
+ $author = $author->customise([
'URL' => $parent->ProfileLink($author->URLSegment),
- ));
+ ]);
$items->push($author);
}
@@ -702,9 +702,9 @@ class BlogPost extends Page
$authors = array_filter(preg_split('/\s*,\s*/', $this->AuthorNames));
foreach ($authors as $author) {
- $item = new ArrayData(array(
+ $item = new ArrayData([
'Name' => $author,
- ));
+ ]);
$items->push($item);
}
diff --git a/src/Model/BlogPostNotifications.php b/src/Model/BlogPostNotifications.php
index 1b6b6fb..e6fdbd9 100644
--- a/src/Model/BlogPostNotifications.php
+++ b/src/Model/BlogPostNotifications.php
@@ -30,7 +30,7 @@ class BlogPostNotifications extends DataExtension
// If comment is spam and notification are set to not send on spam clear the recipient list
if (Config::inst()->get(__CLASS__, 'notification_on_spam') == false && $comment->IsSpam) {
- $list = array();
+ $list = [];
}
}
diff --git a/src/Model/BlogTag.php b/src/Model/BlogTag.php
index 2163c97..bc6b351 100644
--- a/src/Model/BlogTag.php
+++ b/src/Model/BlogTag.php
@@ -40,24 +40,24 @@ class BlogTag extends DataObject implements CategorisationObject
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'Title' => 'Varchar(255)',
'URLSegment' => 'Varchar(255)'
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class
- );
+ ];
/**
* @var array
*/
- private static $belongs_many_many = array(
+ private static $belongs_many_many = [
'BlogPosts' => BlogPost::class
- );
+ ];
/**
* {@inheritdoc}
diff --git a/src/Widgets/BlogArchiveWidget.php b/src/Widgets/BlogArchiveWidget.php
index ee53d07..3223c5b 100644
--- a/src/Widgets/BlogArchiveWidget.php
+++ b/src/Widgets/BlogArchiveWidget.php
@@ -38,24 +38,24 @@ class BlogArchiveWidget extends Widget
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'NumberToDisplay' => 'Int',
'ArchiveType' => 'Enum(\'Monthly,Yearly\', \'Monthly\')',
- );
+ ];
/**
* @var array
*/
- private static $defaults = array(
+ private static $defaults = [
'NumberOfMonths' => 12,
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class,
- );
+ ];
/**
* {@inheritdoc}
@@ -77,7 +77,7 @@ class BlogArchiveWidget extends Widget
/**
* @var FieldList $fields
*/
- $fields->merge(array(
+ $fields->merge([
DropdownField::create(
'BlogID',
_t(__CLASS__ . '.Blog', 'Blog'),
@@ -85,7 +85,7 @@ class BlogArchiveWidget extends Widget
),
DropdownField::create('ArchiveType', _t(__CLASS__ . '.ArchiveType', 'ArchiveType'), $type),
NumericField::create('NumberToDisplay', _t(__CLASS__ . '.NumberToDisplay', 'No. to Display'))
- ));
+ ]);
});
return parent::getCMSFields();
@@ -132,10 +132,10 @@ class BlogArchiveWidget extends Widget
$title = $date->FormatI18N("%B %Y");
}
- $archive->push(new ArrayData(array(
+ $archive->push(new ArrayData([
'Title' => $title,
'Link' => Controller::join_links($this->Blog()->Link('archive'), $year, $month)
- )));
+ ]));
}
}
diff --git a/src/Widgets/BlogCategoriesWidget.php b/src/Widgets/BlogCategoriesWidget.php
index 14a9d86..92fe53a 100644
--- a/src/Widgets/BlogCategoriesWidget.php
+++ b/src/Widgets/BlogCategoriesWidget.php
@@ -37,18 +37,18 @@ class BlogCategoriesWidget extends Widget
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'Limit' => 'Int',
'Order' => 'Varchar',
'Direction' => 'Varchar',
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class,
- );
+ ];
/**
* {@inheritdoc}
@@ -78,7 +78,7 @@ class BlogCategoriesWidget extends Widget
$fields[] = DropdownField::create(
'Order',
_t(__CLASS__ . '.Sort', 'Sort'),
- array('Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated')
+ ['Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated']
)
->setDescription(
_t(__CLASS__ . '.Sort_Description', 'Change the order of categories shown by this widget.')
@@ -87,7 +87,7 @@ class BlogCategoriesWidget extends Widget
$fields[] = DropdownField::create(
'Direction',
_t(__CLASS__ . '.Direction', 'Direction'),
- array('ASC' => 'Ascending', 'DESC' => 'Descending')
+ ['ASC' => 'Ascending', 'DESC' => 'Descending']
)
->setDescription(
_t(
@@ -108,7 +108,7 @@ class BlogCategoriesWidget extends Widget
$blog = $this->Blog();
if (!$blog) {
- return array();
+ return [];
}
$query = $blog->Categories();
diff --git a/src/Widgets/BlogRecentPostsWidget.php b/src/Widgets/BlogRecentPostsWidget.php
index cf2a3e2..7f0825c 100644
--- a/src/Widgets/BlogRecentPostsWidget.php
+++ b/src/Widgets/BlogRecentPostsWidget.php
@@ -36,16 +36,16 @@ class BlogRecentPostsWidget extends Widget
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'NumberOfPosts' => 'Int',
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class,
- );
+ ];
/**
* {@inheritdoc}
@@ -56,10 +56,10 @@ class BlogRecentPostsWidget extends Widget
/**
* @var FieldList $fields
*/
- $fields->merge(array(
+ $fields->merge([
DropdownField::create('BlogID', _t(__CLASS__ . '.Blog', 'Blog'), Blog::get()->map()),
NumericField::create('NumberOfPosts', _t(__CLASS__ . '.NumberOfPosts', 'Number of Posts'))
- ));
+ ]);
});
return parent::getCMSFields();
@@ -78,6 +78,6 @@ class BlogRecentPostsWidget extends Widget
->limit($this->NumberOfPosts);
}
- return array();
+ return [];
}
}
diff --git a/src/Widgets/BlogTagsCloudWidget.php b/src/Widgets/BlogTagsCloudWidget.php
index 907ce2a..20806e5 100644
--- a/src/Widgets/BlogTagsCloudWidget.php
+++ b/src/Widgets/BlogTagsCloudWidget.php
@@ -37,14 +37,14 @@ class BlogTagsCloudWidget extends Widget
/**
* @var array
*/
- private static $db = array();
+ private static $db = [];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class,
- );
+ ];
/**
* {@inheritdoc}
@@ -115,6 +115,6 @@ class BlogTagsCloudWidget extends Widget
return $tags;
}
- return array();
+ return [];
}
}
diff --git a/src/Widgets/BlogTagsWidget.php b/src/Widgets/BlogTagsWidget.php
index e7fc743..d1daa20 100644
--- a/src/Widgets/BlogTagsWidget.php
+++ b/src/Widgets/BlogTagsWidget.php
@@ -36,18 +36,18 @@ class BlogTagsWidget extends Widget
/**
* @var array
*/
- private static $db = array(
+ private static $db = [
'Limit' => 'Int',
'Order' => 'Varchar',
'Direction' => 'Varchar',
- );
+ ];
/**
* @var array
*/
- private static $has_one = array(
+ private static $has_one = [
'Blog' => Blog::class
- );
+ ];
/**
* {@inheritdoc}
@@ -77,7 +77,7 @@ class BlogTagsWidget extends Widget
$fields[] = DropdownField::create(
'Order',
_t(__CLASS__ . '.Sort', 'Sort'),
- array('Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated')
+ ['Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated']
)
->setDescription(
_t(__CLASS__ . '.Sort_Description', 'Change the order of tags shown by this widget.')
@@ -86,7 +86,7 @@ class BlogTagsWidget extends Widget
$fields[] = DropdownField::create(
'Direction',
_t(__CLASS__ . '.Direction', 'Direction'),
- array('ASC' => 'Ascending', 'DESC' => 'Descending')
+ ['ASC' => 'Ascending', 'DESC' => 'Descending']
)
->setDescription(
_t(
@@ -107,7 +107,7 @@ class BlogTagsWidget extends Widget
$blog = $this->Blog();
if (!$blog) {
- return array();
+ return [];
}
$query = $blog->Tags();
diff --git a/tests/BlogPostNotificationsTest.php b/tests/BlogPostNotificationsTest.php
index 39d4f2a..22559c3 100644
--- a/tests/BlogPostNotificationsTest.php
+++ b/tests/BlogPostNotificationsTest.php
@@ -27,14 +27,14 @@ class BlogPostNotificationsTest extends SapphireTest
$comment
)->toArray();
- $segments = array();
+ $segments = [];
foreach ($recipients as $recipient) {
array_push($segments, $recipient->URLSegment);
}
sort($segments);
$this->assertEquals(
- array('blog-contributor', 'blog-editor', 'blog-writer'),
+ ['blog-contributor', 'blog-editor', 'blog-writer'],
$segments
);
}
diff --git a/tests/BlogPostTest.php b/tests/BlogPostTest.php
index 09bacba..6019894 100644
--- a/tests/BlogPostTest.php
+++ b/tests/BlogPostTest.php
@@ -43,33 +43,33 @@ class BlogPostTest extends SapphireTest
{
$someFutureDate = '2013-10-10 20:00:00';
$somePastDate = '2009-10-10 20:00:00';
- return array(
+ return [
// Check this post given the date has passed
- array($someFutureDate, 'Editor', 'PostA', true),
- array($someFutureDate, 'Contributor', 'PostA', true),
- array($someFutureDate, 'BlogEditor', 'PostA', true),
- array($someFutureDate, 'Writer', 'PostA', true),
+ [$someFutureDate, 'Editor', 'PostA', true],
+ [$someFutureDate, 'Contributor', 'PostA', true],
+ [$someFutureDate, 'BlogEditor', 'PostA', true],
+ [$someFutureDate, 'Writer', 'PostA', true],
// Check unpublished pages
- array($somePastDate, 'Editor', 'PostA', true),
- array($somePastDate, 'Contributor', 'PostA', true),
- array($somePastDate, 'BlogEditor', 'PostA', true),
- array($somePastDate, 'Writer', 'PostA', true),
+ [$somePastDate, 'Editor', 'PostA', true],
+ [$somePastDate, 'Contributor', 'PostA', true],
+ [$somePastDate, 'BlogEditor', 'PostA', true],
+ [$somePastDate, 'Writer', 'PostA', true],
// Test a page that was authored by another user
// Check this post given the date has passed
- array($someFutureDate, 'Editor', 'FirstBlogPost', true),
- array($someFutureDate, 'Contributor', 'FirstBlogPost', true),
- array($someFutureDate, 'BlogEditor', 'FirstBlogPost', true),
- array($someFutureDate, 'Writer', 'FirstBlogPost', true),
+ [$someFutureDate, 'Editor', 'FirstBlogPost', true],
+ [$someFutureDate, 'Contributor', 'FirstBlogPost', true],
+ [$someFutureDate, 'BlogEditor', 'FirstBlogPost', true],
+ [$someFutureDate, 'Writer', 'FirstBlogPost', true],
// Check future pages - non-editors shouldn't be able to see this
- array($somePastDate, 'Editor', 'FirstBlogPost', true),
- array($somePastDate, 'Contributor', 'FirstBlogPost', false),
- array($somePastDate, 'BlogEditor', 'FirstBlogPost', false),
- array($somePastDate, 'Writer', 'FirstBlogPost', false),
- );
+ [$somePastDate, 'Editor', 'FirstBlogPost', true],
+ [$somePastDate, 'Contributor', 'FirstBlogPost', false],
+ [$somePastDate, 'BlogEditor', 'FirstBlogPost', false],
+ [$somePastDate, 'Writer', 'FirstBlogPost', false],
+ ];
}
public function testCandidateAuthors()
diff --git a/tests/BlogTagsCloudWidgetTest.php b/tests/BlogTagsCloudWidgetTest.php
index 315706e..6a4290f 100644
--- a/tests/BlogTagsCloudWidgetTest.php
+++ b/tests/BlogTagsCloudWidgetTest.php
@@ -23,12 +23,12 @@ class BlogTagsCloudWidgetTest extends SapphireTest
$widget = new BlogTagsCloudWidget();
$fields = $widget->getCMSFields();
- $names = array();
+ $names = [];
foreach ($fields as $field) {
array_push($names, $field->getName());
}
- $expected = array('Title', 'Enabled', 'BlogID');
+ $expected = ['Title', 'Enabled', 'BlogID'];
$this->assertEquals($expected, $names);
}
diff --git a/tests/BlogTest.php b/tests/BlogTest.php
index 5f1ed76..6e0ef7a 100755
--- a/tests/BlogTest.php
+++ b/tests/BlogTest.php
@@ -325,7 +325,7 @@ class BlogTest extends SapphireTest
// Request first tag
$this->requestURL($controller, 'first-post/tag/first-tag');
$this->assertIDsEquals(
- array($firstPostID, $firstFuturePostID, $secondFuturePostID),
+ [$firstPostID, $firstFuturePostID, $secondFuturePostID],
$controller->PaginatedList()
);
}
@@ -343,7 +343,7 @@ class BlogTest extends SapphireTest
// Request 2013 posts
$this->requestURL($controller, 'first-post/archive/2013');
$this->assertIDsEquals(
- array($firstPostID, $secondPostID, $secondFuturePostID),
+ [$firstPostID, $secondPostID, $secondFuturePostID],
$controller->PaginatedList()
);
}