Skip to content

Commit

Permalink
MINOR Fixes to method arguments in cms classes for E_STRICT support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Harvey authored and halkyon committed Mar 27, 2012
1 parent 8166c26 commit 0ea9451
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 43 deletions.
6 changes: 3 additions & 3 deletions code/controllers/CMSSettingsController.php
Expand Up @@ -9,7 +9,7 @@ class CMSSettingsController extends CMSMain {
/**
* @return Form
*/
function getEditForm($id = null) {
function getEditForm($id = null, $fields = null) {
$siteConfig = SiteConfig::current_site_config();
$fields = $siteConfig->getCMSFields();

Expand Down Expand Up @@ -54,7 +54,7 @@ function PreviewLink() {
return false;
}

function Breadcrumbs() {
function Breadcrumbs($unlinked = false) {
return new ArrayList(array(
new ArrayData(array(
'Title' => $this->SectionTitle(),
Expand All @@ -63,4 +63,4 @@ function Breadcrumbs() {
));
}

}
}
4 changes: 2 additions & 2 deletions code/controllers/ContentController.php
Expand Up @@ -133,7 +133,7 @@ public function init() {
*
* @return SS_HTTPResponse
*/
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
public function handleRequest(SS_HTTPRequest $request, DataModel $model = null) {
$child = null;
$action = $request->param('Action');
$this->setModel($model);
Expand Down Expand Up @@ -526,4 +526,4 @@ function deleteinstallfiles() {
"Content" => $content,
);
}
}
}
2 changes: 1 addition & 1 deletion code/controllers/RootURLController.php
Expand Up @@ -101,7 +101,7 @@ public static function reset() {
* @param SS_HTTPRequest $request
* @return SS_HTTPResponse
*/
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
public function handleRequest(SS_HTTPRequest $request, DataModel $model = null) {
self::$is_at_root = true;
$this->setModel($model);

Expand Down
8 changes: 4 additions & 4 deletions code/controllers/SilverStripeNavigator.php
Expand Up @@ -193,7 +193,7 @@ function isActive() {
return (Controller::curr() instanceof CMSMain);
}

function canView() {
function canView($member = null) {
// Don't show in CMS
return !(Controller::curr() instanceof CMSMain);
}
Expand Down Expand Up @@ -223,7 +223,7 @@ function getLink() {
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
}

function canView() {
function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
}

Expand Down Expand Up @@ -267,7 +267,7 @@ function getLink() {
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
}

function canView() {
function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->getLivePage());
}

Expand Down Expand Up @@ -309,7 +309,7 @@ function getLink() {
return $this->record->AbsoluteLink() . '?archiveDate=' . $date;
}

function canView() {
function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->isArchived());
}

Expand Down
4 changes: 2 additions & 2 deletions code/model/ErrorPage.php
Expand Up @@ -127,8 +127,8 @@ function requireDefaultRecords() {
}
}

function getCMSFields() {
$fields = parent::getCMSFields();
function getCMSFields($params = null) {
$fields = parent::getCMSFields($params);

$fields->addFieldToTab(
"Root.Main",
Expand Down
4 changes: 2 additions & 2 deletions code/model/RedirectorPage.php
Expand Up @@ -115,7 +115,7 @@ function onBeforeWrite() {
}
}

function getCMSFields() {
function getCMSFields($params = null) {
Requirements::javascript(SAPPHIRE_DIR . "/javascript/RedirectorPage.js");

$fields = parent::getCMSFields();
Expand Down Expand Up @@ -180,4 +180,4 @@ function Content() {
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
"</p>";
}
}
}
2 changes: 1 addition & 1 deletion code/model/SiteConfig.php
Expand Up @@ -41,7 +41,7 @@ public static function disable_theme($theme) {
*
* @return FieldList
*/
function getCMSFields() {
function getCMSFields($params = null) {
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");

$groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray();
Expand Down
5 changes: 1 addition & 4 deletions code/model/SiteTree.php
Expand Up @@ -1013,9 +1013,6 @@ static function prepopuplate_permission_cache($permission = 'CanEditType', $ids,
static function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
if(!$batchCallback) $batchCallback = "SiteTree::can_{$permission}_multiple";

//PHP 5.1 requires an array rather than a string for the call_user_func function
$batchCallback=explode('::', $batchCallback);

if(is_callable($batchCallback)) {
call_user_func($batchCallback, $ids, Member::currentUserID(), false);
} else {
Expand Down Expand Up @@ -1754,7 +1751,7 @@ function VirtualPages() {
*
* @return FieldList The fields to be displayed in the CMS.
*/
function getCMSFields() {
function getCMSFields($params = null) {
require_once("forms/Form.php");
// Status / message
// Create a status message for multiple parents
Expand Down
4 changes: 2 additions & 2 deletions code/model/SiteTreeFileExtension.php
Expand Up @@ -5,7 +5,7 @@
*/
class SiteTreeFileExtension extends DataExtension {

function extraStatics() {
function extraStatics($class = null, $extension = null) {
return array(
'belongs_many_many' => array(
"BackLinkTracking" => "SiteTree",
Expand Down Expand Up @@ -95,4 +95,4 @@ function updateLinks($old, $new) {
if(class_exists('Subsite')) Subsite::disable_subsite_filter(false);
}

}
}
11 changes: 2 additions & 9 deletions code/model/SiteTreeFolderExtension.php
@@ -1,13 +1,6 @@
<?php
class SiteTreeFolderExtension extends DataExtension {

function updateCMSFields(&$fields) {
// TODO commenting out unused files tab till bugs are fixed
// $fields->push(new Tab("UnusedFiles", _t('Folder.UNUSEDFILESTAB', "Unused files"),
// new Folder_UnusedAssetsField($this)
// ));
}


/**
* Looks for files used in system and create where clause which contains all ID's of files.
*
Expand Down Expand Up @@ -52,4 +45,4 @@ public function getUnusedFilesListFilter() {
}
return $where;
}
}
}
8 changes: 4 additions & 4 deletions code/reports/Report.php
Expand Up @@ -378,11 +378,11 @@ function setSortColumnMethod($sortColMethod) {
$this->sortColMethod = $sortColMethod;
}

function limit($limit) {
function limit($limit, $offset = 0) {
$this->limit = $limit;
}

function unlimitedRowCount() {
function unlimitedRowCount($column = null) {
$source = $this->obj->{$this->method}($this->params, null, null);
return $source ? $source->Count() : 0;
}
Expand Down Expand Up @@ -511,8 +511,8 @@ function description() {
return $this->baseReport->description();
}

function canView() {
return $this->baseReport->canView();
function canView($member = null) {
return $this->baseReport->canView($member);
}

}
Expand Down
6 changes: 3 additions & 3 deletions code/widgets/Widget.php
Expand Up @@ -34,7 +34,7 @@ class Widget extends DataObject {
static $cmsTitle = "Name of this widget";
static $description = "Description of what this widget does.";

function getCMSFields() {
function getCMSFields($params = null) {
$fields = new FieldList();
$this->extend('updateCMSFields', $fields);
return $fields;
Expand Down Expand Up @@ -226,7 +226,7 @@ function editablesegment() {
* @subpackage widgets
*/
class Widget_TreeDropdownField extends TreeDropdownField {
function FieldHolder() {}
function Field() {}
function FieldHolder($properties = array()) {}
function Field($properties = array()) {}
}

4 changes: 2 additions & 2 deletions tests/model/SiteTreeBacklinksTest.php
Expand Up @@ -243,15 +243,15 @@ function testLinkTrackingOnExtraContentFields() {
}

class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly {
function extraStatics() {
function extraStatics($class = null, $extension = null) {
return array(
'db' => array(
'ExtraContent' => 'HTMLText',
),
);
}

function updateCMSFields(&$fields) {
function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent"));
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/model/VirtualPageTest.php
Expand Up @@ -607,7 +607,7 @@ class VirtualPageTest_VirtualPageSub extends VirtualPage implements TestOnly {
}

class VirtualPageTest_PageExtension extends DataExtension implements TestOnly {
function extraStatics() {
function extraStatics($class = null, $extension = null) {
return array(
'db' => array(
// These fields are just on an extension to simulate shared properties between Page and VirtualPage.
Expand All @@ -617,4 +617,4 @@ function extraStatics() {
)
);
}
}
}
4 changes: 2 additions & 2 deletions tests/widgets/WidgetAreaEditorTest.php
Expand Up @@ -460,12 +460,12 @@ class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
static $db = array(
'Title' => 'Varchar'
);
public function getCMSFields() {
public function getCMSFields($params = null) {
$fields = new FieldList();
$fields->push(new TextField('Title'));
return $fields;
}
function Title() {
return $this->Title ? $this->Title : self::$title;
}
}
}

0 comments on commit 0ea9451

Please sign in to comment.