Merge pull request #206 from chillu/pulls/public-function

Method visibility according to coding conventions
This commit is contained in:
Simon Welsh 2012-09-20 01:54:45 -07:00
commit 90a154c888
62 changed files with 550 additions and 550 deletions

View File

@ -6,17 +6,17 @@
* @subpackage batchaction
*/
class CMSBatchAction_Publish extends CMSBatchAction {
function getActionTitle() {
public function getActionTitle() {
return _t('CMSBatchActions.PUBLISH_PAGES', 'Publish');
}
function run(SS_List $pages) {
public function run(SS_List $pages) {
return $this->batchaction($pages, 'doPublish',
_t('CMSBatchActions.PUBLISHED_PAGES', 'Published %d pages, %d failures')
);
}
function applicablePages($ids) {
public function applicablePages($ids) {
return $this->applicablePagesHelper($ids, 'canPublish', true, false);
}
}
@ -28,11 +28,11 @@ class CMSBatchAction_Publish extends CMSBatchAction {
* @subpackage batchaction
*/
class CMSBatchAction_Unpublish extends CMSBatchAction {
function getActionTitle() {
public function getActionTitle() {
return _t('CMSBatchActions.UNPUBLISH_PAGES', 'Un-publish');
}
function run(SS_List $pages) {
public function run(SS_List $pages) {
return $this->batchaction($pages, 'doUnpublish',
_t('CMSBatchActions.UNPUBLISHED_PAGES', 'Un-published %d pages')
);
@ -46,11 +46,11 @@ class CMSBatchAction_Unpublish extends CMSBatchAction {
* @subpackage batchaction
*/
class CMSBatchAction_Delete extends CMSBatchAction {
function getActionTitle() {
public function getActionTitle() {
return _t('CMSBatchActions.DELETE_DRAFT_PAGES', 'Delete from draft site');
}
function run(SS_List $pages) {
public function run(SS_List $pages) {
$status = array(
'modified'=>array(),
'deleted'=>array(),
@ -81,7 +81,7 @@ class CMSBatchAction_Delete extends CMSBatchAction {
return $this->response(_t('CMSBatchActions.DELETED_DRAFT_PAGES', 'Deleted %d pages from draft site, %d failures'), $status);
}
function applicablePages($ids) {
public function applicablePages($ids) {
return $this->applicablePagesHelper($ids, 'canDelete', true, false);
}
}
@ -93,12 +93,12 @@ class CMSBatchAction_Delete extends CMSBatchAction {
* @subpackage batchaction
*/
class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
function getActionTitle() {
public function getActionTitle() {
return _t('CMSBatchActions.DELETE_PAGES', 'Delete from published site');
}
function run(SS_List $pages) {
public function run(SS_List $pages) {
$status = array(
'modified'=>array(),
'deleted'=>array()
@ -126,7 +126,7 @@ class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
return $this->response(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from published site, %d failures'), $status);
}
function applicablePages($ids) {
public function applicablePages($ids) {
return $this->applicablePagesHelper($ids, 'canDelete', false, true);
}
}

View File

@ -484,7 +484,7 @@ JS
}
}
function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {
public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {
if (!$childrenMethod) $childrenMethod = 'ChildFolders';
return parent::getSiteTreeFor($className, $rootID, $childrenMethod, $numChildrenMethod, $filterFunction, $minNodeCount);
}
@ -638,7 +638,7 @@ JS
return $items;
}
function providePermissions() {
public function providePermissions() {
$title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
return array(
"CMS_ACCESS_AssetAdmin" => array(

View File

@ -81,7 +81,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
}
function index($request) {
public function index($request) {
// In case we're not showing a specific record, explicitly remove any session state,
// to avoid it being highlighted in the tree, and causing an edit form to show.
if(!$request->param('Action')) $this->setCurrentPageId(null);
@ -104,7 +104,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
*
* @return boolean
*/
function ShowSwitchView() {
public function ShowSwitchView() {
return true;
}
@ -112,7 +112,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able
* to switch view also for archived versions.
*/
function SwitchView($page = null) {
public function SwitchView($page = null) {
if(!$page) {
$page = $this->currentPage();
}
@ -202,7 +202,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $link;
}
function LinkPageAdd($extraArguments = null) {
public function LinkPageAdd($extraArguments = null) {
$link = singleton("CMSPageAddController")->Link();
$this->extend('updateLinkPageAdd', $link);
if($extraArguments) $link = Controller::join_links ($link, $extraArguments);
@ -245,7 +245,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $html;
}
function SearchForm() {
public function SearchForm() {
// get all page types in a dropdown-compatible format
$pageTypeClasses = SiteTree::page_type_classes();
$pageTypes = array();
@ -313,7 +313,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $form;
}
function doSearch($data, $form) {
public function doSearch($data, $form) {
return $this->getsubtree($this->request);
}
@ -993,13 +993,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $this->getResponseNegotiator()->respond($this->request);
}
function publish($data, $form) {
public function publish($data, $form) {
$data['publish'] = '1';
return $this->save($data, $form);
}
function unpublish($data, $form) {
public function unpublish($data, $form) {
$className = $this->stat('tree_class');
$record = DataObject::get_by_id($className, $data['ID']);
@ -1019,7 +1019,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
/**
* @return array
*/
function rollback() {
public function rollback() {
return $this->doRollback(array(
'ID' => $this->currentPageID(),
'Version' => $this->request->param('VersionID')
@ -1034,7 +1034,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
*
* @return html
*/
function doRollback($data, $form) {
public function doRollback($data, $form) {
$this->extend('onBeforeRollback', $data['ID']);
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
@ -1074,11 +1074,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
/**
* Batch Actions Handler
*/
function batchactions() {
public function batchactions() {
return new CMSBatchActionHandler($this, 'batchactions');
}
function BatchActionParameters() {
public function BatchActionParameters() {
$batchActions = CMSBatchActionHandler::$batch_actions;
$forms = array();
@ -1101,11 +1101,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
/**
* Returns a list of batch actions
*/
function BatchActionList() {
public function BatchActionList() {
return $this->batchactions()->batchActionList();
}
function buildbrokenlinks($request) {
public function buildbrokenlinks($request) {
// Protect against CSRF on destructive action
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
@ -1141,7 +1141,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
}
function publishall($request) {
public function publishall($request) {
if(!Permission::check('ADMIN')) return Security::permissionFailure($this);
increase_time_limit_to();
@ -1198,7 +1198,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
/**
* Restore a completely deleted page from the SiteTree_versions table.
*/
function restore($data, $form) {
public function restore($data, $form) {
if(!isset($data['ID']) || !is_numeric($data['ID'])) {
return new SS_HTTPResponse("Please pass an ID in the form content", 400);
}
@ -1221,7 +1221,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $this->getResponseNegotiator()->respond($this->request);
}
function duplicate($request) {
public function duplicate($request) {
// Protect against CSRF on destructive action
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
@ -1247,7 +1247,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
}
function duplicatewithchildren($request) {
public function duplicatewithchildren($request) {
// Protect against CSRF on destructive action
if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400);
@ -1288,7 +1288,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
);
}
function providePermissions() {
public function providePermissions() {
$title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController'));
return array(
"CMS_ACCESS_CMSMain" => array(

View File

@ -15,7 +15,7 @@ class CMSPageAddController extends CMSPageEditController {
/**
* @return Form
*/
function AddForm() {
public function AddForm() {
$record = $this->currentPage();
$pageTypes = array();

View File

@ -39,7 +39,7 @@ class CMSPageHistoryController extends CMSMain {
/**
* @return array
*/
function show($request) {
public function show($request) {
$form = $this->ShowVersionForm($request->param('VersionID'));
$negotiator = $this->getResponseNegotiator();
@ -57,7 +57,7 @@ class CMSPageHistoryController extends CMSMain {
/**
* @return array
*/
function compare($request) {
public function compare($request) {
$form = $this->CompareVersionsForm(
$request->param('VersionID'),
$request->param('OtherVersionID')
@ -88,7 +88,7 @@ class CMSPageHistoryController extends CMSMain {
*
* @return Form
*/
function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null) {
public function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null) {
if(!$id) $id = $this->currentPageID();
$record = $this->getRecord($id, $versionID);
@ -178,7 +178,7 @@ class CMSPageHistoryController extends CMSMain {
*
* @return Form
*/
function VersionsForm() {
public function VersionsForm() {
$id = $this->currentPageID();
$page = $this->getRecord($id);
$versionsHtml = '';
@ -269,7 +269,7 @@ class CMSPageHistoryController extends CMSMain {
*
* @return html
*/
function doCompare($data, $form) {
public function doCompare($data, $form) {
$versions = $data['Versions'];
if(count($versions) < 2) return null;
@ -306,7 +306,7 @@ class CMSPageHistoryController extends CMSMain {
*
* @return html
*/
function doShowVersion($data, $form) {
public function doShowVersion($data, $form) {
$versionID = null;
if(isset($data['Versions']) && is_array($data['Versions'])) {
@ -334,7 +334,7 @@ class CMSPageHistoryController extends CMSMain {
/**
* @return Form
*/
function ShowVersionForm($versionID = null) {
public function ShowVersionForm($versionID = null) {
if(!$versionID) return null;
$id = $this->currentPageID();
@ -346,7 +346,7 @@ class CMSPageHistoryController extends CMSMain {
/**
* @return Form
*/
function CompareVersionsForm($versionID, $otherVersionID) {
public function CompareVersionsForm($versionID, $otherVersionID) {
if($versionID > $otherVersionID) {
$toVersion = $versionID;
$fromVersion = $otherVersionID;

View File

@ -11,7 +11,7 @@ class CMSPageSettingsController extends CMSMain {
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
static $session_namespace = 'CMSMain';
function getEditForm($id = null, $fields = null) {
public function getEditForm($id = null, $fields = null) {
$record = $this->getRecord($id ? $id : $this->currentPageID());
return parent::getEditForm($record, ($record) ? $record->getSettingsFields() : null);

View File

@ -12,7 +12,7 @@ class CMSPagesController extends CMSMain {
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
static $session_namespace = 'CMSMain';
function LinkPreview() {
public function LinkPreview() {
return false;
}

View File

@ -19,7 +19,7 @@ class CMSSettingsController extends LeftAndMain {
/**
* @return Form
*/
function getEditForm($id = null, $fields = null) {
public function getEditForm($id = null, $fields = null) {
$siteConfig = SiteConfig::current_site_config();
$fields = $siteConfig->getCMSFields();
@ -51,7 +51,7 @@ class CMSSettingsController extends LeftAndMain {
* @param Form $form
* @return String
*/
function save_siteconfig($data, $form) {
public function save_siteconfig($data, $form) {
$siteConfig = SiteConfig::current_site_config();
$form->saveInto($siteConfig);
$siteConfig->write();
@ -60,11 +60,11 @@ class CMSSettingsController extends LeftAndMain {
return $this->getResponseNegotiator()->respond($this->request);
}
function LinkPreview() {
public function LinkPreview() {
return false;
}
function Breadcrumbs($unlinked = false) {
public function Breadcrumbs($unlinked = false) {
$defaultTitle = self::menu_title_for_class(get_class($this));
return new ArrayList(array(
new ArrayData(array(

View File

@ -36,7 +36,7 @@ abstract class CMSSiteTreeFilter extends Object {
*/
protected $childrenMethod = null;
function __construct($params = null) {
public function __construct($params = null) {
if($params) $this->params = $params;
parent::__construct();
@ -46,14 +46,14 @@ abstract class CMSSiteTreeFilter extends Object {
* @return String Method on {@link Hierarchy} objects
* which is used to traverse into children relationships.
*/
function getChildrenMethod() {
public function getChildrenMethod() {
return $this->childrenMethod;
}
/**
* @return Array Map of Page IDs to their respective ParentID values.
*/
function pagesIncluded() {}
public function pagesIncluded() {}
/**
* Populate the IDs of the pages returned by pagesIncluded(), also including
@ -116,11 +116,11 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter {
protected $childrenMethod = "AllHistoricalChildren";
static function title() {
static public function title() {
return _t('CMSSiteTreeFilter_DeletedPages.Title', "All pages, including deleted");
}
function pagesIncluded() {
public function pagesIncluded() {
$ids = array();
// TODO Not very memory efficient, but usually not very many deleted pages exist
$pages = Versioned::get_including_deleted('SiteTree');
@ -139,11 +139,11 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter {
*/
class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
static function title() {
static public function title() {
return _t('CMSSiteTreeFilter_ChangedPages.Title', "Changed pages");
}
function pagesIncluded() {
public function pagesIncluded() {
$ids = array();
$q = new SQLQuery();
$q->setSelect(array('"SiteTree"."ID"','"SiteTree"."ParentID"'))
@ -165,7 +165,7 @@ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter {
*/
class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter {
static function title() {
static public function title() {
return _t('CMSSiteTreeFilter_Search.Title', "All pages");
}

View File

@ -217,7 +217,7 @@ class ContentController extends Controller {
*
* @return string
*/
function project() {
public function project() {
global $project;
return $project;
}
@ -333,7 +333,7 @@ HTML;
}
}
function SiteConfig() {
public function SiteConfig() {
if(method_exists($this->dataRecord, 'getSiteConfig')) {
return $this->dataRecord->getSiteConfig();
} else {
@ -347,7 +347,7 @@ HTML;
* @deprecated 2.5 Use ContentLocale() instead and write attribute names suitable to XHTML/HTML
* templates directly in the template.
*/
function LangAttributes() {
public function LangAttributes() {
Deprecation::notice('2.5', 'Use ContentLocale() instead and write attribute names suitable to XHTML/HTML instead.');
$locale = $this->ContentLocale();
return "xml:lang=\"$locale\" lang=\"$locale\"";
@ -364,7 +364,7 @@ HTML;
*
* @return string
*/
function ContentLocale() {
public function ContentLocale() {
if($this->dataRecord && $this->dataRecord->hasExtension('Translatable')) {
$locale = $this->dataRecord->Locale;
} elseif(class_exists('Translatable') && Object::has_extension('SiteTree', 'Translatable')) {
@ -379,7 +379,7 @@ HTML;
/**
* This action is called by the installation system
*/
function successfullyinstalled() {
public function successfullyinstalled() {
// The manifest should be built by now, so it's safe to publish the 404 page
$fourohfour = Versioned::get_one_by_stage('ErrorPage', 'Stage', '"ErrorCode" = 404');
if($fourohfour) {
@ -406,7 +406,7 @@ HTML;
);
}
function deleteinstallfiles() {
public function deleteinstallfiles() {
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
$title = new Varchar("Title");

View File

@ -16,7 +16,7 @@ class ModelAsController extends Controller implements NestedController {
* @param string $action
* @return ContentController
*/
public static function controller_for(SiteTree $sitetree, $action = null) {
static public function controller_for(SiteTree $sitetree, $action = null) {
if($sitetree->class == 'SiteTree') $controller = "ContentController";
else $controller = "{$sitetree->class}_Controller";
@ -148,7 +148,7 @@ class ModelAsController extends Controller implements NestedController {
* @param int $parentID The ID of the parent of the page the URLSegment belongs to.
* @return SiteTree
*/
static function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) {
static public function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) {
$URLSegment = Convert::raw2sql(rawurlencode($URLSegment));
$useParentIDFilter = SiteTree::nested_urls() && $parentID;

View File

@ -63,7 +63,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
* @param Member $member
* @return boolean
*/
function canView($member = null) {
public function canView($member = null) {
if(!$member && $member !== FALSE) $member = Member::currentUser();
if(!parent::canView($member)) return false;
@ -101,7 +101,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
*
* @return boolean
*/
public static function has_reports() {
static public function has_reports() {
return sizeof(SS_Report::get_reports()) > 0;
}
@ -137,7 +137,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
return $link;
}
function providePermissions() {
public function providePermissions() {
$title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
return array(
"CMS_ACCESS_ReportAdmin" => array(

View File

@ -26,7 +26,7 @@ class RootURLController extends Controller {
*
* @return string
*/
public static function get_homepage_link() {
static public function get_homepage_link() {
if(!self::$cached_homepage_link) {
// TODO Move to 'homepagefordomain' module
if(class_exists('HomepageForDomainExtension')) {
@ -63,7 +63,7 @@ class RootURLController extends Controller {
*
* @param string $urlsegment the URL segment for your home page
*/
public static function set_default_homepage_link($urlsegment = "home") {
static public function set_default_homepage_link($urlsegment = "home") {
self::$default_homepage_link = $urlsegment;
}
@ -72,7 +72,7 @@ class RootURLController extends Controller {
*
* @return string
*/
public static function get_default_homepage_link() {
static public function get_default_homepage_link() {
return self::$default_homepage_link;
}
@ -83,7 +83,7 @@ class RootURLController extends Controller {
* @param SiteTree $page
* @return bool
*/
public static function should_be_on_root(SiteTree $page) {
static public function should_be_on_root(SiteTree $page) {
if(!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/')) {
return !(
class_exists('Translatable') && $page->hasExtension('Translatable') && $page->Locale && $page->Locale != Translatable::default_locale()
@ -96,7 +96,7 @@ class RootURLController extends Controller {
/**
* Resets the cached homepage link value - useful for testing.
*/
public static function reset() {
static public function reset() {
self::$cached_homepage_link = null;
}

View File

@ -22,7 +22,7 @@ class SilverStripeNavigator extends ViewableData {
/**
* @param DataObject
*/
function __construct($record) {
public function __construct($record) {
if(!in_array('CMSPreviewable', class_implements($record))) {
throw new InvalidArgumentException('SilverStripeNavigator: Record of type %s doesn\'t implement CMSPreviewable', get_class($record));
}
@ -33,7 +33,7 @@ class SilverStripeNavigator extends ViewableData {
/**
* @return SS_List of SilverStripeNavigatorItem
*/
function getItems() {
public function getItems() {
$items = array();
$classes = ClassInfo::subclassesFor('SilverStripeNavigatorItem');
@ -65,7 +65,7 @@ class SilverStripeNavigator extends ViewableData {
/**
* @return DataObject
*/
function getRecord() {
public function getRecord() {
return $this->record;
}
@ -73,7 +73,7 @@ class SilverStripeNavigator extends ViewableData {
* @param DataObject $record
* @return Array template data
*/
static function get_for_record($record) {
static public function get_for_record($record) {
$html = '';
$message = '';
$navigator = new SilverStripeNavigator($record);
@ -110,7 +110,7 @@ class SilverStripeNavigatorItem extends ViewableData {
/**
* @param DataObject
*/
function __construct($record) {
public function __construct($record) {
$this->record = $record;
}
@ -118,13 +118,13 @@ class SilverStripeNavigatorItem extends ViewableData {
* @return String HTML, mostly a link - but can be more complex as well.
* For example, a "future state" item might show a date selector.
*/
function getHTML() {}
public function getHTML() {}
/**
* @return String
* Text displayed in watermark
*/
function getWatermark() {}
public function getWatermark() {}
/**
* Optional link to a specific view of this record.
@ -133,24 +133,24 @@ class SilverStripeNavigatorItem extends ViewableData {
*
* @return String
*/
function getLink() {}
public function getLink() {}
/**
* @return String
*/
function getMessage() {}
public function getMessage() {}
/**
* @return DataObject
*/
function getRecord() {
public function getRecord() {
return $this->record;
}
/**
* @return Int
*/
function getPriority() {
public function getPriority() {
return $this->stat('priority');
}
@ -160,7 +160,7 @@ class SilverStripeNavigatorItem extends ViewableData {
*
* @return boolean
*/
function isActive() {
public function isActive() {
return false;
}
@ -171,7 +171,7 @@ class SilverStripeNavigatorItem extends ViewableData {
* @param Member
* @return Boolean
*/
function canView($member = null) {
public function canView($member = null) {
return true;
}
}
@ -183,7 +183,7 @@ class SilverStripeNavigatorItem extends ViewableData {
class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
static $priority = 10;
function getHTML() {
public function getHTML() {
return sprintf(
'<a href="%s">%s</a>',
$this->record->CMSEditLink(),
@ -191,15 +191,15 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
);
}
function getLink() {
public function getLink() {
return $this->record->CMSEditLink();
}
function isActive() {
public function isActive() {
return (Controller::curr() instanceof CMSMain);
}
function canView($member = null) {
public function canView($member = null) {
// Don't show in CMS
return !(Controller::curr() instanceof CMSMain);
}
@ -213,7 +213,7 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem {
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
static $priority = 20;
function getHTML() {
public function getHTML() {
$draftPage = $this->getDraftPage();
if($draftPage) {
$this->recordLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage");
@ -221,23 +221,23 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
}
}
function getWatermark() {
public function getWatermark() {
return _t('ContentController.DRAFTSITE');
}
function getMessage() {
public function getMessage() {
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</div>";
}
function getLink() {
public function getLink() {
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
}
function canView($member = null) {
public function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->getDraftPage());
}
function isActive() {
public function isActive() {
return (
Versioned::current_stage() == 'Stage'
&& !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime())
@ -261,7 +261,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
static $priority = 30;
function getHTML() {
public function getHTML() {
$livePage = $this->getLivePage();
if($livePage) {
$this->recordLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live");
@ -269,23 +269,23 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
}
}
function getWatermark() {
public function getWatermark() {
return _t('ContentController.PUBLISHEDSITE');
}
function getMessage() {
public function getMessage() {
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</div>";
}
function getLink() {
public function getLink() {
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
}
function canView($member = null) {
public function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->getLivePage());
}
function isActive() {
public function isActive() {
return (!Versioned::current_stage() || Versioned::current_stage() == 'Live');
}
@ -306,12 +306,12 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
static $priority = 40;
function getHTML() {
public function getHTML() {
$this->recordLink = $this->record->AbsoluteLink();
return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
}
function getMessage() {
public function getMessage() {
if($date = Versioned::current_archived_date()) {
$dateObj = Datetime::create();
$dateObj->setValue($date);
@ -319,15 +319,15 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
}
}
function getLink() {
public function getLink() {
return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited;
}
function canView($member = null) {
public function canView($member = null) {
return ($this->record->hasExtension('Versioned') && $this->isArchived());
}
function isActive() {
public function isActive() {
return (Versioned::current_archived_date());
}
@ -336,7 +336,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
*
* @return boolean
*/
function isArchived() {
public function isArchived() {
if(!$this->record->hasExtension('Versioned')) return false;
$baseTable = ClassInfo::baseDataClass($this->record->class);

View File

@ -27,7 +27,7 @@ class StaticExporter extends Controller {
'export',
);
function init() {
public function init() {
parent::init();
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
@ -35,16 +35,16 @@ class StaticExporter extends Controller {
}
function Link($action = null) {
public function Link($action = null) {
return "StaticExporter/$action";
}
function index() {
public function index() {
echo "<h1>"._t('StaticExporter.NAME','Static exporter')."</h1>";
echo $this->StaticExportForm()->forTemplate();
}
function StaticExportForm() {
public function StaticExportForm() {
return new Form($this, 'StaticExportForm', new FieldList(
// new TextField('folder', _t('StaticExporter.FOLDEREXPORT','Folder to export to')),
new TextField('baseurl', _t('StaticExporter.BASEURL','Base URL'))
@ -53,7 +53,7 @@ class StaticExporter extends Controller {
));
}
function export() {
public function export() {
// specify custom baseurl for publishing to other webroot
if(isset($_REQUEST['baseurl'])) {
$base = $_REQUEST['baseurl'];

View File

@ -7,13 +7,13 @@
class FileList extends TableListField {
// bdc: added sort by Title as default behaviour
protected $folder;
function __construct($name, $folder) {
public function __construct($name, $folder) {
$this->folder = $folder;
parent::__construct($name, "File", array("Title" => "Title", "LinkedURL" => "URL"), "", "Title");
$this->Markable = true;
}
function sourceItems() {
public function sourceItems() {
return DataObject::get("File", "\"ParentID\" = '" . $this->folder->ID . "' AND \"ClassName\" <> 'Folder'", '"Title"');
}
}

View File

@ -21,16 +21,16 @@ class SiteTreeURLSegmentField extends TextField {
'suggest'
);
function Value() {
public function Value() {
return rawurldecode($this->value);
}
function Field($properties = array()) {
public function Field($properties = array()) {
Requirements::javascript(CMS_DIR . '/javascript/SiteTreeURLSegmentField.js');
return parent::Field($properties);
}
function suggest($request) {
public function suggest($request) {
if(!$request->getVar('value')) return $this->httpError(405);
$page = $this->getPage();
@ -49,7 +49,7 @@ class SiteTreeURLSegmentField extends TextField {
/**
* @return SiteTree
*/
function getPage() {
public function getPage() {
$idField = $this->getForm()->Fields()->dataFieldByName('ID');
return ($idField && $idField->Value()) ? DataObject::get_by_id('SiteTree', $idField->Value()) : singleton('SiteTree');
}
@ -57,14 +57,14 @@ class SiteTreeURLSegmentField extends TextField {
/**
* @param string the secondary text to show
*/
function setHelpText($string){
public function setHelpText($string){
$this->helpText = $string;
}
/**
* @return string the secondary text to show in the template
*/
function getHelpText(){
public function getHelpText(){
return $this->helpText;
}
@ -72,19 +72,19 @@ class SiteTreeURLSegmentField extends TextField {
/**
* @param the url that prefixes the page url segment field
*/
function setURLPrefix($url){
public function setURLPrefix($url){
$this->urlPrefix = $url;
}
/**
* @return the url prefixes the page url segment field to show in template
*/
function getURLPrefix(){
public function getURLPrefix(){
return $this->urlPrefix;
}
function Type() {
public function Type() {
return 'text urlsegment';
}

View File

@ -9,13 +9,13 @@ interface CurrentPageIdentifier {
* Get the current page ID.
* @return int
*/
function currentPageID();
public function currentPageID();
/**
* Check if the given DataObject is the current page.
* @param DataObject $page The page to check.
* @return boolean
*/
function isCurrentPage(DataObject $page);
public function isCurrentPage(DataObject $page);
}

View File

@ -36,7 +36,7 @@ class ErrorPage extends Page {
* @param int $statusCode
* @return SS_HTTPResponse
*/
public static function response_for($statusCode) {
static public function response_for($statusCode) {
// first attempt to dynamically generate the error page
if($errorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = $statusCode")) {
return ModelAsController::controller_for($errorPage)->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
@ -64,7 +64,7 @@ class ErrorPage extends Page {
* ErrorPage with a 404 and 500 error code. If there
* is not, one is created when the DB is built.
*/
function requireDefaultRecords() {
public function requireDefaultRecords() {
parent::requireDefaultRecords();
if ($this->class == 'ErrorPage' && SiteTree::get_create_default_pages()) {
@ -131,7 +131,7 @@ class ErrorPage extends Page {
}
}
function getCMSFields() {
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab(
@ -179,7 +179,7 @@ class ErrorPage extends Page {
* @param string $toStage Place to copy to. Must be a stage name.
* @param boolean $createNewVersion Set this to true to create a new version number. By default, the existing version number will be copied over.
*/
function doPublish() {
public function doPublish() {
parent::doPublish();
// Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
@ -221,7 +221,7 @@ class ErrorPage extends Page {
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
*
*/
function fieldLabels($includerelations = true) {
public function fieldLabels($includerelations = true) {
$labels = parent::fieldLabels($includerelations);
$labels['ErrorCode'] = _t('ErrorPage.CODE', "Error code");
@ -236,7 +236,7 @@ class ErrorPage extends Page {
* @param String $locale A locale, e.g. 'de_DE' (Optional)
* @return String
*/
static function get_filepath_for_errorcode($statusCode, $locale = null) {
static public function get_filepath_for_errorcode($statusCode, $locale = null) {
if (singleton('ErrorPage')->hasMethod('alternateFilepathForErrorcode')) {
return singleton('ErrorPage')-> alternateFilepathForErrorcode($statusCode, $locale);
}
@ -253,14 +253,14 @@ class ErrorPage extends Page {
*
* @param string $path
*/
static function set_static_filepath($path) {
static public function set_static_filepath($path) {
self::$static_filepath = $path;
}
/**
* @return string
*/
static function get_static_filepath() {
static public function get_static_filepath() {
return self::$static_filepath;
}
}
@ -270,7 +270,7 @@ class ErrorPage extends Page {
* @package cms
*/
class ErrorPage_Controller extends Page_Controller {
function init() {
public function init() {
parent::init();
$action = $this->request->param('Action');

View File

@ -30,7 +30,7 @@ class RedirectorPage extends Page {
* returns the target page.
* @return SiteTree
*/
function ContentSource() {
public function ContentSource() {
if($this->RedirectionType == 'Internal') {
return $this->LinkTo();
} else {
@ -44,7 +44,7 @@ class RedirectorPage extends Page {
* destination, to prevent unnecessary 30x redirections. However, if it's misconfigured, then
* it will return a link to itself, which will then display an error message.
*/
function Link() {
public function Link() {
if($link = $this->redirectionLink()) return $link;
else return $this->regularLink();
}
@ -53,7 +53,7 @@ class RedirectorPage extends Page {
* Return the normal link directly to this page. Once you visit this link, a 30x redirection
* will take you to your final destination.
*/
function regularLink($action = null) {
public function regularLink($action = null) {
return parent::Link($action);
}
@ -61,7 +61,7 @@ class RedirectorPage extends Page {
* Return the link that we should redirect to.
* Only return a value if there is a legal redirection destination.
*/
function redirectionLink() {
public function redirectionLink() {
if($this->RedirectionType == 'External') {
if($this->ExternalURL) {
return $this->ExternalURL;
@ -90,7 +90,7 @@ class RedirectorPage extends Page {
}
}
function syncLinkTracking() {
public function syncLinkTracking() {
if ($this->RedirectionType == 'Internal') {
if($this->LinkToID) {
$this->HasBrokenLink = DataObject::get_by_id('SiteTree', $this->LinkToID) ? false : true;
@ -104,7 +104,7 @@ class RedirectorPage extends Page {
}
}
function onBeforeWrite() {
public function onBeforeWrite() {
parent::onBeforeWrite();
// Prefix the URL with "http://" if no prefix is found
@ -113,7 +113,7 @@ class RedirectorPage extends Page {
}
}
function getCMSFields() {
public function getCMSFields() {
Requirements::javascript(CMS_DIR . '/javascript/RedirectorPage.js');
$fields = parent::getCMSFields();
@ -151,7 +151,7 @@ class RedirectorPage extends Page {
}
// Don't cache RedirectorPages
function subPagesToCache() {
public function subPagesToCache() {
return array();
}
}
@ -163,7 +163,7 @@ class RedirectorPage extends Page {
*/
class RedirectorPage_Controller extends Page_Controller {
function init() {
public function init() {
parent::init();
if($link = $this->redirectionLink()) {
@ -175,7 +175,7 @@ class RedirectorPage_Controller extends Page_Controller {
/**
* If we ever get this far, it means that the redirection failed.
*/
function Content() {
public function Content() {
return "<p class=\"message-setupWithoutRedirect\">" .
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
"</p>";

View File

@ -24,11 +24,11 @@ class SiteConfig extends DataObject implements PermissionProvider {
protected static $disabled_themes = array();
public static function disable_theme($theme) {
static public function disable_theme($theme) {
self::$disabled_themes[$theme] = $theme;
}
function populateDefaults()
public function populateDefaults()
{
$this->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
$this->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here");
@ -43,7 +43,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
*
* @return FieldList
*/
function getCMSFields() {
public function getCMSFields() {
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
@ -130,7 +130,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
*
* @return Fieldset
*/
function getCMSActions() {
public function getCMSActions() {
if (Permission::check('ADMIN') || Permission::check('EDIT_SITECONFIG')) {
$actions = new FieldList(
FormAction::create('save_siteconfig', _t('CMSMain.SAVE','Save'))
@ -148,7 +148,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
/**
* @return String
*/
function CMSEditLink() {
public function CMSEditLink() {
return singleton('CMSSettingsController')->Link();
}
@ -158,7 +158,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
*
* @return SiteConfig
*/
static function current_site_config() {
static public function current_site_config() {
if ($siteConfig = DataObject::get_one('SiteConfig')) return $siteConfig;
return self::make_site_config();
@ -167,7 +167,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
/**
* Setup a default SiteConfig record if none exists
*/
function requireDefaultRecords() {
public function requireDefaultRecords() {
parent::requireDefaultRecords();
$siteConfig = DataObject::get_one('SiteConfig');
if(!$siteConfig) {
@ -182,7 +182,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
* @param string $locale
* @return SiteConfig
*/
static function make_site_config() {
static public function make_site_config() {
$config = SiteConfig::create();
$config->write();
return $config;
@ -236,7 +236,7 @@ class SiteConfig extends DataObject implements PermissionProvider {
return false;
}
function providePermissions() {
public function providePermissions() {
return array(
'EDIT_SITECONFIG' => array(
'name' => _t('SiteConfig.EDIT_PERMISSION', 'Manage site configuration'),

View File

@ -210,14 +210,14 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @param boolean
*/
public static function set_enforce_strict_hierarchy($to) {
static public function set_enforce_strict_hierarchy($to) {
self::$enforce_strict_hierarchy = $to;
}
/**
* @return boolean
*/
public static function get_enforce_strict_hierarchy() {
static public function get_enforce_strict_hierarchy() {
return self::$enforce_strict_hierarchy;
}
@ -226,15 +226,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return bool
*/
public static function nested_urls() {
static public function nested_urls() {
return self::$nested_urls;
}
public static function enable_nested_urls() {
static public function enable_nested_urls() {
self::$nested_urls = true;
}
public static function disable_nested_urls() {
static public function disable_nested_urls() {
self::$nested_urls = false;
}
@ -243,7 +243,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @param bool $option
*/
public static function set_create_default_pages($option = true) {
static public function set_create_default_pages($option = true) {
self::$create_default_pages = $option;
}
@ -252,7 +252,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return bool
*/
public static function get_create_default_pages() {
static public function get_create_default_pages() {
return self::$create_default_pages;
}
@ -269,7 +269,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param bool $cache
* @return SiteTree
*/
public static function get_by_link($link, $cache = true) {
static public function get_by_link($link, $cache = true) {
if(trim($link, '/')) {
$link = trim(Director::makeRelative($link), '/');
} else {
@ -333,7 +333,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return array
*/
public static function page_type_classes() {
static public function page_type_classes() {
$classes = ClassInfo::getValidSubClasses();
$baseClassIndex = array_search('SiteTree', $classes);
@ -370,7 +370,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return string
*/
public static function link_shortcode_handler($arguments, $content = null, $parser = null) {
static public function link_shortcode_handler($arguments, $content = null, $parser = null) {
if(!isset($arguments['id']) || !is_numeric($arguments['id'])) return;
if (
@ -472,7 +472,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* @return String
*/
function CMSEditLink() {
public function CMSEditLink() {
return Controller::join_links(singleton('CMSPageEditController')->Link('show'), $this->ID);
}
@ -686,7 +686,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param string $seperator Seperating string
* @return string The resulting string
*/
function NestedTitle($level = 2, $separator = " - ") {
public function NestedTitle($level = 2, $separator = " - ") {
$item = $this;
while($item && $level > 0) {
$parts[] = $item->Title;
@ -713,7 +713,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Defaults to the currently logged in user.
* @return boolean True if the the member is allowed to do the given action.
*/
function can($perm, $member = null) {
public function can($perm, $member = null) {
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
$member = Member::currentUserID();
}
@ -827,7 +827,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param Member $member
* @return boolean
*/
function canViewStage($stage, $member = null) {
public function canViewStage($stage, $member = null) {
if(!$member) $member = Member::currentUser();
if(
@ -990,7 +990,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* Stub method to get the site config, provided so it's easy to override
*/
function getSiteConfig() {
public function getSiteConfig() {
if($this->hasMethod('alternateSiteConfig')) {
$altConfig = $this->alternateSiteConfig();
@ -1003,7 +1003,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* @deprecated 3.0 Use prepopulate_permission_cache() instead (without the extraneous "p" in "prepopulate")
*/
static function prepopuplate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
static public function prepopuplate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
Deprecation::notice("3.0", "Use prepopulate_permission_cache instead.");
self::prepopulate_permission_cache($permission, $ids, $batchCallback);
}
@ -1017,7 +1017,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param $batchCallBack The function/static method to call to calculate permissions. Defaults
* to 'SiteTree::can_(permission)_multiple'
*/
static function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
static public function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) {
if(!$batchCallback) $batchCallback = "SiteTree::can_{$permission}_multiple";
if(is_callable($batchCallback)) {
@ -1046,7 +1046,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param Boolean $useCached
* @return Array An map of {@link SiteTree} ID keys, to boolean values
*/
static function batch_permission_check($ids, $memberID, $typeField, $groupJoinTable, $siteConfigMethod, $globalPermission = 'CMS_ACCESS_CMSMain', $useCached = true) {
static public function batch_permission_check($ids, $memberID, $typeField, $groupJoinTable, $siteConfigMethod, $globalPermission = 'CMS_ACCESS_CMSMain', $useCached = true) {
// Sanitise the IDs
$ids = array_filter($ids, 'is_numeric');
@ -1164,7 +1164,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return A map where the IDs are keys and the values are booleans stating whether the given
* page can be edited.
*/
static function can_edit_multiple($ids, $memberID, $useCached = true) {
static public function can_edit_multiple($ids, $memberID, $useCached = true) {
return self::batch_permission_check($ids, $memberID, 'CanEditType', 'SiteTree_EditorGroups', 'canEdit', 'CMS_ACCESS_CMSMain', $useCached);
}
@ -1173,7 +1173,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param An array of IDs of the SiteTree pages to look up.
* @param useCached Return values from the permission cache if they exist.
*/
static function can_delete_multiple($ids, $memberID, $useCached = true) {
static public function can_delete_multiple($ids, $memberID, $useCached = true) {
$deletable = array();
$result = array_fill_keys($ids, false);
$cacheKey = "delete-$memberID";
@ -1321,7 +1321,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* records when the database is built, but make sure you call
* parent::requireDefaultRecords().
*/
function requireDefaultRecords() {
public function requireDefaultRecords() {
parent::requireDefaultRecords();
// default pages
@ -1420,7 +1420,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
}
}
function syncLinkTracking() {
public function syncLinkTracking() {
// Build a list of HTMLText fields
$allFields = $this->db();
$htmlFields = array();
@ -1446,7 +1446,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$this->extend('augmentSyncLinkTracking');
}
function onAfterWrite() {
public function onAfterWrite() {
// Need to flush cache to avoid outdated versionnumber references
$this->flushCache();
@ -1466,7 +1466,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
parent::onAfterWrite();
}
function onBeforeDelete() {
public function onBeforeDelete() {
parent::onBeforeDelete();
// If deleting this page, delete all its children.
@ -1478,7 +1478,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
}
function onAfterDelete() {
public function onAfterDelete() {
// Need to flush cache to avoid outdated versionnumber references
$this->flushCache();
@ -1492,12 +1492,12 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
parent::onAfterDelete();
}
function flushCache($persistent = true) {
public function flushCache($persistent = true) {
parent::flushCache($persistent);
$this->_cache_statusFlags = null;
}
function validate() {
public function validate() {
$result = parent::validate();
// Allowed children validation
@ -1594,7 +1594,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param string $title Page title.
* @return string Generated url segment
*/
function generateURLSegment($title){
public function generateURLSegment($title){
$filter = URLSegmentFilter::create();
$t = $filter->filter($title);
@ -1610,7 +1610,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* @return string
*/
function getStageURLSegment() {
public function getStageURLSegment() {
$stageRecord = Versioned::get_one_by_stage(
'SiteTree',
'Stage',
@ -1622,7 +1622,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* @return string
*/
function getLiveURLSegment() {
public function getLiveURLSegment() {
$liveRecord = Versioned::get_one_by_stage(
'SiteTree',
'Live',
@ -1635,7 +1635,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Rewrite a file URL on this page, after its been renamed.
* Triggers the onRenameLinkedAsset action on extensions.
*/
function rewriteFileURL($old, $new) {
public function rewriteFileURL($old, $new) {
$fields = $this->inheritedDatabaseFields();
// Update the content without actually creating a new version
foreach(array("SiteTree_Live", "SiteTree") as $table) {
@ -1671,7 +1671,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @param $includeVirtuals Set to false to exlcude virtual pages.
*/
function DependentPages($includeVirtuals = true) {
public function DependentPages($includeVirtuals = true) {
if(class_exists('Subsite')) {
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
@ -1712,7 +1712,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @param $includeVirtuals Set to false to exlcude virtual pages.
*/
function DependentPagesCount($includeVirtuals = true) {
public function DependentPagesCount($includeVirtuals = true) {
$links = DB::query("SELECT COUNT(*) FROM \"SiteTree_LinkTracking\"
INNER JOIN \"SiteTree\" ON \"SiteTree\".\"ID\" = \"SiteTree_LinkTracking\".\"SiteTreeID\"
WHERE \"ChildID\" = $this->ID ")->value();
@ -1734,7 +1734,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* Return all virtual pages that link to this page
*/
function VirtualPages() {
public function VirtualPages() {
if(!$this->ID) return null;
if(class_exists('Subsite')) {
return Subsite::get_from_all_subsites('VirtualPage', "\"CopyContentFromID\" = " . (int)$this->ID);
@ -1757,7 +1757,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return FieldList The fields to be displayed in the CMS.
*/
function getCMSFields() {
public function getCMSFields() {
require_once("forms/Form.php");
// Status / message
// Create a status message for multiple parents
@ -1914,7 +1914,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return FieldList
*/
function getSettingsFields() {
public function getSettingsFields() {
$groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
asort($groupsMap);
@ -2015,7 +2015,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
*
*/
function fieldLabels($includerelations = true) {
public function fieldLabels($includerelations = true) {
$cacheKey = $this->class . '_' . $includerelations;
if(!isset(self::$_cache_field_labels[$cacheKey])) {
$labels = parent::fieldLabels($includerelations);
@ -2062,7 +2062,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Get the actions available in the CMS for this page - eg Save, Publish.
* @return FieldList The available actions for this page.
*/
function getCMSActions() {
public function getCMSActions() {
$minorActions = CompositeField::create()->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
$actions = new FieldList($minorActions);
@ -2150,7 +2150,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @uses SiteTreeExtension->onBeforePublish()
* @uses SiteTreeExtension->onAfterPublish()
*/
function doPublish() {
public function doPublish() {
if (!$this->canPublish()) return false;
$original = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $this->ID");
@ -2195,7 +2195,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @uses SiteTreeExtension->onBeforeUnpublish()
* @uses SiteTreeExtension->onAfterUnpublish()
*/
function doUnpublish() {
public function doUnpublish() {
if(!$this->canDeleteFromLive()) return false;
if(!$this->ID) return false;
@ -2237,7 +2237,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* Revert the draft changes: replace the draft content with the content on live
*/
function doRevertToLive() {
public function doRevertToLive() {
$this->publish("Live", "Stage", false);
// Use a clone to get the updates made by $this->publish
@ -2257,7 +2257,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Restore the content in the active copy of this SiteTree page to the stage site.
* @return The SiteTree object.
*/
function doRestoreToStage() {
public function doRestoreToStage() {
// if no record can be found on draft stage (meaning it has been "deleted from draft" before),
// create an empty record
if(!DB::query("SELECT \"ID\" FROM \"SiteTree\" WHERE \"ID\" = $this->ID")->value()) {
@ -2288,7 +2288,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* Synonym of {@link doUnpublish}
*/
function doDeleteFromLive() {
public function doDeleteFromLive() {
return $this->doUnpublish();
}
@ -2298,7 +2298,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return boolean True if this page is new.
*/
function isNew() {
public function isNew() {
/**
* This check was a problem for a self-hosted site, and may indicate a
* bug in the interpreter on their server, or a bug here
@ -2318,7 +2318,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return boolean True if this page has been published.
*/
function isPublished() {
public function isPublished() {
if($this->isNew())
return false;
@ -2387,7 +2387,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return array
*/
function allowedChildren() {
public function allowedChildren() {
$allowedChildren = array();
$candidates = $this->stat('allowed_children');
if($candidates && $candidates != "none" && $candidates != "SiteTree_root") {
@ -2414,7 +2414,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return string
*/
function defaultChild() {
public function defaultChild() {
$default = $this->stat('default_child');
$allowed = $this->allowedChildren();
if($allowed) {
@ -2431,7 +2431,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return string
*/
function defaultParent() {
public function defaultParent() {
return $this->stat('default_parent');
}
@ -2441,7 +2441,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return string
*/
function getMenuTitle(){
public function getMenuTitle(){
if($value = $this->getField("MenuTitle")) {
return $value;
} else {
@ -2455,7 +2455,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @param string $value
*/
function setMenuTitle($value) {
public function setMenuTitle($value) {
if($value == $this->getField("Title")) {
$this->setField("MenuTitle", null);
} else {
@ -2479,7 +2479,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @param Boolean $cached
* @return array
*/
function getStatusFlags($cached = true) {
public function getStatusFlags($cached = true) {
if(!$this->_cache_statusFlags || !$cached) {
$flags = array();
if($this->IsDeletedFromStage) {
@ -2518,7 +2518,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* @deprecated 3.0 Use getTreeTitle()
*/
function TreeTitle() {
public function TreeTitle() {
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
return $this->getTreeTitle();
}
@ -2530,7 +2530,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return string a html string ready to be directly used in a template
*/
function getTreeTitle() {
public function getTreeTitle() {
$flags = $this->getStatusFlags();
$treeTitle = sprintf(
"<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>",
@ -2568,7 +2568,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return string
*/
function CMSTreeClasses() {
public function CMSTreeClasses() {
$classes = sprintf('class-%s', $this->class);
if($this->HasBrokenFile || $this->HasBrokenLink)
$classes .= " BrokenLink";
@ -2599,7 +2599,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return boolean
*/
function getIsDeletedFromStage() {
public function getIsDeletedFromStage() {
if(!$this->ID) return true;
if($this->isNew()) return false;
@ -2612,7 +2612,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
/**
* Return true if this page exists on the live site
*/
function getExistsOnLive() {
public function getExistsOnLive() {
return (bool)Versioned::get_versionnumber_by_stage('SiteTree', 'Live', $this->ID);
}
@ -2656,7 +2656,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* of SiteTree in a extension. Call before calling parent::getCMSFields(),
* and reenable afterwards.
*/
public static function disableCMSFieldsExtensions() {
static public function disableCMSFieldsExtensions() {
self::$runCMSFieldsExtensions = false;
}
@ -2664,11 +2664,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Reenables extendCMSFields() being called on getCMSFields() after
* it has been disabled by disableCMSFieldsExtensions().
*/
public static function enableCMSFieldsExtensions() {
static public function enableCMSFieldsExtensions() {
self::$runCMSFieldsExtensions = true;
}
function providePermissions() {
public function providePermissions() {
return array(
'SITETREE_GRANT_ACCESS' => array(
'name' => _t('SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION', 'Manage access rights for content'),
@ -2708,7 +2708,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*
* @return String
*/
function i18n_singular_name() {
public function i18n_singular_name() {
// Convert 'Page' to 'SiteTree' for correct localization lookups
$class = ($this->class == 'Page') ? 'SiteTree' : $this->class;
return _t($class.'.SINGULARNAME', $this->singular_name());
@ -2718,7 +2718,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Overloaded to also provide entities for 'Page' class which is usually
* located in custom code, hence textcollector picks it up for the wrong folder.
*/
function provideI18nEntities() {
public function provideI18nEntities() {
$entities = parent::provideI18nEntities();
if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR;
@ -2735,15 +2735,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
return $entities;
}
function getParentType() {
public function getParentType() {
return $this->ParentID == 0 ? 'root' : 'subpage';
}
static function reset() {
static public function reset() {
self::$cache_permissions = array();
}
static function on_db_reset() {
static public function on_db_reset() {
self::$cache_permissions = array();
}

View File

@ -7,22 +7,22 @@
*/
abstract class SiteTreeExtension extends DataExtension {
function onBeforePublish(&$original) {
public function onBeforePublish(&$original) {
}
function onAfterPublish(&$original) {
public function onAfterPublish(&$original) {
}
function onBeforeUnpublish() {
public function onBeforeUnpublish() {
}
function onAfterUnpublish() {
public function onAfterUnpublish() {
}
function canAddChildren($member) {
public function canAddChildren($member) {
}
function canPublish($member) {
public function canPublish($member) {
}

View File

@ -9,7 +9,7 @@ class SiteTreeFileExtension extends DataExtension {
'BackLinkTracking' => 'SiteTree'
);
function updateCMSFields(FieldList $fields) {
public function updateCMSFields(FieldList $fields) {
$fields->insertAfter(new ReadonlyField('BackLinkCount',
_t('AssetTableField.BACKLINKCOUNT', 'Used on:'),
$this->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')),
@ -22,7 +22,7 @@ class SiteTreeFileExtension extends DataExtension {
*
* @return ComponentSet
*/
function BackLinkTracking($filter = "", $sort = "", $join = "", $limit = "") {
public function BackLinkTracking($filter = "", $sort = "", $join = "", $limit = "") {
if(class_exists("Subsite")){
$rememberSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
@ -43,7 +43,7 @@ class SiteTreeFileExtension extends DataExtension {
*
* @return Integer
*/
function BackLinkTrackingCount() {
public function BackLinkTrackingCount() {
$pages = $this->owner->BackLinkTracking();
if($pages) {
return $pages->Count();
@ -55,7 +55,7 @@ class SiteTreeFileExtension extends DataExtension {
/**
* Updates link tracking.
*/
function onAfterDelete() {
public function onAfterDelete() {
// We query the explicit ID list, because BackLinkTracking will get modified after the stage
// site does its thing
$brokenPageIDs = $this->owner->BackLinkTracking()->column("ID");
@ -86,7 +86,7 @@ class SiteTreeFileExtension extends DataExtension {
* @param String $old File path relative to the webroot
* @param String $new File path relative to the webroot
*/
function updateLinks($old, $new) {
public function updateLinks($old, $new) {
if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
$pages = $this->owner->BackLinkTracking();

View File

@ -49,7 +49,7 @@ class VirtualPage extends Page {
/**
* Generates the array of fields required for the page type.
*/
function getVirtualFields() {
public function getVirtualFields() {
$nonVirtualFields = array_merge(self::$non_virtual_fields, self::$initially_copied_fields);
$record = $this->CopyContentFrom();
@ -66,7 +66,7 @@ class VirtualPage extends Page {
/**
* @return SiteTree Returns the linked page, or failing that, a new object.
*/
function CopyContentFrom() {
public function CopyContentFrom() {
$copyContentFromID = $this->CopyContentFromID;
if(!$copyContentFromID) return new SiteTree();
@ -87,12 +87,12 @@ class VirtualPage extends Page {
return $this->components['CopyContentFrom'] ? $this->components['CopyContentFrom'] : new SiteTree();
}
function setCopyContentFromID($val) {
public function setCopyContentFromID($val) {
if($val && DataObject::get_by_id('SiteTree', $val) instanceof VirtualPage) $val = 0;
return $this->setField("CopyContentFromID", $val);
}
function ContentSource() {
public function ContentSource() {
return $this->CopyContentFrom();
}
@ -111,7 +111,7 @@ class VirtualPage extends Page {
return $tags;
}
function allowedChildren() {
public function allowedChildren() {
if($this->CopyContentFrom()) {
return $this->CopyContentFrom()->allowedChildren();
}
@ -164,7 +164,7 @@ class VirtualPage extends Page {
/**
* Generate the CMS fields from the fields from the original page.
*/
function getCMSFields() {
public function getCMSFields() {
$fields = parent::getCMSFields();
// Setup the linking to the original page.
@ -209,7 +209,7 @@ class VirtualPage extends Page {
/**
* We have to change it to copy all the content from the original page first.
*/
function onBeforeWrite() {
public function onBeforeWrite() {
$performCopyFrom = null;
// Determine if we need to copy values.
@ -245,7 +245,7 @@ class VirtualPage extends Page {
parent::onBeforeWrite();
}
function onAfterWrite() {
public function onAfterWrite() {
parent::onAfterWrite();
// Don't do this stuff when we're publishing
@ -292,7 +292,7 @@ class VirtualPage extends Page {
}
}
function validate() {
public function validate() {
$result = parent::validate();
// "Can be root" validation
@ -314,7 +314,7 @@ class VirtualPage extends Page {
/**
* Ensure we have an up-to-date version of everything.
*/
function copyFrom($source, $updateImageTracking = true) {
public function copyFrom($source, $updateImageTracking = true) {
if($source) {
foreach($this->getVirtualFields() as $virtualField) {
$this->$virtualField = $source->$virtualField;
@ -332,7 +332,7 @@ class VirtualPage extends Page {
}
}
function updateImageTracking() {
public function updateImageTracking() {
// Doesn't work on unsaved records
if(!$this->ID) return;
@ -343,7 +343,7 @@ class VirtualPage extends Page {
$this->ImageTracking()->setByIdList($this->CopyContentFrom()->ImageTracking()->column('ID'));
}
function CMSTreeClasses() {
public function CMSTreeClasses() {
return parent::CMSTreeClasses() . ' VirtualPage-' . $this->CopyContentFrom()->ClassName;
}
@ -354,7 +354,7 @@ class VirtualPage extends Page {
* @param string $field
* @return mixed
*/
function __get($field) {
public function __get($field) {
if(parent::hasMethod($funcName = "get$field")) {
return $this->$funcName();
} else if(parent::hasField($field)) {
@ -370,7 +370,7 @@ class VirtualPage extends Page {
* @param string $method
* @param string $args
*/
function __call($method, $args) {
public function __call($method, $args) {
if(parent::hasMethod($method)) {
return parent::__call($method, $args);
} else {
@ -393,7 +393,7 @@ class VirtualPage extends Page {
* @param string $method
* @return bool
*/
function hasMethod($method) {
public function hasMethod($method) {
if(parent::hasMethod($method)) return true;
return $this->copyContentFrom()->hasMethod($method);
}
@ -412,13 +412,13 @@ class VirtualPage_Controller extends Page_Controller {
/**
* Reloads the content if the version is different ;-)
*/
function reloadContent() {
public function reloadContent() {
$this->failover->copyFrom($this->failover->CopyContentFrom());
$this->failover->write();
return;
}
function getViewer($action) {
public function getViewer($action) {
$originalClass = get_class($this->CopyContentFrom());
if ($originalClass == 'SiteTree') $name = 'Page_Controller';
else $name = $originalClass."_Controller";
@ -432,7 +432,7 @@ class VirtualPage_Controller extends Page_Controller {
* NOTE: Virtual page must have a container object of subclass of sitetree.
* We can't load the content without an ID or record to copy it from.
*/
function init(){
public function init(){
if(isset($this->record) && $this->record->ID){
if($this->record->VersionID != $this->failover->CopyContentFrom()->Version){
$this->reloadContent();
@ -442,7 +442,7 @@ class VirtualPage_Controller extends Page_Controller {
parent::init();
}
function loadcontentall() {
public function loadcontentall() {
$pages = DataObject::get("VirtualPage");
foreach($pages as $page) {
$page->copyFrom($page->CopyContentFrom());
@ -458,7 +458,7 @@ class VirtualPage_Controller extends Page_Controller {
* @param string $method
* @return bool
*/
function hasMethod($method) {
public function hasMethod($method) {
$haveIt = parent::hasMethod($method);
if (!$haveIt) {
$originalClass = get_class($this->CopyContentFrom());
@ -476,7 +476,7 @@ class VirtualPage_Controller extends Page_Controller {
* @param string $method
* @param string $args
*/
function __call($method, $args) {
public function __call($method, $args) {
try {
return parent::__call($method, $args);
} catch (Exception $e) {

View File

@ -8,11 +8,11 @@
class BrokenLinksReport extends SS_Report {
function title() {
public function title() {
return _t('BrokenLinksReport.BROKENLINKS',"Broken links report");
}
function sourceRecords($params, $sort, $limit) {
public function sourceRecords($params, $sort, $limit) {
$join = '';
$sortBrokenReason = false;
if($sort) {
@ -73,7 +73,7 @@ class BrokenLinksReport extends SS_Report {
return $returnSet;
}
function columns() {
public function columns() {
if(isset($_REQUEST['CheckSite']) && $_REQUEST['CheckSite'] == 'Draft') {
$dateTitle = _t('BrokenLinksReport.ColumnDateLastModified', 'Date last modified');
} else {
@ -112,7 +112,7 @@ class BrokenLinksReport extends SS_Report {
return $fields;
}
function parameterFields() {
public function parameterFields() {
return new FieldList(
new DropdownField('CheckSite', _t('BrokenLinksReport.CheckSite','Check site'), array(
'Published' => _t('BrokenLinksReport.CheckSiteDropdownPublished', 'Published Site'),

View File

@ -77,7 +77,7 @@ class SS_Report extends ViewableData {
* - overriding description(), which lets you support i18n
* - defining the $description property
*/
function title() {
public function title() {
return $this->title;
}
@ -88,14 +88,14 @@ class SS_Report extends ViewableData {
* - overriding description(), which lets you support i18n
* - defining the $description property
*/
function description() {
public function description() {
return $this->description;
}
/**
* Return the {@link SQLQuery} that provides your report data.
*/
function sourceQuery($params) {
public function sourceQuery($params) {
if($this->hasMethod('sourceRecords')) {
return $this->sourceRecords()->dataQuery();
} else {
@ -106,7 +106,7 @@ class SS_Report extends ViewableData {
/**
* Return a SS_List records for this report.
*/
function records($params) {
public function records($params) {
if($this->hasMethod('sourceRecords')) {
return $this->sourceRecords($params, null, null);
} else {
@ -124,11 +124,11 @@ class SS_Report extends ViewableData {
/**
* Return the data class for this report
*/
function dataClass() {
public function dataClass() {
return $this->dataClass;
}
function getLink($action = null) {
public function getLink($action = null) {
return Controller::join_links(
'admin/reports/',
"$this->class",
@ -147,7 +147,7 @@ class SS_Report extends ViewableData {
* @param $priority The priority. Higher numbers will appear furhter up in the reports list.
* The default value is zero.
*/
static function register($list, $reportClass, $priority = 0) {
static public function register($list, $reportClass, $priority = 0) {
Deprecation::notice('3.0', 'All subclasses of SS_Report now appear in the report admin, no need to register');
}
@ -155,7 +155,7 @@ class SS_Report extends ViewableData {
* @deprecated 3.0
* All subclasses of SS_Report now appear in the report admin, no need to register or unregister.
*/
static function unregister($list, $reportClass) {
static public function unregister($list, $reportClass) {
self::add_excluded_reports($reportClass);
}
@ -163,7 +163,7 @@ class SS_Report extends ViewableData {
* Exclude certain reports classes from the list of Reports in the CMS
* @param $reportClass Can be either a string with the report classname or an array of reports classnames
*/
static function add_excluded_reports($reportClass) {
static public function add_excluded_reports($reportClass) {
if (is_array($reportClass)) {
self::$excluded_reports = array_merge(self::$excluded_reports, $reportClass);
} else {
@ -179,7 +179,7 @@ class SS_Report extends ViewableData {
* the list of reports in report admin in the CMS.
* @return array
*/
static function get_excluded_reports() {
static public function get_excluded_reports() {
return self::$excluded_reports;
}
@ -187,7 +187,7 @@ class SS_Report extends ViewableData {
* Return the SS_Report objects making up the given list.
* @return ArrayList an arraylist of SS_Report objects
*/
static function get_reports() {
static public function get_reports() {
$reports = ClassInfo::subclassesFor(get_called_class());
$reportsArray = array();
@ -226,7 +226,7 @@ class SS_Report extends ViewableData {
*
* @return FieldList
*/
function getCMSFields() {
public function getCMSFields() {
$fields = new FieldList();
if($title = $this->title()) {
@ -257,7 +257,7 @@ class SS_Report extends ViewableData {
return $fields;
}
function getCMSActions() {
public function getCMSActions() {
// getCMSActions() can be extended with updateCMSActions() on a extension
$actions = new FieldList();
$this->extend('updateCMSActions', $actions);
@ -273,7 +273,7 @@ class SS_Report extends ViewableData {
*
* @return FormField subclass
*/
function getReportField() {
public function getReportField() {
// TODO Remove coupling with global state
$params = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : array();
$items = $this->sourceRecords($params, null, null);
@ -318,7 +318,7 @@ class SS_Report extends ViewableData {
* @param Member $member
* @return boolean
*/
function canView($member = null) {
public function canView($member = null) {
if(!$member && $member !== FALSE) {
$member = Member::currentUser();
}
@ -335,7 +335,7 @@ class SS_Report extends ViewableData {
*
* @return string
*/
function TreeTitle() {
public function TreeTitle() {
return $this->title();
}
@ -360,27 +360,27 @@ class SS_Report extends ViewableData {
abstract class SS_ReportWrapper extends SS_Report {
protected $baseReport;
function __construct($baseReport) {
public function __construct($baseReport) {
$this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport;
$this->dataClass = $this->baseReport->dataClass();
parent::__construct();
}
function ID() {
public function ID() {
return get_class($this->baseReport) . '_' . get_class($this);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Filtering
function parameterFields() {
public function parameterFields() {
return $this->baseReport->parameterFields();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Columns
function columns() {
public function columns() {
return $this->baseReport->columns();
}
@ -390,16 +390,16 @@ abstract class SS_ReportWrapper extends SS_Report {
/**
* Override this method to perform some actions prior to querying.
*/
function beforeQuery($params) {
public function beforeQuery($params) {
}
/**
* Override this method to perform some actions after querying.
*/
function afterQuery() {
public function afterQuery() {
}
function sourceQuery($params) {
public function sourceQuery($params) {
if($this->baseReport->hasMethod('sourceRecords')) {
// The default implementation will create a fake query from our sourceRecords() method
return parent::sourceQuery($params);
@ -416,7 +416,7 @@ abstract class SS_ReportWrapper extends SS_Report {
}
function sourceRecords($params = array(), $sort = null, $limit = null) {
public function sourceRecords($params = array(), $sort = null, $limit = null) {
$this->beforeQuery($params);
$records = $this->baseReport->sourceRecords($params, $sort, $limit);
$this->afterQuery();
@ -427,23 +427,23 @@ abstract class SS_ReportWrapper extends SS_Report {
///////////////////////////////////////////////////////////////////////////////////////////
// Pass-through
function title() {
public function title() {
return $this->baseReport->title();
}
function group() {
public function group() {
return $this->baseReport->hasMethod('group') ? $this->baseReport->group() : 'Group';
}
function sort() {
public function sort() {
return $this->baseReport->hasMethod('sort') ? $this->baseReport->sort() : 0;
}
function description() {
public function description() {
return $this->baseReport->description();
}
function canView($member = null) {
public function canView($member = null) {
return $this->baseReport->canView($member);
}

View File

@ -14,25 +14,25 @@ class SideReportView extends ViewableData {
protected $controller, $report;
protected $parameters;
function __construct($controller, $report) {
public function __construct($controller, $report) {
$this->controller = $controller;
$this->report = $report;
parent::__construct();
}
function group() {
public function group() {
return _t('SideReport.OtherGroupTitle', "Other");
}
function sort() {
public function sort() {
return 0;
}
function setParameters($parameters) {
public function setParameters($parameters) {
$this->parameters = $parameters;
}
function forTemplate() {
public function forTemplate() {
$records = $this->report->records($this->parameters);
$columns = $this->report->columns();
@ -111,7 +111,7 @@ class SideReportView extends ViewableData {
* @subpackage content
*/
class SideReportWrapper extends SS_ReportWrapper {
function columns() {
public function columns() {
if($this->baseReport->hasMethod('sideReportColumns')) {
return $this->baseReport->sideReportColumns();
} else {
@ -129,20 +129,20 @@ class SideReportWrapper extends SS_ReportWrapper {
* @subpackage content
*/
class SideReport_EmptyPages extends SS_Report {
function title() {
public function title() {
return _t('SideReport.EMPTYPAGES',"Pages with no content");
}
function group() {
public function group() {
return _t('SideReport.ContentGroupTitle', "Content reports");
}
function sort() {
public function sort() {
return 100;
}
function sourceRecords($params = null) {
public function sourceRecords($params = null) {
return DataObject::get("SiteTree", "\"ClassName\" != 'RedirectorPage' AND (\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '<p></p>' OR \"Content\" LIKE '<p>&nbsp;</p>')", '"Title"');
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Title", // todo: use NestedTitle(2)
@ -159,20 +159,20 @@ class SideReport_EmptyPages extends SS_Report {
* @subpackage content
*/
class SideReport_RecentlyEdited extends SS_Report {
function title() {
public function title() {
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
}
function group() {
public function group() {
return _t('SideReport.ContentGroupTitle', "Content reports");
}
function sort() {
public function sort() {
return 200;
}
function sourceRecords($params = null) {
public function sourceRecords($params = null) {
$threshold = strtotime('-14 days', SS_Datetime::now()->Format('U'));
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Title", // todo: use NestedTitle(2)
@ -189,13 +189,13 @@ class SideReport_RecentlyEdited extends SS_Report {
* @subpackage content
*/
class SideReport_BrokenLinks extends SS_Report {
function title() {
public function title() {
return _t('SideReport.BROKENLINKS',"Pages with broken links");
}
function group() {
public function group() {
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
}
function sourceRecords($params = null) {
public function sourceRecords($params = null) {
// Get class names for page types that are not virtual pages or redirector pages
$classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage'));
$classNames = "'".join("','", $classes)."'";
@ -204,7 +204,7 @@ class SideReport_BrokenLinks extends SS_Report {
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1");
return $ret;
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => _t('ReportAdmin.ReportTitle', 'Title'), // todo: use NestedTitle(2)
@ -212,7 +212,7 @@ class SideReport_BrokenLinks extends SS_Report {
),
);
}
function getParameterFields() {
public function getParameterFields() {
return new FieldList(
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
);
@ -227,13 +227,13 @@ class SideReport_BrokenLinks extends SS_Report {
* @subpackage content
*/
class SideReport_BrokenFiles extends SS_Report {
function title() {
public function title() {
return _t('SideReport.BROKENFILES',"Pages with broken files");
}
function group() {
public function group() {
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
}
function sourceRecords($params = null) {
public function sourceRecords($params = null) {
// Get class names for page types that are not virtual pages or redirector pages
$classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage'));
$classNames = "'".join("','", $classes)."'";
@ -242,7 +242,7 @@ class SideReport_BrokenFiles extends SS_Report {
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenFile = 1");
return $ret;
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Title", // todo: use NestedTitle(2)
@ -251,7 +251,7 @@ class SideReport_BrokenFiles extends SS_Report {
);
}
function getParameterFields() {
public function getParameterFields() {
return new FieldList(
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
);
@ -263,20 +263,20 @@ class SideReport_BrokenFiles extends SS_Report {
* @subpackage content
*/
class SideReport_BrokenVirtualPages extends SS_Report {
function title() {
public function title() {
return _t('SideReport.BROKENVIRTUALPAGES', 'VirtualPages pointing to deleted pages');
}
function group() {
public function group() {
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
}
function sourceRecords($params = null) {
public function sourceRecords($params = null) {
$classNames = "'".join("','", ClassInfo::subclassesFor('VirtualPage'))."'";
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1");
else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1");
return $ret;
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Title", // todo: use NestedTitle(2)
@ -285,7 +285,7 @@ class SideReport_BrokenVirtualPages extends SS_Report {
);
}
function getParameterFields() {
public function getParameterFields() {
return new FieldList(
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
);
@ -297,13 +297,13 @@ class SideReport_BrokenVirtualPages extends SS_Report {
* @subpackage content
*/
class SideReport_BrokenRedirectorPages extends SS_Report {
function title() {
public function title() {
return _t('SideReport.BROKENREDIRECTORPAGES', 'RedirectorPages pointing to deleted pages');
}
function group() {
public function group() {
return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports");
}
function sourceRecords($params = null) {
public function sourceRecords($params = null) {
$classNames = "'".join("','", ClassInfo::subclassesFor('RedirectorPage'))."'";
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1");
@ -311,7 +311,7 @@ class SideReport_BrokenRedirectorPages extends SS_Report {
return $ret;
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Title", // todo: use NestedTitle(2)
@ -320,7 +320,7 @@ class SideReport_BrokenRedirectorPages extends SS_Report {
);
}
function getParameterFields() {
public function getParameterFields() {
return new FieldList(
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
);

View File

@ -14,7 +14,7 @@ class ContentControllerSearchExtension extends Extension {
/**
* Site search form
*/
function SearchForm() {
public function SearchForm() {
$searchText = _t('SearchForm.SEARCH', 'Search');
if($this->owner->request && $this->owner->request->getVar('Search')) {
@ -39,7 +39,7 @@ class ContentControllerSearchExtension extends Extension {
* @param SearchForm $form The form instance that was submitted
* @param SS_HTTPRequest $request Request generated for this action
*/
function results($data, $form, $request) {
public function results($data, $form, $request) {
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),

View File

@ -35,7 +35,7 @@ class SearchForm extends Form {
* if fields are added to the form.
* @param FieldList $actions Optional, defaults to a single field named "Go".
*/
function __construct($controller, $name, $fields = null, $actions = null) {
public function __construct($controller, $name, $fields = null, $actions = null) {
if(!$fields) {
$fields = new FieldList(
new TextField('Search', _t('SearchForm.SEARCH', 'Search')
@ -70,7 +70,7 @@ class SearchForm extends Form {
* Set the classes to search.
* Currently you can only choose from "SiteTree" and "File", but a future version might improve this.
*/
function classesToSearch($classes) {
public function classesToSearch($classes) {
$illegalClasses = array_diff($classes, array('SiteTree', 'File'));
if($illegalClasses) {
user_error("SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses) . "'. At this stage, only File and SiteTree are allowed", E_USER_WARNING);
@ -84,7 +84,7 @@ class SearchForm extends Form {
*
* @return array
*/
function getClassesToSearch() {
public function getClassesToSearch() {
return $this->classesToSearch;
}

View File

@ -44,7 +44,7 @@ class FilesystemPublisher extends StaticPublisher {
* Set a different base URL for the static copy of the site.
* This can be useful if you are running the CMS on a different domain from the website.
*/
static function set_static_base_url($url) {
static public function set_static_base_url($url) {
self::$static_base_url = $url;
}
@ -56,7 +56,7 @@ class FilesystemPublisher extends StaticPublisher {
* with the filename 'index.html'. If you set the extension to PHP, then a simple PHP script will
* be generated that can do appropriate cache & redirect header negotation.
*/
function __construct($destFolder = 'cache', $fileExtension = null) {
public function __construct($destFolder = 'cache', $fileExtension = null) {
// Remove trailing slash from folder
if(substr($destFolder, -1) == '/') $destFolder = substr($destFolder, 0, -1);
@ -90,7 +90,7 @@ class FilesystemPublisher extends StaticPublisher {
* @param Array $urls Absolute or relative URLs
* @return Array Map of original URLs to filesystem paths (relative to {@link $destFolder}).
*/
function urlsToPaths($urls) {
public function urlsToPaths($urls) {
$mappedUrls = array();
foreach($urls as $url) {
@ -123,7 +123,7 @@ class FilesystemPublisher extends StaticPublisher {
return $mappedUrls;
}
function unpublishPages($urls) {
public function unpublishPages($urls) {
// Do we need to map these?
// Detect a numerically indexed arrays
if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls);
@ -142,7 +142,7 @@ class FilesystemPublisher extends StaticPublisher {
}
}
function publishPages($urls) {
public function publishPages($urls) {
// Do we need to map these?
// Detect a numerically indexed arrays
if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls);

View File

@ -24,7 +24,7 @@ class RsyncMultiHostPublisher extends FilesystemPublisher {
*
* @param $targets An array of targets to publish to. These can either be local file names, or scp-style targets, in the form "user@server:path"
*/
static function set_targets($targets) {
static public function set_targets($targets) {
self::$targets = $targets;
}
@ -32,11 +32,11 @@ class RsyncMultiHostPublisher extends FilesystemPublisher {
* Specify folders to exclude from the rsync
* For example, you could exclude assets.
*/
static function set_excluded_folders($folders) {
static public function set_excluded_folders($folders) {
self::$excluded_folders = $folders;
}
function publishPages($urls) {
public function publishPages($urls) {
parent::publishPages($urls);
$base = Director::baseFolder();
$framework = FRAMEWORK_DIR;

View File

@ -24,18 +24,18 @@ abstract class StaticPublisher extends DataExtension {
*/
static $static_publisher_theme=false;
abstract function publishPages($pages);
abstract function unpublishPages($pages);
abstract public function publishPages($pages);
abstract public function unpublishPages($pages);
static function set_static_publisher_theme($theme){
static public function set_static_publisher_theme($theme){
self::$static_publisher_theme=$theme;
}
static function static_publisher_theme(){
static public function static_publisher_theme(){
return self::$static_publisher_theme;
}
static function echo_progress() {
static public function echo_progress() {
return (boolean)self::$echo_progress;
}
@ -43,14 +43,14 @@ abstract class StaticPublisher extends DataExtension {
* Either turns on (boolean true) or off (boolean false) the progress indicators.
* @see StaticPublisher::$echo_progress
*/
static function set_echo_progress($progress) {
static public function set_echo_progress($progress) {
self::$echo_progress = (boolean)$progress;
}
/**
* Called after a page is published.
*/
function onAfterPublish($original) {
public function onAfterPublish($original) {
$this->republish($original);
}
@ -60,11 +60,11 @@ abstract class StaticPublisher extends DataExtension {
*
* Only called if the published content exists and has been modified.
*/
function onRenameLinkedAsset($original) {
public function onRenameLinkedAsset($original) {
$this->republish($original);
}
function republish($original) {
public function republish($original) {
if (self::$disable_realtime) return;
$urls = array();
@ -102,7 +102,7 @@ abstract class StaticPublisher extends DataExtension {
* On after unpublish, get changes and hook into underlying
* functionality
*/
function onAfterUnpublish($page) {
public function onAfterUnpublish($page) {
if (self::$disable_realtime) return;
// Get the affected URLs
@ -125,7 +125,7 @@ abstract class StaticPublisher extends DataExtension {
/**
* Get all external references to CSS, JS,
*/
function externalReferencesFor($content) {
public function externalReferencesFor($content) {
$CLI_content = escapeshellarg($content);
$tidy = `echo $CLI_content | tidy -numeric -asxhtml`;
$tidy = preg_replace('/xmlns="[^"]+"/','', $tidy);

View File

@ -1,4 +1,4 @@
function windowName(suffix) {
public function windowName(suffix) {
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
return base + suffix;
}

View File

@ -12,7 +12,7 @@ class FilesystemSyncTask extends BuildTask {
should be called whenever files are added to the assets/ folder from outside
SilverStripe, for example, if an author uploads files via FTP.";
function run($request) {
public function run($request) {
if(isset($_GET['folderID'])) {
$folderID = $_GET['folderID'];
} else {

View File

@ -11,7 +11,7 @@ class RebuildStaticCacheTask extends Controller {
'index',
);
function init() {
public function init() {
parent::init();
Versioned::reading_stage('live');
@ -20,7 +20,7 @@ class RebuildStaticCacheTask extends Controller {
if(!$canAccess) return Security::permissionFailure($this);
}
function index() {
public function index() {
StaticPublisher::set_echo_progress(true);
$page = singleton('Page');
@ -44,7 +44,7 @@ class RebuildStaticCacheTask extends Controller {
* @param array $urls The URLs of pages to re-fetch and cache.
* @param bool $removeAll Remove all stale cache files (default TRUE).
*/
function rebuildCache($urls, $removeAll = true) {
public function rebuildCache($urls, $removeAll = true) {
if(!is_array($urls)) {
// $urls must be an array
@ -117,7 +117,7 @@ class RebuildStaticCacheTask extends Controller {
echo "\n\n== Done! ==";
}
function show() {
public function show() {
$urls = singleton('Page')->allPagesToCache();
echo "<pre>\n";
print_r($urls);

View File

@ -48,11 +48,11 @@ in the other stage:<br />
protected $orphanedSearchClass = 'SiteTree';
function Link() {
public function Link() {
return $this->class;
}
function init() {
public function init() {
parent::init();
if(!Permission::check('ADMIN')) {
@ -60,7 +60,7 @@ in the other stage:<br />
}
}
function index() {
public function index() {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::customCSS('#OrphanIDs .middleColumn {width: auto;}');
Requirements::customCSS('#OrphanIDs label {display: inline;}');
@ -68,7 +68,7 @@ in the other stage:<br />
return $this->renderWith('BlankPage');
}
function Form() {
public function Form() {
$fields = new FieldList();
$source = array();
@ -179,11 +179,11 @@ in the other stage:<br />
return $form;
}
function run($request) {
public function run($request) {
// @todo Merge with BuildTask functionality
}
function doSubmit($data, $form) {
public function doSubmit($data, $form) {
set_time_limit(60*10); // 10 minutes
if(!isset($data['OrphanIDs']) || !isset($data['OrphanOperation'])) return false;
@ -321,7 +321,7 @@ in the other stage:<br />
* @param int|array $limit
* @return SS_List
*/
function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null) {
public function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null) {
$filter .= ($filter) ? ' AND ' : '';
$filter .= sprintf("\"%s\".\"ParentID\" != 0 AND \"Parents\".\"ID\" IS NULL", $class);

View File

@ -8,7 +8,7 @@ class SiteTreeMaintenanceTask extends Controller {
'*' => 'ADMIN'
);
function makelinksunique() {
public function makelinksunique() {
$badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'";
$pages = DataObject::get("SiteTree", "\"URLSegment\" IN ($badURLs)");

View File

@ -18,7 +18,7 @@ class UpgradeSiteTreePermissionSchemaTask extends BuildTask {
See http://open.silverstripe.com/ticket/2847
";
function run($request) {
public function run($request) {
// transfer values for changed column name
foreach(array('SiteTree','SiteTree_Live','SiteTree_versions') as $table) {
DB::query("UPDATE \"{$table}\" SET \"CanViewType\" = 'Viewers';");

View File

@ -11,7 +11,7 @@ class CMSMainTest extends FunctionalTest {
static protected $orig = array();
static function set_up_once() {
static public function set_up_once() {
self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions;
CMSBatchActionHandler::$batch_actions = array(
'publish' => 'CMSBatchAction_Publish',
@ -22,7 +22,7 @@ class CMSMainTest extends FunctionalTest {
parent::set_up_once();
}
static function tear_down_once() {
static public function tear_down_once() {
CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions'];
parent::tear_down_once();
@ -31,7 +31,7 @@ class CMSMainTest extends FunctionalTest {
/**
* @todo Test the results of a publication better
*/
function testPublish() {
public function testPublish() {
$page1 = $this->objFromFixture('Page', "page1");
$page2 = $this->objFromFixture('Page', "page2");
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
@ -74,7 +74,7 @@ class CMSMainTest extends FunctionalTest {
/**
* Test publication of one of every page type
*/
function testPublishOneOfEachKindOfPage() {
public function testPublishOneOfEachKindOfPage() {
return;
$classes = ClassInfo::subclassesFor("SiteTree");
array_shift($classes);
@ -100,7 +100,7 @@ class CMSMainTest extends FunctionalTest {
* Test that getCMSFields works on each page type.
* Mostly, this is just checking that the method doesn't return an error
*/
function testThatGetCMSFieldsWorksOnEveryPageType() {
public function testThatGetCMSFieldsWorksOnEveryPageType() {
$classes = ClassInfo::subclassesFor("SiteTree");
array_shift($classes);
@ -118,7 +118,7 @@ class CMSMainTest extends FunctionalTest {
}
}
function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff() {
public function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff() {
$this->logInWithPermission('ADMIN');
SiteTree::set_enforce_strict_hierarchy(true);
@ -139,7 +139,7 @@ class CMSMainTest extends FunctionalTest {
/**
* Test that a draft-deleted page can still be opened in the CMS
*/
function testDraftDeletedPageCanBeOpenedInCMS() {
public function testDraftDeletedPageCanBeOpenedInCMS() {
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
// Set up a page that is delete from live
@ -161,7 +161,7 @@ class CMSMainTest extends FunctionalTest {
/**
* Test CMSMain::getRecord()
*/
function testGetRecord() {
public function testGetRecord() {
// Set up a page that is delete from live
$page1 = $this->objFromFixture('Page','page1');
$page1ID = $page1->ID;
@ -185,14 +185,14 @@ class CMSMainTest extends FunctionalTest {
}
function testDeletedPagesSiteTreeFilter() {
public function testDeletedPagesSiteTreeFilter() {
$id = $this->idFromFixture('Page', 'page3');
$this->logInWithPermission('ADMIN');
$result = $this->get('admin/pages/getsubtree?filter=CMSSiteTreeFilter_DeletedPages&ajax=1&ID=' . $id);
$this->assertEquals(200, $result->getStatusCode());
}
function testCreationOfTopLevelPage(){
public function testCreationOfTopLevelPage(){
$cmsUser = $this->objFromFixture('Member', 'allcmssectionsuser');
$rootEditUser = $this->objFromFixture('Member', 'rootedituser');
@ -222,7 +222,7 @@ class CMSMainTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', NULL);
}
function testCreationOfRestrictedPage(){
public function testCreationOfRestrictedPage(){
$adminUser = $this->objFromFixture('Member', 'admin');
$adminUser->logIn();
@ -260,7 +260,7 @@ class CMSMainTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', NULL);
}
function testBreadcrumbs() {
public function testBreadcrumbs() {
$page3 = $this->objFromFixture('Page', 'page3');
$page31 = $this->objFromFixture('Page', 'page31');
$adminuser = $this->objFromFixture('Member', 'admin');

View File

@ -12,7 +12,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
private $versionUnpublishedCheck, $versionPublishCheck, $versionUnpublishedCheck2;
private $page;
function setUp() {
public function setUp() {
parent::setUp();
$this->loginWithPermission('ADMIN');
@ -40,7 +40,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
$this->versionPublishCheck2 = $this->page->Version;
}
function testGetEditForm() {
public function testGetEditForm() {
$controller = new CMSPageHistoryController();
// should get the latest version which we cannot rollback to
@ -84,7 +84,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
* @todo should be less tied to cms theme.
* @todo check highlighting for comparing pages.
*/
function testVersionsForm() {
public function testVersionsForm() {
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
@ -101,7 +101,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
$this->assertEquals(4, count($rows));
}
function testVersionsFormTableContainsInformation() {
public function testVersionsFormTableContainsInformation() {
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
$rows = $form[0]->xpath("fieldset/table/tbody/tr");
@ -126,7 +126,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
$this->assertThat((string) $rows[1]->attributes()->class, $this->logicalNot($this->stringContains('active')));
}
function testVersionsFormSelectsUnpublishedCheckbox() {
public function testVersionsFormSelectsUnpublishedCheckbox() {
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
$checkbox = $this->cssParser()->getBySelector("#Form_VersionsForm #ShowUnpublished input");

View File

@ -3,7 +3,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
static $fixture_file = 'CMSSiteTreeFilterTest.yml';
function testSearchFilterEmpty() {
public function testSearchFilterEmpty() {
$page1 = $this->objFromFixture('Page', 'page1');
$page2 = $this->objFromFixture('Page', 'page2');
@ -14,7 +14,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
$this->assertTrue($f->isPageIncluded($page2));
}
function testSearchFilterByTitle() {
public function testSearchFilterByTitle() {
$page1 = $this->objFromFixture('Page', 'page1');
$page2 = $this->objFromFixture('Page', 'page2');
@ -30,7 +30,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
);
}
function testIncludesParentsForNestedMatches() {
public function testIncludesParentsForNestedMatches() {
$parent = $this->objFromFixture('Page', 'page3');
$child = $this->objFromFixture('Page', 'page3b');
@ -46,7 +46,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
);
}
function testChangedPagesFilter() {
public function testChangedPagesFilter() {
$unchangedPage = $this->objFromFixture('Page', 'page1');
$unchangedPage->doPublish();
@ -68,7 +68,7 @@ class CMSSiteTreeFilterTest extends SapphireTest {
);
}
function testDeletedPagesFilter() {
public function testDeletedPagesFilter() {
$deletedPage = $this->objFromFixture('Page', 'page2');
$deletedPage->publish('Stage', 'Live');
$deletedPageID = $deletedPage->ID;

View File

@ -1,7 +1,7 @@
<?php
class ContentControllerSearchExtensionTest extends SapphireTest {
function testCustomSearchFormClassesToTest() {
public function testCustomSearchFormClassesToTest() {
FulltextSearchable::enable('File');
$page = new Page();

View File

@ -19,7 +19,7 @@ class ModelAsControllerTest extends FunctionalTest {
* This setup will enable nested-urls for this test and resets the state
* after the tests have been performed.
*/
function setUp() {
public function setUp() {
parent::setUp();
$this->orig['nested_urls'] = SiteTree::nested_urls();
@ -32,7 +32,7 @@ class ModelAsControllerTest extends FunctionalTest {
* This setup will enable nested-urls for this test and resets the state
* after the tests have been performed.
*/
function tearDown() {
public function tearDown() {
if (isset($this->orig['nested_urls']) && !$this->orig['nested_urls']) {
SiteTree::disable_nested_urls();
@ -131,7 +131,7 @@ class ModelAsControllerTest extends FunctionalTest {
$response->getHeader("Location"));
}
function testDoesntRedirectToNestedChildrenOutsideOfOwnHierarchy() {
public function testDoesntRedirectToNestedChildrenOutsideOfOwnHierarchy() {
$this->generateNestedPagesFixture();
$otherParent = new Page(array(
@ -156,7 +156,7 @@ class ModelAsControllerTest extends FunctionalTest {
* NOTE: This test requires nested_urls
*
*/
function testRedirectsNestedRenamedPagesWithGetParameters() {
public function testRedirectsNestedRenamedPagesWithGetParameters() {
$this->generateNestedPagesFixture();
// check third level URLSegment
@ -173,7 +173,7 @@ class ModelAsControllerTest extends FunctionalTest {
* NOTE: This test requires nested_urls
*
*/
function testDoesntRedirectToNestedRenamedPageWhenNewExists() {
public function testDoesntRedirectToNestedRenamedPageWhenNewExists() {
$this->generateNestedPagesFixture();
$otherLevel1 = new Page(array(
@ -202,7 +202,7 @@ class ModelAsControllerTest extends FunctionalTest {
* NOTE: This test requires nested_urls
*
*/
function testFindOldPage(){
public function testFindOldPage(){
$page = new Page();
$page->Title = 'First Level';
$page->URLSegment = 'oldurl';
@ -239,7 +239,7 @@ class ModelAsControllerTest extends FunctionalTest {
*
* NOTE: This test requires nested_urls
*/
function testChildOfDraft() {
public function testChildOfDraft() {
RootURLController::reset();
SiteTree::enable_nested_urls();

View File

@ -8,7 +8,7 @@ class SilverStripeNavigatorTest extends SapphireTest {
static $fixture_file = 'cms/tests/controller/CMSMainTest.yml';
function testGetItems() {
public function testGetItems() {
$page = $this->objFromFixture('Page', 'page1');
$navigator = new SilverStripeNavigator($page);
@ -23,7 +23,7 @@ class SilverStripeNavigatorTest extends SapphireTest {
);
}
function testCanView() {
public function testCanView() {
$page = $this->objFromFixture('Page', 'page1');
$admin = $this->objFromFixture('Member', 'admin');
$author = $this->objFromFixture('Member', 'assetsonlyuser');
@ -47,7 +47,7 @@ class SilverStripeNavigatorTest_TestItem extends SilverStripeNavigatorItem imple
}
class SilverStripeNavigatorTest_ProtectedTestItem extends SilverStripeNavigatorItem implements TestOnly {
function canView($member = null) {
public function canView($member = null) {
if(!$member) $member = Member::currentUser();
return Permission::checkMember($member, 'ADMIN');
}

View File

@ -11,7 +11,7 @@ class ErrorPageTest extends FunctionalTest {
protected $tmpAssetsPath = '';
function setUp() {
public function setUp() {
parent::setUp();
$this->orig['ErrorPage_staticfilepath'] = ErrorPage::get_static_filepath();
@ -23,7 +23,7 @@ class ErrorPageTest extends FunctionalTest {
Director::set_environment_type('live');
}
function tearDown() {
public function tearDown() {
parent::tearDown();
ErrorPage::set_static_filepath($this->orig['ErrorPage_staticfilepath']);
@ -33,7 +33,7 @@ class ErrorPageTest extends FunctionalTest {
Filesystem::removeFolder($this->tmpAssetsPath);
}
function test404ErrorPage() {
public function test404ErrorPage() {
$page = $this->objFromFixture('ErrorPage', '404');
// ensure that the errorpage exists as a physical file
$page->publish('Stage', 'Live');
@ -50,7 +50,7 @@ class ErrorPageTest extends FunctionalTest {
$this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"');
}
function testBehaviourOfShowInMenuAndShowInSearchFlags() {
public function testBehaviourOfShowInMenuAndShowInSearchFlags() {
$page = $this->objFromFixture('ErrorPage', '404');
/* Don't show the error page in the menus */

View File

@ -6,7 +6,7 @@
class FileLinkTrackingTest extends SapphireTest {
static $fixture_file = "FileLinkTrackingTest.yml";
function setUp() {
public function setUp() {
parent::setUp();
$this->logInWithPermission('ADMIN');
@ -16,7 +16,7 @@ class FileLinkTrackingTest extends SapphireTest {
fclose($fh);
}
function tearDown() {
public function tearDown() {
parent::tearDown();
$testFiles = array(
'/testscript-test-file.pdf',
@ -28,7 +28,7 @@ class FileLinkTrackingTest extends SapphireTest {
}
}
function testFileRenameUpdatesDraftAndPublishedPages() {
public function testFileRenameUpdatesDraftAndPublishedPages() {
$page = $this->objFromFixture('Page', 'page1');
$this->assertTrue($page->doPublish());
$this->assertContains('<img src="assets/testscript-test-file.pdf"',
@ -44,7 +44,7 @@ class FileLinkTrackingTest extends SapphireTest {
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
}
function testFileLinkRewritingOnVirtualPages() {
public function testFileLinkRewritingOnVirtualPages() {
// Publish the source page
$page = $this->objFromFixture('Page', 'page1');
$this->assertTrue($page->doPublish());
@ -67,7 +67,7 @@ class FileLinkTrackingTest extends SapphireTest {
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $svp->ID")->value());
}
function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft() {
public function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft() {
// Publish the source page
$page = $this->objFromFixture('Page', 'page1');
$this->assertTrue($page->doPublish());
@ -86,7 +86,7 @@ class FileLinkTrackingTest extends SapphireTest {
$this->assertFalse($page->IsModifiedOnStage);
}
function testTwoFileRenamesInARowWork() {
public function testTwoFileRenamesInARowWork() {
$page = $this->objFromFixture('Page', 'page1');
$this->assertTrue($page->doPublish());
$this->assertContains('<img src="assets/testscript-test-file.pdf"',

View File

@ -4,14 +4,14 @@ class RedirectorPageTest extends FunctionalTest {
static $fixture_file = 'RedirectorPageTest.yml';
static $use_draft_site = true;
function testGoodRedirectors() {
public function testGoodRedirectors() {
/* For good redirectors, the final destination URL will be returned */
$this->assertEquals("http://www.google.com", $this->objFromFixture('RedirectorPage','goodexternal')->Link());
$this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->redirectionLink());
$this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->Link());
}
function testEmptyRedirectors() {
public function testEmptyRedirectors() {
/* If a redirector page is misconfigured, then its link method will just return the usual URLSegment-generated value */
$page1 = $this->objFromFixture('RedirectorPage','badexternal');
$this->assertEquals(Director::baseURL() . 'bad-external/', $page1->Link());
@ -27,7 +27,7 @@ class RedirectorPageTest extends FunctionalTest {
$this->assertContains('message-setupWithoutRedirect', $content);
}
function testReflexiveAndTransitiveInternalRedirectors() {
public function testReflexiveAndTransitiveInternalRedirectors() {
/* Reflexive redirectors are those that point to themselves. They should behave the same as an empty redirector */
$page = $this->objFromFixture('RedirectorPage','reflexive');
$this->assertEquals(Director::baseURL() . 'reflexive/', $page->Link());
@ -44,7 +44,7 @@ class RedirectorPageTest extends FunctionalTest {
$this->assertEquals(Director::baseURL() . "redirection-dest/", $response->getHeader("Location"));
}
function testExternalURLGetsPrefixIfNotSet() {
public function testExternalURLGetsPrefixIfNotSet() {
$page = $this->objFromFixture('RedirectorPage', 'externalnoprefix');
$this->assertEquals($page->ExternalURL, 'http://google.com', 'onBeforeWrite has prefixed with http');
$page->write();

View File

@ -12,7 +12,7 @@ class SiteConfigTest extends SapphireTest {
'SiteTree' => array('SiteTreeSubsites')
);
function testAvailableThemes() {
public function testAvailableThemes() {
$config = SiteConfig::current_site_config();
$ds = DIRECTORY_SEPARATOR;
$testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes';

View File

@ -16,19 +16,19 @@ class SiteTreeActionsTest extends FunctionalTest {
static $fixture_file = 'SiteTreeActionsTest.yml';
static function set_up_once() {
static public function set_up_once() {
SiteTreeTest::set_up_once();
parent::set_up_once();
}
static function tear_down_once() {
static public function tear_down_once() {
SiteTreeTest::tear_down_once();
parent::tear_down_once();
}
function testActionsReadonly() {
public function testActionsReadonly() {
if(class_exists('SiteTreeCMSWorkflow')) return true;
$readonlyEditor = $this->objFromFixture('Member', 'cmsreadonlyeditor');
@ -50,7 +50,7 @@ class SiteTreeActionsTest extends FunctionalTest {
$this->assertNull($actions->dataFieldByName('action_revert'));
}
function testActionsNoDeletePublishedRecord() {
public function testActionsNoDeletePublishedRecord() {
if(class_exists('SiteTreeCMSWorkflow')) return true;
$this->logInWithPermission('ADMIN');
@ -79,7 +79,7 @@ class SiteTreeActionsTest extends FunctionalTest {
$this->assertNotNull($actions->dataFieldByName('action_deletefromlive'));
}
function testActionsPublishedRecord() {
public function testActionsPublishedRecord() {
if(class_exists('SiteTreeCMSWorkflow')) return true;
$author = $this->objFromFixture('Member', 'cmseditor');
@ -101,7 +101,7 @@ class SiteTreeActionsTest extends FunctionalTest {
$this->assertNull($actions->dataFieldByName('action_revert'));
}
function testActionsDeletedFromStageRecord() {
public function testActionsDeletedFromStageRecord() {
if(class_exists('SiteTreeCMSWorkflow')) return true;
$author = $this->objFromFixture('Member', 'cmseditor');
@ -129,7 +129,7 @@ class SiteTreeActionsTest extends FunctionalTest {
$this->assertNotNull($actions->dataFieldByName('action_revert'));
}
function testActionsChangedOnStageRecord() {
public function testActionsChangedOnStageRecord() {
if(class_exists('SiteTreeCMSWorkflow')) return true;
$author = $this->objFromFixture('Member', 'cmseditor');
@ -153,7 +153,7 @@ class SiteTreeActionsTest extends FunctionalTest {
$this->assertNull($actions->dataFieldByName('action_revert'));
}
function testActionsViewingOldVersion() {
public function testActionsViewingOldVersion() {
$p = new Page();
$p->Content = 'test page first version';
$p->write();
@ -175,11 +175,11 @@ class SiteTreeActionsTest extends FunctionalTest {
}
class SiteTreeActionsTest_Page extends Page implements TestOnly {
function canEdit($member = null) {
public function canEdit($member = null) {
return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANEDIT');
}
function canDelete($member = null) {
public function canDelete($member = null) {
return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANDELETE');
}
}

View File

@ -7,19 +7,19 @@ class SiteTreeBacklinksTest extends SapphireTest {
'SiteTree' => array('SiteTreeBacklinksTest_DOD'),
);
static function set_up_once() {
static public function set_up_once() {
SiteTreeTest::set_up_once();
parent::set_up_once();
}
static function tear_down_once() {
static public function tear_down_once() {
SiteTreeTest::tear_down_once();
parent::tear_down_once();
}
function setUp() {
public function setUp() {
parent::setUp();
// Log in as admin so that we don't run into permission issues. That's not what we're
@ -27,7 +27,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->logInWithPermission('ADMIN');
}
function testSavingPageWithLinkAddsBacklink() {
public function testSavingPageWithLinkAddsBacklink() {
// load page 1
$page1 = $this->objFromFixture('Page', 'page1');
@ -46,7 +46,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->assertContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 exists');
}
function testRemovingLinkFromPageRemovesBacklink() {
public function testRemovingLinkFromPageRemovesBacklink() {
// load page 1
$page1 = $this->objFromFixture('Page', 'page1');
@ -65,7 +65,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->assertNotContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 doesn\'t exist');
}
function testChangingUrlOnDraftSiteRewritesLink() {
public function testChangingUrlOnDraftSiteRewritesLink() {
// load page 1
$page1 = $this->objFromFixture('Page', 'page1');
@ -89,7 +89,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
}
function testChangingUrlOnLiveSiteRewritesLink() {
public function testChangingUrlOnLiveSiteRewritesLink() {
// publish page 1 & 3
$page1 = $this->objFromFixture('Page', 'page1');
$page3 = $this->objFromFixture('Page', 'page3');
@ -120,7 +120,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
}
function testPublishingPageWithModifiedUrlRewritesLink() {
public function testPublishingPageWithModifiedUrlRewritesLink() {
// publish page 1 & 3
$page1 = $this->objFromFixture('Page', 'page1');
$page3 = $this->objFromFixture('Page', 'page3');
@ -155,7 +155,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new published url exists on page 3');
}
function testPublishingPageWithModifiedLinksRewritesLinks() {
public function testPublishingPageWithModifiedLinksRewritesLinks() {
// publish page 1 & 3
$page1 = $this->objFromFixture('Page', 'page1');
$page3 = $this->objFromFixture('Page', 'page3');
@ -195,7 +195,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
$this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
}
function testLinkTrackingOnExtraContentFields() {
public function testLinkTrackingOnExtraContentFields() {
$page1 = $this->objFromFixture('Page', 'page1');
$page2 = $this->objFromFixture('Page', 'page2');
$page1->doPublish();
@ -248,7 +248,7 @@ class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly {
'ExtraContent' => 'HTMLText',
);
function updateCMSFields(FieldList $fields) {
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent"));
}
}

View File

@ -6,19 +6,19 @@
class SiteTreeBrokenLinksTest extends SapphireTest {
static $fixture_file = 'SiteTreeBrokenLinksTest.yml';
static function set_up_once() {
static public function set_up_once() {
SiteTreeTest::set_up_once();
parent::set_up_once();
}
static function tear_down_once() {
static public function tear_down_once() {
SiteTreeTest::tear_down_once();
parent::tear_down_once();
}
function testBrokenLinksBetweenPages() {
public function testBrokenLinksBetweenPages() {
$obj = $this->objFromFixture('Page','content');
$obj->Content = '<a href="[sitetree_link,id=3423423]">this is a broken link</a>';
@ -30,7 +30,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
$this->assertFalse($obj->HasBrokenLink, 'Page does NOT have a broken link');
}
function testBrokenVirtualPages() {
public function testBrokenVirtualPages() {
$obj = $this->objFromFixture('Page','content');
$vp = new VirtualPage();
@ -43,7 +43,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
$this->assertTrue($vp->HasBrokenLink, 'Broken virtual page IS marked as such');
}
function testBrokenInternalRedirectorPages() {
public function testBrokenInternalRedirectorPages() {
$obj = $this->objFromFixture('Page','content');
$rp = new RedirectorPage();
@ -58,7 +58,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
$this->assertTrue($rp->HasBrokenLink, 'Broken redirector page IS marked as such');
}
function testBrokenAssetLinks() {
public function testBrokenAssetLinks() {
$obj = $this->objFromFixture('Page','content');
$obj->Content = '<a href="assets/nofilehere.pdf">this is a broken link to a pdf file</a>';
@ -70,7 +70,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
$this->assertFalse($obj->HasBrokenFile, 'Page does NOT have a broken file');
}
function testDeletingFileMarksBackedPagesAsBroken() {
public function testDeletingFileMarksBackedPagesAsBroken() {
// Test entry
$file = new File();
$file->Filename = 'test-file.pdf';
@ -99,7 +99,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
$liveObj = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $obj->ID");
$this->assertEquals(1, $liveObj->HasBrokenFile);
}
function testDeletingMarksBackLinkedPagesAsBroken() {
public function testDeletingMarksBackLinkedPagesAsBroken() {
$this->logInWithPermission('ADMIN');
// Set up two published pages with a link from content -> about
@ -142,7 +142,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
WHERE \"ID\" = $linkSrc->ID")->value());
}
function testPublishingSourceBeforeDestHasBrokenLink() {
public function testPublishingSourceBeforeDestHasBrokenLink() {
$this->logInWithPermission('ADMIN');
// Set up two draft pages with a link from content -> about
@ -164,7 +164,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
}
function testRestoreFixesBrokenLinks() {
public function testRestoreFixesBrokenLinks() {
// Create page and virutal page
$p = new Page();
$p->Title = "source";
@ -239,7 +239,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
}
function testRevertToLiveFixesBrokenLinks() {
public function testRevertToLiveFixesBrokenLinks() {
// Create page and virutal page
$p = new Page();
$p->Title = "source";

View File

@ -13,19 +13,19 @@ class SiteTreePermissionsTest extends FunctionalTest {
'SiteTree' => array('SiteTreeSubsites')
);
static function set_up_once() {
static public function set_up_once() {
SiteTreeTest::set_up_once();
parent::set_up_once();
}
static function tear_down_once() {
static public function tear_down_once() {
SiteTreeTest::tear_down_once();
parent::tear_down_once();
}
function setUp() {
public function setUp() {
parent::setUp();
$this->useDraftSite();
@ -35,7 +35,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
}
function testAccessingStageWithBlankStage() {
public function testAccessingStageWithBlankStage() {
$this->useDraftSite(false);
$this->autoFollowRedirection = false;
@ -68,7 +68,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertEquals($response->getStatusCode(), '404');
}
function testPermissionCheckingWorksOnDeletedPages() {
public function testPermissionCheckingWorksOnDeletedPages() {
// Set up fixture - a published page deleted from draft
$this->logInWithPermission("ADMIN");
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
@ -94,7 +94,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertTrue($page->canEdit());
}
function testPermissionCheckingWorksOnUnpublishedPages() {
public function testPermissionCheckingWorksOnUnpublishedPages() {
// Set up fixture - an unpublished page
$this->logInWithPermission("ADMIN");
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
@ -116,7 +116,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertTrue($page->canEdit());
}
function testCanEditOnPageDeletedFromStageAndLiveReturnsFalse() {
public function testCanEditOnPageDeletedFromStageAndLiveReturnsFalse() {
// Find a page that exists and delete it from both stage and published
$this->logInWithPermission("ADMIN");
$page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup');
@ -134,7 +134,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertFalse($page->canEdit());
}
function testCanViewStage() {
public function testCanViewStage() {
$page = $this->objFromFixture('Page', 'standardpage');
$editor = $this->objFromFixture('Member', 'editor');
$websiteuser = $this->objFromFixture('Member', 'websiteuser');
@ -146,7 +146,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertTrue($page->canViewStage('Stage', $editor));
}
function testAccessTabOnlyDisplaysWithGrantAccessPermissions() {
public function testAccessTabOnlyDisplaysWithGrantAccessPermissions() {
$page = $this->objFromFixture('Page', 'standardpage');
$subadminuser = $this->objFromFixture('Member', 'subadmin');
@ -176,7 +176,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', null);
}
function testRestrictedViewLoggedInUsers() {
public function testRestrictedViewLoggedInUsers() {
$page = $this->objFromFixture('Page', 'restrictedViewLoggedInUsers');
// unauthenticated users
@ -208,7 +208,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', null);
}
function testRestrictedViewOnlyTheseUsers() {
public function testRestrictedViewOnlyTheseUsers() {
$page = $this->objFromFixture('Page', 'restrictedViewOnlyWebsiteUsers');
// unauthenticcated users
@ -255,7 +255,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', null);
}
function testRestrictedEditLoggedInUsers() {
public function testRestrictedEditLoggedInUsers() {
$page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers');
// unauthenticcated users
@ -280,7 +280,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
);
}
function testRestrictedEditOnlySubadminGroup() {
public function testRestrictedEditOnlySubadminGroup() {
$page = $this->objFromFixture('Page', 'restrictedEditOnlySubadminGroup');
// unauthenticated users
@ -304,7 +304,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
);
}
function testRestrictedViewInheritance() {
public function testRestrictedViewInheritance() {
$parentPage = $this->objFromFixture('Page', 'parent_restrictedViewOnlySubadminGroup');
$childPage = $this->objFromFixture('Page', 'child_restrictedViewOnlySubadminGroup');
@ -337,7 +337,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', null);
}
function testRestrictedEditInheritance() {
public function testRestrictedEditInheritance() {
$parentPage = $this->objFromFixture('Page', 'parent_restrictedEditOnlySubadminGroup');
$childPage = $this->objFromFixture('Page', 'child_restrictedEditOnlySubadminGroup');
@ -355,7 +355,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
);
}
function testDeleteRestrictedChild() {
public function testDeleteRestrictedChild() {
$parentPage = $this->objFromFixture('Page', 'deleteTestParentPage');
$childPage = $this->objFromFixture('Page', 'deleteTestChildPage');
@ -370,7 +370,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
);
}
function testRestrictedEditLoggedInUsersDeletedFromStage() {
public function testRestrictedEditLoggedInUsersDeletedFromStage() {
$page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers');
$pageID = $page->ID;
@ -391,7 +391,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
);
}
function testInheritCanViewFromSiteConfig() {
public function testInheritCanViewFromSiteConfig() {
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
$siteconfig = $this->objFromFixture('SiteConfig', 'default');
$editor = $this->objFromFixture('Member', 'editor');
@ -416,7 +416,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertFalse($page->canView(FALSE), 'Anonymous can\'t view a page when set to inherit from the SiteConfig, and SiteConfig has canView set to OnlyTheseUsers');
}
function testInheritCanEditFromSiteConfig() {
public function testInheritCanEditFromSiteConfig() {
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
$siteconfig = $this->objFromFixture('SiteConfig', 'default');
$editor = $this->objFromFixture('Member', 'editor');

View File

@ -25,7 +25,7 @@ class SiteTreeTest extends SapphireTest {
*/
static protected $origTranslatableSettings = array();
static function set_up_once() {
static public function set_up_once() {
// needs to recreate the database schema with language properties
self::kill_temp_db();
@ -51,7 +51,7 @@ class SiteTreeTest extends SapphireTest {
parent::set_up_once();
}
static function tear_down_once() {
static public function tear_down_once() {
if(class_exists('Translatable')) {
if(self::$origTranslatableSettings['has_extension']) {
Object::add_extension('SiteTree', 'Translatable');
@ -69,7 +69,7 @@ class SiteTreeTest extends SapphireTest {
parent::tear_down_once();
}
function testCreateDefaultpages() {
public function testCreateDefaultpages() {
$remove = DataObject::get('SiteTree');
if($remove) foreach($remove as $page) $page->delete();
// Make sure the table is empty
@ -97,7 +97,7 @@ class SiteTreeTest extends SapphireTest {
* - Resolves duplicates by appending a number
* - renames classes with a class name conflict
*/
function testURLGeneration() {
public function testURLGeneration() {
$expectedURLs = array(
'home' => 'home',
'staff' => 'my-staff',
@ -121,7 +121,7 @@ class SiteTreeTest extends SapphireTest {
/**
* Test that publication copies data to SiteTree_Live
*/
function testPublishCopiesToLiveTable() {
public function testPublishCopiesToLiveTable() {
$obj = $this->objFromFixture('Page','about');
$obj->publish('Stage', 'Live');
@ -132,7 +132,7 @@ class SiteTreeTest extends SapphireTest {
/**
* Test that field which are set and then cleared are also transferred to the published site.
*/
function testPublishDeletedFields() {
public function testPublishDeletedFields() {
$this->logInWithPermission('ADMIN');
$obj = $this->objFromFixture('Page', 'about');
@ -150,7 +150,7 @@ class SiteTreeTest extends SapphireTest {
}
function testParentNodeCachedInMemory() {
public function testParentNodeCachedInMemory() {
$parent = new SiteTree();
$parent->Title = 'Section Title';
$child = new SiteTree();
@ -161,7 +161,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertEquals("Section Title", $child->Parent->Title);
}
function testParentModelReturnType() {
public function testParentModelReturnType() {
$parent = new SiteTreeTest_PageNode();
$child = new SiteTreeTest_PageNode();
@ -172,7 +172,7 @@ class SiteTreeTest extends SapphireTest {
/**
* Confirm that DataObject::get_one() gets records from SiteTree_Live
*/
function testGetOneFromLive() {
public function testGetOneFromLive() {
$s = new SiteTree();
$s->Title = "V1";
$s->URLSegment = "get-one-test-page";
@ -190,7 +190,7 @@ class SiteTreeTest extends SapphireTest {
Versioned::set_reading_mode($oldMode);
}
function testChidrenOfRootAreTopLevelPages() {
public function testChidrenOfRootAreTopLevelPages() {
$pages = DataObject::get("SiteTree");
foreach($pages as $page) $page->publish('Stage', 'Live');
unset($pages);
@ -215,7 +215,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertNotContains('Staff', $allChildren);
}
function testCanSaveBlankToHasOneRelations() {
public function testCanSaveBlankToHasOneRelations() {
/* DataObject::write() should save to a has_one relationship if you set a field called (relname)ID */
$page = new SiteTree();
$parentID = $this->idFromFixture('Page', 'home');
@ -229,7 +229,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertEquals(0, DB::query("SELECT \"ParentID\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value());
}
function testStageStates() {
public function testStageStates() {
// newly created page
$createdPage = new SiteTree();
$createdPage->write();
@ -279,7 +279,7 @@ class SiteTreeTest extends SapphireTest {
/**
* Test that a page can be completely deleted and restored to the stage site
*/
function testRestoreToStage() {
public function testRestoreToStage() {
$page = $this->objFromFixture('Page', 'about');
$pageID = $page->ID;
$page->delete();
@ -345,7 +345,7 @@ class SiteTreeTest extends SapphireTest {
);
}
function testRelativeLink() {
public function testRelativeLink() {
$about = $this->objFromFixture('Page', 'about');
$staff = $this->objFromFixture('Page', 'staff');
@ -357,7 +357,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertEquals('about-us/tom&jerry', $about->RelativeLink('tom&jerry'), 'Doesnt url encode parameter');
}
function testAbsoluteLiveLink() {
public function testAbsoluteLiveLink() {
$parent = $this->objFromFixture('Page', 'about');
$child = $this->objFromFixture('Page', 'staff');
@ -374,7 +374,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertStringEndsWith('changed-on-live/my-staff/?stage=Live', $child->getAbsoluteLiveLink());
}
function testDeleteFromStageOperatesRecursively() {
public function testDeleteFromStageOperatesRecursively() {
SiteTree::set_enforce_strict_hierarchy(false);
$pageAbout = $this->objFromFixture('Page', 'about');
$pageStaff = $this->objFromFixture('Page', 'staff');
@ -388,7 +388,7 @@ class SiteTreeTest extends SapphireTest {
SiteTree::set_enforce_strict_hierarchy(true);
}
function testDeleteFromStageOperatesRecursivelyStrict() {
public function testDeleteFromStageOperatesRecursivelyStrict() {
$pageAbout = $this->objFromFixture('Page', 'about');
$pageStaff = $this->objFromFixture('Page', 'staff');
$pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate');
@ -400,7 +400,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertFalse(DataObject::get_by_id('Page', $pageStaffDuplicate->ID));
}
function testDeleteFromLiveOperatesRecursively() {
public function testDeleteFromLiveOperatesRecursively() {
SiteTree::set_enforce_strict_hierarchy(false);
$this->logInWithPermission('ADMIN');
@ -424,7 +424,7 @@ class SiteTreeTest extends SapphireTest {
SiteTree::set_enforce_strict_hierarchy(true);
}
function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn() {
public function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn() {
SiteTree::set_enforce_strict_hierarchy(false);
$this->logInWithPermission('ADMIN');
@ -447,7 +447,7 @@ class SiteTreeTest extends SapphireTest {
}
function testDeleteFromLiveOperatesRecursivelyStrict() {
public function testDeleteFromLiveOperatesRecursivelyStrict() {
$this->logInWithPermission('ADMIN');
$pageAbout = $this->objFromFixture('Page', 'about');
@ -471,7 +471,7 @@ class SiteTreeTest extends SapphireTest {
* Simple test to confirm that querying from a particular archive date doesn't throw
* an error
*/
function testReadArchiveDate() {
public function testReadArchiveDate() {
Versioned::reading_archived_date('2009-07-02 14:05:07');
DataObject::get('SiteTree', "\"ParentID\" = 0");
@ -479,7 +479,7 @@ class SiteTreeTest extends SapphireTest {
Versioned::reading_archived_date(null);
}
function testEditPermissions() {
public function testEditPermissions() {
$editor = $this->objFromFixture("Member", "editor");
$home = $this->objFromFixture("Page", "home");
@ -500,7 +500,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertFalse($product4->canEdit($editor));
}
function testEditPermissionsOnDraftVsLive() {
public function testEditPermissionsOnDraftVsLive() {
// Create an inherit-permission page
$page = new Page();
$page->write();
@ -539,7 +539,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertTrue($page->canEdit());
}
function testCompareVersions() {
public function testCompareVersions() {
// Necessary to avoid
$oldCleanerClass = Diff::$html_cleaner_class;
Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner';
@ -565,7 +565,7 @@ class SiteTreeTest extends SapphireTest {
Diff::$html_cleaner_class = $oldCleanerClass;
}
function testAuthorIDAndPublisherIDFilledOutOnPublish() {
public function testAuthorIDAndPublisherIDFilledOutOnPublish() {
// Ensure that we have a member ID who is doing all this work
$member = Member::currentUser();
if($member) {
@ -785,13 +785,13 @@ class SiteTreeTest extends SapphireTest {
}
function testPageTypeClasses() {
public function testPageTypeClasses() {
$classes = SiteTree::page_type_classes();
$this->assertNotContains('SiteTree', $classes, 'Page types do not include base class');
$this->assertContains('Page', $classes, 'Page types do contain subclasses');
}
function testAllowedChildren() {
public function testAllowedChildren() {
$page = new SiteTree();
$this->assertContains(
'VirtualPage',
@ -828,7 +828,7 @@ class SiteTreeTest extends SapphireTest {
);
}
function testAllowedChildrenValidation() {
public function testAllowedChildrenValidation() {
$page = new SiteTree();
$page->write();
$classA = new SiteTreeTest_ClassA();
@ -867,7 +867,7 @@ class SiteTreeTest extends SapphireTest {
$this->assertFalse($valid->valid(), "Doesnt allow child where only parent class is allowed on parent node, and asterisk prefixing is used");
}
function testClassDropdown() {
public function testClassDropdown() {
$sitetree = new SiteTree();
$method = new ReflectionMethod($sitetree, 'getClassDropdown');
$method->setAccessible(true);
@ -884,7 +884,7 @@ class SiteTreeTest extends SapphireTest {
Session::set("loggedInAs", null);
}
function testCanBeRoot() {
public function testCanBeRoot() {
$page = new SiteTree();
$page->ParentID = 0;
$page->write();
@ -902,14 +902,14 @@ class SiteTreeTest extends SapphireTest {
if(!$isDetected) $this->fail('Fails validation with $can_be_root=false');
}
function testModifyStatusFlagByInheritance(){
public function testModifyStatusFlagByInheritance(){
$node = new SiteTreeTest_StageStatusInherit();
$treeTitle = $node->getTreeTitle();
$this->assertContains('InheritedTitle', $treeTitle);
$this->assertContains('inherited-class', $treeTitle);
}
function testMenuTitleIsUnsetWhenEqualsTitle() {
public function testMenuTitleIsUnsetWhenEqualsTitle() {
$page = new SiteTree();
$page->Title = 'orig';
$page->MenuTitle = 'orig';
@ -956,7 +956,7 @@ class SiteTreeTest_Conflicted_Controller extends Page_Controller implements Test
}
class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner {
function cleanHTML($html) {
public function cleanHTML($html) {
return $html;
}
}
@ -992,7 +992,7 @@ class SiteTreeTest_NotRoot extends Page implements TestOnly {
}
class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly {
function getStatusFlags($cached = true){
public function getStatusFlags($cached = true){
$flags = parent::getStatusFlags($cached);
$flags['inherited-class'] = "InheritedTitle";
return $flags;

View File

@ -13,7 +13,7 @@ class VirtualPageTest extends SapphireTest {
'SiteTree' => array('VirtualPageTest_PageExtension')
);
function setUp() {
public function setUp() {
parent::setUp();
$this->origInitiallyCopiedFields = VirtualPage::$initially_copied_fields;
@ -23,7 +23,7 @@ class VirtualPageTest extends SapphireTest {
VirtualPage::$non_virtual_fields[] = 'MySharedNonVirtualField';
}
function tearDown() {
public function tearDown() {
parent::tearDown();
VirtualPage::$initially_copied_fields = $this->origInitiallyCopiedFields;
@ -34,7 +34,7 @@ class VirtualPageTest extends SapphireTest {
* Test that, after you update the source page of a virtual page, all the virtual pages
* are updated
*/
function testEditingSourcePageUpdatesVirtualPages() {
public function testEditingSourcePageUpdatesVirtualPages() {
$master = $this->objFromFixture('Page', 'master');
$master->Title = "New title";
$master->MenuTitle = "New menutitle";
@ -56,7 +56,7 @@ class VirtualPageTest extends SapphireTest {
* Test that, after you publish the source page of a virtual page, all the already published
* virtual pages are published
*/
function testPublishingSourcePagePublishesAlreadyPublishedVirtualPages() {
public function testPublishingSourcePagePublishesAlreadyPublishedVirtualPages() {
$this->logInWithPermission('ADMIN');
$master = $this->objFromFixture('Page', 'master');
@ -93,7 +93,7 @@ class VirtualPageTest extends SapphireTest {
/**
* Test that virtual pages get the content from the master page when they are created.
*/
function testNewVirtualPagesGrabTheContentFromTheirMaster() {
public function testNewVirtualPagesGrabTheContentFromTheirMaster() {
$vp = new VirtualPage();
$vp->write();
@ -115,7 +115,7 @@ class VirtualPageTest extends SapphireTest {
* This means that when you publish them, they should show the published content of the source
* page, not the draft content at the time when you clicked 'publish' in the CMS.
*/
function testPublishingAVirtualPageCopiedPublishedContentNotDraftContent() {
public function testPublishingAVirtualPageCopiedPublishedContentNotDraftContent() {
$p = new Page();
$p->Content = "published content";
$p->write();
@ -140,7 +140,7 @@ class VirtualPageTest extends SapphireTest {
DB::query('SELECT "Content" from "SiteTree_Live" WHERE "ID" = ' . $vp->ID)->value());
}
function testCantPublishVirtualPagesBeforeTheirSource() {
public function testCantPublishVirtualPagesBeforeTheirSource() {
// An unpublished source page
$p = new Page();
$p->Content = "test content";
@ -161,7 +161,7 @@ class VirtualPageTest extends SapphireTest {
$this->assertTrue($vp->canPublish());
}
function testCanDeleteOrphanedVirtualPagesFromLive() {
public function testCanDeleteOrphanedVirtualPagesFromLive() {
// An unpublished source page
$p = new Page();
$p->Content = "test content";
@ -185,7 +185,7 @@ class VirtualPageTest extends SapphireTest {
$this->assertNull(DB::query("SELECT \"ID\" FROM \"SiteTree_Live\" WHERE \"ID\" = $vp->ID")->value());
}
function testVirtualPagesArentInappropriatelyPublished() {
public function testVirtualPagesArentInappropriatelyPublished() {
// Fixture
$p = new Page();
$p->Content = "test content";
@ -237,7 +237,7 @@ class VirtualPageTest extends SapphireTest {
$this->assertFalse($vp->IsModifiedOnStage);
}
function testVirtualPagesCreateVersionRecords() {
public function testVirtualPagesCreateVersionRecords() {
$source = $this->objFromFixture('Page', 'master');
$source->Title = "T0";
$source->write();
@ -275,7 +275,7 @@ class VirtualPageTest extends SapphireTest {
WHERE \"RecordID\" = $vp->ID AND \"Version\" = $liveVersion")->value());
}
function fixVersionNumberCache($page) {
public function fixVersionNumberCache($page) {
$pages = func_get_args();
foreach($pages as $p) {
Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage', array($p->ID));
@ -283,7 +283,7 @@ class VirtualPageTest extends SapphireTest {
}
}
function testUnpublishingSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
public function testUnpublishingSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
// Create page and virutal page
$p = new Page();
$p->Title = "source";
@ -315,7 +315,7 @@ class VirtualPageTest extends SapphireTest {
$this->assertEquals(1, $vp->HasBrokenLink);
}
function testDeletingFromLiveSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
public function testDeletingFromLiveSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() {
// Create page and virutal page
$p = new Page();
$p->Title = "source";
@ -352,7 +352,7 @@ class VirtualPageTest extends SapphireTest {
/**
* Base functionality tested in {@link SiteTreeTest->testAllowedChildrenValidation()}.
*/
function testAllowedChildrenLimitedOnVirtualPages() {
public function testAllowedChildrenLimitedOnVirtualPages() {
$classA = new SiteTreeTest_ClassA();
$classA->write();
$classB = new SiteTreeTest_ClassB();
@ -375,7 +375,7 @@ class VirtualPageTest extends SapphireTest {
$this->assertFalse($valid->valid(), "Doesn't allow child linked to virtual page type disallowed by parent");
}
function testGetVirtualFields() {
public function testGetVirtualFields() {
// Needs association with an original, otherwise will just return the "base" virtual fields
$page = new VirtualPageTest_ClassA();
$page->write();
@ -388,7 +388,7 @@ class VirtualPageTest extends SapphireTest {
$this->assertNotContains('MyInitiallyCopiedField', $virtual->getVirtualFields());
}
function testCopyFrom() {
public function testCopyFrom() {
$original = new VirtualPageTest_ClassA();
$original->MyInitiallyCopiedField = 'original';
$original->MyVirtualField = 'original';
@ -426,7 +426,7 @@ class VirtualPageTest extends SapphireTest {
);
}
function testWriteWithoutVersion() {
public function testWriteWithoutVersion() {
$original = new SiteTree();
$original->write();
// Create a second version (different behaviour),
@ -473,7 +473,7 @@ class VirtualPageTest extends SapphireTest {
);
}
function testCanBeRoot() {
public function testCanBeRoot() {
$page = new SiteTree();
$page->ParentID = 0;
$page->write();
@ -500,7 +500,7 @@ class VirtualPageTest extends SapphireTest {
if(!$isDetected) $this->fail('Fails validation with $can_be_root=false');
}
function testPageTypeChangeDoesntKeepOrphanedVirtualPageRecord() {
public function testPageTypeChangeDoesntKeepOrphanedVirtualPageRecord() {
$page = new SiteTree();
$page->write();
$page->publish('Stage', 'Live');
@ -536,7 +536,7 @@ class VirtualPageTest extends SapphireTest {
);
}
function testPageTypeChangePropagatesToLive() {
public function testPageTypeChangePropagatesToLive() {
$page = new SiteTree();
$page->MySharedNonVirtualField = 'original';
$page->write();

View File

@ -2,7 +2,7 @@
class ReportTest extends SapphireTest {
function testGetReports() {
public function testGetReports() {
$reports = SS_Report::get_reports();
$this->assertNotNull($reports, "Reports returned");
$previousSort = 0;
@ -12,7 +12,7 @@ class ReportTest extends SapphireTest {
}
}
function testExcludeReport() {
public function testExcludeReport() {
$reports = SS_Report::get_reports();
$reportNames = array();
foreach($reports as $report) {
@ -42,7 +42,7 @@ class ReportTest extends SapphireTest {
$this->assertNotContains('ReportTest_FakeTest2',$reportNames,'ReportTest_FakeTest2 is NOT in reports list');
}
function testAbstractClassesAreExcluded() {
public function testAbstractClassesAreExcluded() {
$reports = SS_Report::get_reports();
$reportNames = array();
foreach($reports as $report) {
@ -55,62 +55,62 @@ class ReportTest extends SapphireTest {
}
class ReportTest_FakeTest extends SS_Report implements TestOnly {
function title() {
public function title() {
return 'Report title';
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Page Title"
)
);
}
function sourceRecords($params, $sort, $limit) {
public function sourceRecords($params, $sort, $limit) {
return new ArrayList();
}
function sort() {
public function sort() {
return 100;
}
}
class ReportTest_FakeTest2 extends SS_Report implements TestOnly {
function title() {
public function title() {
return 'Report title 2';
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Page Title 2"
)
);
}
function sourceRecords($params, $sort, $limit) {
public function sourceRecords($params, $sort, $limit) {
return new ArrayList();
}
function sort() {
public function sort() {
return 98;
}
}
abstract class ReportTest_FakeTest_Abstract extends SS_Report implements TestOnly {
function title() {
public function title() {
return 'Report title Abstract';
}
function columns() {
public function columns() {
return array(
"Title" => array(
"title" => "Page Title Abstract"
)
);
}
function sourceRecords($params, $sort, $limit) {
public function sourceRecords($params, $sort, $limit) {
return new ArrayList();
}
function sort() {
public function sort() {
return 5;
}
}

View File

@ -10,7 +10,7 @@ class SideReportTest extends SapphireTest {
static $daysAgo = 14;
function setUp() {
public function setUp() {
parent::setUp();
// set the dates by hand: impossible to set via yml
@ -24,7 +24,7 @@ class SideReportTest extends SapphireTest {
DB::query("UPDATE \"SiteTree\" SET \"Created\"='2009-01-01 00:00:00', \"LastEdited\"='".date('Y-m-d H:i:s', $beforeThreshold)."' WHERE \"ID\"='".$before->ID."'");
}
function testRecentlyEdited() {
public function testRecentlyEdited() {
SS_Datetime::set_mock_now('31-06-2009 00:00:00');
$after = $this->objFromFixture('SiteTree', 'after');

View File

@ -5,7 +5,7 @@ class CMSMainSearchFormTest extends FunctionalTest {
protected $autoFollowRedirection = false;
function testTitleFilter() {
public function testTitleFilter() {
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
$response = $this->get(

View File

@ -14,12 +14,12 @@ class ZZZSearchFormTest extends FunctionalTest {
protected $mockController;
function waitUntilIndexingFinished() {
public function waitUntilIndexingFinished() {
$db = DB::getConn();
if (method_exists($db, 'waitUntilIndexingFinished')) DB::getConn()->waitUntilIndexingFinished();
}
function setUpOnce() {
public function setUpOnce() {
// HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE
// MySQL will need a different table type
self::kill_temp_db();
@ -29,7 +29,7 @@ class ZZZSearchFormTest extends FunctionalTest {
parent::setUpOnce();
}
function setUp() {
public function setUp() {
parent::setUp();
$holderPage = $this->objFromFixture('SiteTree', 'searchformholder');
@ -38,7 +38,7 @@ class ZZZSearchFormTest extends FunctionalTest {
$this->waitUntilIndexingFinished();
}
function testPublishedPagesMatchedByTitle() {
public function testPublishedPagesMatchedByTitle() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
@ -53,7 +53,7 @@ class ZZZSearchFormTest extends FunctionalTest {
);
}
function testDoubleQuotesPublishedPagesMatchedByTitle() {
public function testDoubleQuotesPublishedPagesMatchedByTitle() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
@ -71,7 +71,7 @@ class ZZZSearchFormTest extends FunctionalTest {
}
/*
function testUnpublishedPagesNotIncluded() {
public function testUnpublishedPagesNotIncluded() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$results = $sf->getResults(null, array('Search'=>'publicUnpublishedPage'));
@ -84,7 +84,7 @@ class ZZZSearchFormTest extends FunctionalTest {
}
*/
function testPagesRestrictedToLoggedinUsersNotIncluded() {
public function testPagesRestrictedToLoggedinUsersNotIncluded() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'restrictedViewLoggedInUsers');
@ -106,7 +106,7 @@ class ZZZSearchFormTest extends FunctionalTest {
$member->logOut();
}
function testPagesRestrictedToSpecificGroupNotIncluded() {
public function testPagesRestrictedToSpecificGroupNotIncluded() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'restrictedViewOnlyWebsiteUsers');
@ -138,7 +138,7 @@ class ZZZSearchFormTest extends FunctionalTest {
$member->logOut();
}
function testInheritedRestrictedPagesNotInlucded() {
public function testInheritedRestrictedPagesNotInlucded() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'inheritRestrictedView');
@ -161,7 +161,7 @@ class ZZZSearchFormTest extends FunctionalTest {
$member->logOut();
}
function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
public function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
@ -173,7 +173,7 @@ class ZZZSearchFormTest extends FunctionalTest {
);
}
function testDisabledShowInSearchFlagNotIncludedForFiles() {
public function testDisabledShowInSearchFlagNotIncludedForFiles() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile');
@ -193,7 +193,7 @@ class ZZZSearchFormTest extends FunctionalTest {
);
}
function testSearchTitleAndContentWithSpecialCharacters() {
public function testSearchTitleAndContentWithSpecialCharacters() {
$sf = new SearchForm($this->mockController, 'SearchForm');
$pageWithSpecialChars = $this->objFromFixture('SiteTree', 'pageWithSpecialChars');

View File

@ -11,7 +11,7 @@ class FilesystemPublisherTest extends SapphireTest {
protected $orig = array();
function setUp() {
public function setUp() {
parent::setUp();
Object::add_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
@ -20,7 +20,7 @@ class FilesystemPublisherTest extends SapphireTest {
FilesystemPublisher::$domain_based_caching = false;
}
function tearDown() {
public function tearDown() {
parent::tearDown();
Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
@ -32,7 +32,7 @@ class FilesystemPublisherTest extends SapphireTest {
}
}
function testUrlsToPathsWithRelativeUrls() {
public function testUrlsToPathsWithRelativeUrls() {
$fsp = new FilesystemPublisher('.', 'html');
$this->assertEquals(
@ -54,7 +54,7 @@ class FilesystemPublisherTest extends SapphireTest {
);
}
function testUrlsToPathsWithAbsoluteUrls() {
public function testUrlsToPathsWithAbsoluteUrls() {
$fsp = new FilesystemPublisher('.', 'html');
$url = Director::absoluteBaseUrl();
@ -79,7 +79,7 @@ class FilesystemPublisherTest extends SapphireTest {
);
}
function testUrlsToPathsWithDomainBasedCaching() {
public function testUrlsToPathsWithDomainBasedCaching() {
$origDomainBasedCaching = FilesystemPublisher::$domain_based_caching;
FilesystemPublisher::$domain_based_caching = true;
@ -120,7 +120,7 @@ class FilesystemPublisherTest extends SapphireTest {
* is where extension instances are set up and subsequently used by
* {@link DataObject::defineMethods()}.
*/
function testHasCalledParentConstructor() {
public function testHasCalledParentConstructor() {
$fsp = new FilesystemPublisher('.', '.html');
$this->assertEquals($fsp->class, 'FilesystemPublisher');
}
@ -129,7 +129,7 @@ class FilesystemPublisherTest extends SapphireTest {
* These are a few simple tests to check that we will be retrieving the correct theme when we need it
* StaticPublishing needs to be able to retrieve a non-null theme at the time publishPages() is called.
*/
function testStaticPublisherTheme(){
public function testStaticPublisherTheme(){
//This will be the name of the default theme of this particular project
$default_theme=SSViewer::current_theme();

View File

@ -36,7 +36,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest {
static $use_draft_site = false;
function setUp() {
public function setUp() {
parent::setUp();
$parent1_published = $this->objFromFixture('Page', 'parent1_published');
@ -75,7 +75,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest {
$child2_1_published_orphaned->publish('Stage', 'Live');
}
function testGetOrphansByStage() {
public function testGetOrphansByStage() {
// all orphans
$child1_3_orphaned = $this->objFromFixture('Page', 'child1_3_orphaned');
$child1_4_orphaned_published = $this->objFromFixture('Page', 'child1_4_orphaned_published');

View File

@ -43,7 +43,7 @@
// Modified by: Silverstripe Ltd. (changed naming of file-input-elements)
function ObservableObject() {
public function ObservableObject() {
this.functions = [];
}
ObservableObject.prototype = {
@ -63,7 +63,7 @@ ObservableObject.prototype = {
var MultiSelectorObserver = new ObservableObject();
function MultiSelector( list_target, max, upload_button ){
public function MultiSelector( list_target, max, upload_button ){
this.upload_button = upload_button;
this.upload_button.setAttribute("disabled", "disabled");