Merge pull request #80 from halkyon/e_strict_support

Fixes to method arguments in cms classes for E_STRICT support
This commit is contained in:
Ingo Schommer 2012-03-28 02:48:17 -07:00
commit 651441225f
15 changed files with 33 additions and 43 deletions

View File

@ -9,7 +9,7 @@ class CMSSettingsController extends CMSMain {
/** /**
* @return Form * @return Form
*/ */
function getEditForm($id = null) { function getEditForm($id = null, $fields = null) {
$siteConfig = SiteConfig::current_site_config(); $siteConfig = SiteConfig::current_site_config();
$fields = $siteConfig->getCMSFields(); $fields = $siteConfig->getCMSFields();
@ -54,7 +54,7 @@ class CMSSettingsController extends CMSMain {
return false; return false;
} }
function Breadcrumbs() { function Breadcrumbs($unlinked = false) {
return new ArrayList(array( return new ArrayList(array(
new ArrayData(array( new ArrayData(array(
'Title' => $this->SectionTitle(), 'Title' => $this->SectionTitle(),
@ -63,4 +63,4 @@ class CMSSettingsController extends CMSMain {
)); ));
} }
} }

View File

@ -133,7 +133,7 @@ class ContentController extends Controller {
* *
* @return SS_HTTPResponse * @return SS_HTTPResponse
*/ */
public function handleRequest(SS_HTTPRequest $request, DataModel $model) { public function handleRequest(SS_HTTPRequest $request, DataModel $model = null) {
$child = null; $child = null;
$action = $request->param('Action'); $action = $request->param('Action');
$this->setModel($model); $this->setModel($model);
@ -526,4 +526,4 @@ HTML
"Content" => $content, "Content" => $content,
); );
} }
} }

View File

@ -104,7 +104,7 @@ class RootURLController extends Controller {
* @param SS_HTTPRequest $request * @param SS_HTTPRequest $request
* @return SS_HTTPResponse * @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; self::$is_at_root = true;
$this->setModel($model); $this->setModel($model);

View File

@ -193,7 +193,7 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
return (Controller::curr() instanceof CMSMain); return (Controller::curr() instanceof CMSMain);
} }
function canView() { function canView($member = null) {
// Don't show in CMS // Don't show in CMS
return !(Controller::curr() instanceof CMSMain); return !(Controller::curr() instanceof CMSMain);
} }
@ -223,7 +223,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage'); return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
} }
function canView() { function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->getDraftPage()); return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
} }
@ -267,7 +267,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live'); return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
} }
function canView() { function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->getLivePage()); return ($this->record->hasExtension('Versioned') && $this->getLivePage());
} }
@ -309,7 +309,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
return $this->record->AbsoluteLink() . '?archiveDate=' . $date; return $this->record->AbsoluteLink() . '?archiveDate=' . $date;
} }
function canView() { function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->isArchived()); return ($this->record->hasExtension('Versioned') && $this->isArchived());
} }

View File

@ -127,8 +127,8 @@ class ErrorPage extends Page {
} }
} }
function getCMSFields() { function getCMSFields($params = null) {
$fields = parent::getCMSFields(); $fields = parent::getCMSFields($params);
$fields->addFieldToTab( $fields->addFieldToTab(
"Root.Main", "Root.Main",

View File

@ -115,7 +115,7 @@ class RedirectorPage extends Page {
} }
} }
function getCMSFields() { function getCMSFields($params = null) {
Requirements::javascript(SAPPHIRE_DIR . "/javascript/RedirectorPage.js"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/RedirectorPage.js");
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
@ -180,4 +180,4 @@ class RedirectorPage_Controller extends Page_Controller {
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') . _t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
"</p>"; "</p>";
} }
} }

View File

@ -41,7 +41,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
* *
* @return FieldList * @return FieldList
*/ */
function getCMSFields() { function getCMSFields($params = null) {
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js"); Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
$groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray(); $groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray();

View File

@ -1007,9 +1007,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
static function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) { static function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
if(!$batchCallback) $batchCallback = "SiteTree::can_{$permission}_multiple"; 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)) { if(is_callable($batchCallback)) {
call_user_func($batchCallback, $ids, Member::currentUserID(), false); call_user_func($batchCallback, $ids, Member::currentUserID(), false);
} else { } else {
@ -1748,7 +1745,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* *
* @return FieldList The fields to be displayed in the CMS. * @return FieldList The fields to be displayed in the CMS.
*/ */
function getCMSFields() { function getCMSFields($params = null) {
require_once("forms/Form.php"); require_once("forms/Form.php");
// Status / message // Status / message
// Create a status message for multiple parents // Create a status message for multiple parents

View File

@ -5,7 +5,7 @@
*/ */
class SiteTreeFileExtension extends DataExtension { class SiteTreeFileExtension extends DataExtension {
function extraStatics() { function extraStatics($class = null, $extension = null) {
return array( return array(
'belongs_many_many' => array( 'belongs_many_many' => array(
"BackLinkTracking" => "SiteTree", "BackLinkTracking" => "SiteTree",
@ -95,4 +95,4 @@ class SiteTreeFileExtension extends DataExtension {
if(class_exists('Subsite')) Subsite::disable_subsite_filter(false); if(class_exists('Subsite')) Subsite::disable_subsite_filter(false);
} }
} }

View File

@ -1,13 +1,6 @@
<?php <?php
class SiteTreeFolderExtension extends DataExtension { 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. * Looks for files used in system and create where clause which contains all ID's of files.
* *
@ -52,4 +45,4 @@ class SiteTreeFolderExtension extends DataExtension {
} }
return $where; return $where;
} }
} }

View File

@ -378,11 +378,11 @@ class SS_Report_FakeQuery extends SQLQuery {
$this->sortColMethod = $sortColMethod; $this->sortColMethod = $sortColMethod;
} }
function limit($limit) { function limit($limit, $offset = 0) {
$this->limit = $limit; $this->limit = $limit;
} }
function unlimitedRowCount() { function unlimitedRowCount($column = null) {
$source = $this->obj->{$this->method}($this->params, null, null); $source = $this->obj->{$this->method}($this->params, null, null);
return $source ? $source->Count() : 0; return $source ? $source->Count() : 0;
} }
@ -511,8 +511,8 @@ abstract class SS_ReportWrapper extends SS_Report {
return $this->baseReport->description(); return $this->baseReport->description();
} }
function canView() { function canView($member = null) {
return $this->baseReport->canView(); return $this->baseReport->canView($member);
} }
} }

View File

@ -34,7 +34,7 @@ class Widget extends DataObject {
static $cmsTitle = "Name of this widget"; static $cmsTitle = "Name of this widget";
static $description = "Description of what this widget does."; static $description = "Description of what this widget does.";
function getCMSFields() { function getCMSFields($params = null) {
$fields = new FieldList(); $fields = new FieldList();
$this->extend('updateCMSFields', $fields); $this->extend('updateCMSFields', $fields);
return $fields; return $fields;
@ -226,7 +226,7 @@ class Widget_Controller extends Controller {
* @subpackage widgets * @subpackage widgets
*/ */
class Widget_TreeDropdownField extends TreeDropdownField { class Widget_TreeDropdownField extends TreeDropdownField {
function FieldHolder() {} function FieldHolder($properties = array()) {}
function Field() {} function Field($properties = array()) {}
} }

View File

@ -243,7 +243,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
} }
class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly { class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly {
function extraStatics() { function extraStatics($class = null, $extension = null) {
return array( return array(
'db' => array( 'db' => array(
'ExtraContent' => 'HTMLText', 'ExtraContent' => 'HTMLText',
@ -251,7 +251,7 @@ class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly {
); );
} }
function updateCMSFields(&$fields) { function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent")); $fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent"));
} }
} }

View File

@ -607,7 +607,7 @@ class VirtualPageTest_VirtualPageSub extends VirtualPage implements TestOnly {
} }
class VirtualPageTest_PageExtension extends DataExtension implements TestOnly { class VirtualPageTest_PageExtension extends DataExtension implements TestOnly {
function extraStatics() { function extraStatics($class = null, $extension = null) {
return array( return array(
'db' => array( 'db' => array(
// These fields are just on an extension to simulate shared properties between Page and VirtualPage. // These fields are just on an extension to simulate shared properties between Page and VirtualPage.
@ -617,4 +617,4 @@ class VirtualPageTest_PageExtension extends DataExtension implements TestOnly {
) )
); );
} }
} }

View File

@ -460,7 +460,7 @@ class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
static $db = array( static $db = array(
'Title' => 'Varchar' 'Title' => 'Varchar'
); );
public function getCMSFields() { public function getCMSFields($params = null) {
$fields = new FieldList(); $fields = new FieldList();
$fields->push(new TextField('Title')); $fields->push(new TextField('Title'));
return $fields; return $fields;
@ -468,4 +468,4 @@ class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
function Title() { function Title() {
return $this->Title ? $this->Title : self::$title; return $this->Title ? $this->Title : self::$title;
} }
} }