Merge pull request #1633 from sminnee/no-class-property

FIX: Remove references to Object::$class
This commit is contained in:
Daniel Hensby 2016-09-27 11:45:49 +01:00 committed by GitHub
commit 47d066a0a0
4 changed files with 12 additions and 12 deletions

View File

@ -314,7 +314,7 @@ class CMSPageHistoryController extends CMSMain {
return $this->customise(array( return $this->customise(array(
"EditForm" => $form "EditForm" => $form
))->renderWith(array( ))->renderWith(array(
$this->class . '_EditForm', get_class($this) . '_EditForm',
'LeftAndMain_Content' 'LeftAndMain_Content'
)); ));
} }
@ -352,7 +352,7 @@ class CMSPageHistoryController extends CMSMain {
return $this->customise(array( return $this->customise(array(
"EditForm" => $this->ShowVersionForm($versionID) "EditForm" => $this->ShowVersionForm($versionID)
))->renderWith(array( ))->renderWith(array(
$this->class . '_EditForm', get_class($this) . '_EditForm',
'LeftAndMain_Content' 'LeftAndMain_Content'
)); ));
} }

View File

@ -141,7 +141,7 @@ class ModelAsController extends Controller implements NestedController {
if(class_exists('Translatable') && $sitetree->Locale) Translatable::set_current_locale($sitetree->Locale); if(class_exists('Translatable') && $sitetree->Locale) Translatable::set_current_locale($sitetree->Locale);
if(isset($_REQUEST['debug'])) { if(isset($_REQUEST['debug'])) {
Debug::message("Using record #$sitetree->ID of type $sitetree->class with link {$sitetree->Link()}"); Debug::message("Using record #$sitetree->ID of type " . get_class($sitetree) . " with link {$sitetree->Link()}");
} }
return self::controller_for($sitetree, $this->getRequest()->param('Action')); return self::controller_for($sitetree, $this->getRequest()->param('Action'));

View File

@ -122,7 +122,7 @@ class ErrorPage extends Page {
parent::requireDefaultRecords(); parent::requireDefaultRecords();
// Only run on ErrorPage class directly, not subclasses // Only run on ErrorPage class directly, not subclasses
if ($this->class !== 'SilverStripe\\CMS\\Model\\ErrorPage' || !SiteTree::config()->create_default_pages) { if (get_class($this) !== 'SilverStripe\\CMS\\Model\\ErrorPage' || !SiteTree::config()->create_default_pages) {
return; return;
} }

View File

@ -1513,7 +1513,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
parent::requireDefaultRecords(); parent::requireDefaultRecords();
// default pages // default pages
if($this->class == __CLASS__ && $this->config()->create_default_pages) { if(get_class($this) == __CLASS__ && $this->config()->create_default_pages) {
if(!SiteTree::get_by_link(RootURLController::config()->default_homepage_link)) { if(!SiteTree::get_by_link(RootURLController::config()->default_homepage_link)) {
$homepage = new Page(); $homepage = new Page();
$homepage->Title = _t('SiteTree.DEFAULTHOMETITLE', 'Home'); $homepage->Title = _t('SiteTree.DEFAULTHOMETITLE', 'Home');
@ -2160,7 +2160,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return array * @return array
*/ */
public function fieldLabels($includerelations = true) { public function fieldLabels($includerelations = true) {
$cacheKey = $this->class . '_' . $includerelations; $cacheKey = get_class($this) . '_' . $includerelations;
if(!isset(self::$_cache_field_labels[$cacheKey])) { if(!isset(self::$_cache_field_labels[$cacheKey])) {
$labels = parent::fieldLabels($includerelations); $labels = parent::fieldLabels($includerelations);
$labels['Title'] = _t('SiteTree.PAGETITLE', "Page name"); $labels['Title'] = _t('SiteTree.PAGETITLE', "Page name");
@ -2244,7 +2244,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$moreOptions->push(AddToCampaignHandler_FormAction::create()); $moreOptions->push(AddToCampaignHandler_FormAction::create());
// "readonly"/viewing version that isn't the current version of the record // "readonly"/viewing version that isn't the current version of the record
$stageOrLiveRecord = Versioned::get_one_by_stage($this->class, Versioned::get_stage(), array( $stageOrLiveRecord = Versioned::get_one_by_stage(get_class($this), Versioned::get_stage(), array(
'"SiteTree"."ID"' => $this->ID '"SiteTree"."ID"' => $this->ID
)); ));
if($stageOrLiveRecord && $stageOrLiveRecord->Version != $this->Version) { if($stageOrLiveRecord && $stageOrLiveRecord->Version != $this->Version) {
@ -2722,7 +2722,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$controller = ContentController::class; $controller = ContentController::class;
//go through the ancestry for this class looking for //go through the ancestry for this class looking for
$ancestry = ClassInfo::ancestry($this->class); $ancestry = ClassInfo::ancestry(get_class($this));
// loop over the array going from the deepest descendant (ie: the current class) to SiteTree // loop over the array going from the deepest descendant (ie: the current class) to SiteTree
while ($class = array_pop($ancestry)) { while ($class = array_pop($ancestry)) {
//we don't need to go any deeper than the SiteTree class //we don't need to go any deeper than the SiteTree class
@ -2746,7 +2746,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return string * @return string
*/ */
public function CMSTreeClasses($numChildrenMethod="numChildren") { public function CMSTreeClasses($numChildrenMethod="numChildren") {
$classes = sprintf('class-%s', $this->class); $classes = sprintf('class-%s', get_class($this));
if($this->HasBrokenFile || $this->HasBrokenLink) { if($this->HasBrokenFile || $this->HasBrokenLink) {
$classes .= " BrokenLink"; $classes .= " BrokenLink";
} }
@ -2897,9 +2897,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// Convert 'Page' to 'SiteTree' for correct localization lookups // Convert 'Page' to 'SiteTree' for correct localization lookups
/** @skipUpgrade */ /** @skipUpgrade */
// @todo When we namespace translations, change 'SiteTree' to FQN of the class // @todo When we namespace translations, change 'SiteTree' to FQN of the class
$class = ($this->class == 'Page' || $this->class === __CLASS__) $class = (get_class($this) == 'Page' || get_class($this) === __CLASS__)
? 'SiteTree' ? 'SiteTree'
: $this->class; : get_class($this);
return _t($class.'.SINGULARNAME', $this->singular_name()); return _t($class.'.SINGULARNAME', $this->singular_name());
} }
@ -2915,7 +2915,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR; if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR;
if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = CMS_DIR; if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = CMS_DIR;
$entities[$this->class . '.DESCRIPTION'] = array( $entities[get_class($this) . '.DESCRIPTION'] = array(
$this->stat('description'), $this->stat('description'),
'Description of the page type (shown in the "add page" dialog)' 'Description of the page type (shown in the "add page" dialog)'
); );