NEW Add php 7.2 support

This commit is contained in:
Daniel Hensby 2017-11-30 17:49:46 +00:00
parent ae130bff23
commit 9103816333
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
102 changed files with 230 additions and 215 deletions

View File

@ -12,6 +12,8 @@ addons:
matrix:
include:
- php: 7.2
env: DB=MYSQL PDO=1
- php: 5.3
env: DB=MYSQL
- php: 5.4

View File

@ -23,8 +23,8 @@
*
* Overload both of these to support legacy code.
*/
Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
Object::useCustomClass('Datetime', 'SS_Datetime', true);
SS_Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
SS_Object::useCustomClass('Datetime', 'SS_Datetime', true);
/**
* The root directory of TinyMCE

View File

@ -13,7 +13,7 @@
* @package framework
* @subpackage admin
*/
abstract class CMSBatchAction extends Object {
abstract class CMSBatchAction extends SS_Object {
protected $managedClass = 'SiteTree';

View File

@ -15,7 +15,7 @@
* @package framework
* @subpackage admin
*/
class CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider {
class CMSMenu extends SS_Object implements IteratorAggregate, i18nEntityProvider {
/**
* An array of changes to be made to the menu items, in the order that the changes should be

View File

@ -11,7 +11,7 @@
* @package framework
* @subpackage admin
*/
class CMSMenuItem extends Object {
class CMSMenuItem extends SS_Object {
/**
* The (translated) menu title

View File

@ -1891,7 +1891,7 @@ class LeftAndMain_TreeNode extends ViewableData {
/**
* Object represented by this node
*
* @var Object
* @var SS_Object
*/
protected $obj;
@ -1924,7 +1924,7 @@ class LeftAndMain_TreeNode extends ViewableData {
protected $filter;
/**
* @param Object $obj
* @param SS_Object $obj
* @param string $link
* @param bool $isCurrent
* @param string $numChildrenMethod

View File

@ -201,9 +201,9 @@ abstract class ModelAdmin extends LeftAndMain {
$form = new Form($this, "SearchForm",
$context->getSearchFields(),
new FieldList(
Object::create('FormAction', 'search', _t('MemberTableField.APPLY_FILTER', 'Apply Filter'))
SS_Object::create('FormAction', 'search', _t('MemberTableField.APPLY_FILTER', 'Apply Filter'))
->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive'),
Object::create('ResetFormAction','clearsearch', _t('ModelAdmin.RESET','Reset'))
SS_Object::create('ResetFormAction','clearsearch', _t('ModelAdmin.RESET','Reset'))
->setUseButtonTag(true)
),
new RequiredFields()

View File

@ -6,7 +6,7 @@
* @package framework
* @subpackage formatters
*/
abstract class DataFormatter extends Object {
abstract class DataFormatter extends SS_Object {
/**
* Set priority from 0-100.

View File

@ -54,7 +54,7 @@ class XMLDataFormatter extends DataFormatter {
$fieldValue = $obj->obj($fieldName)->forTemplate();
if(!mb_check_encoding($fieldValue,'utf-8')) $fieldValue = "(data is badly encoded)";
if(is_object($fieldValue) && is_subclass_of($fieldValue, 'Object') && $fieldValue->hasMethod('toXML')) {
if(is_object($fieldValue) && is_subclass_of($fieldValue, 'SS_Object') && $fieldValue->hasMethod('toXML')) {
$xml .= $fieldValue->toXML();
} else {
if('HTMLText' == $fieldType) {

View File

@ -16,7 +16,7 @@
}
],
"require": {
"php": ">= 5.3.3, <7.2",
"php": "^5.3.3 || ^7",
"composer/installers": "~1.0",
"mustangostang/spyc": "^0.6.2"
},
@ -40,7 +40,7 @@
"thirdparty/php-peg", "thirdparty/simpletest", "thirdparty/zend_translate_railsyaml"
],
"exclude-from-classmap": [
"view/SSTemplateParser.php.inc", "dev/phpunit/PhpUnitWrapper.php", "model/fieldtypes/compat"
"view/SSTemplateParser.php.inc", "dev/phpunit/PhpUnitWrapper.php", "model/fieldtypes/compat", "core/compat"
]
}
}

View File

@ -26,7 +26,7 @@
* devs might know what they're doing and don't want contentnegotiator messing with their HTML4 doctypes,
* but still find it useful to have self-closing tags removed.
*/
class ContentNegotiator extends Object {
class ContentNegotiator extends SS_Object {
/**
* @config

View File

@ -165,7 +165,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
$this->setResponse($response);
} else {
if($body instanceof Object && $body->hasMethod('getViewer')) {
if($body instanceof SS_Object && $body->hasMethod('getViewer')) {
if(isset($_REQUEST['debug_request'])) {
Debug::message("Request handler $body->class object to $this->class controller;"
. "rendering with template returned by $body->class::getViewer()");

View File

@ -422,7 +422,7 @@ class RequestHandler extends ViewableData {
$isAllowed = true;
} elseif(substr($test, 0, 2) == '->') {
// Determined by custom method with "->" prefix
list($method, $arguments) = Object::parse_class_spec(substr($test, 2));
list($method, $arguments) = SS_Object::parse_class_spec(substr($test, 2));
$isAllowed = call_user_func_array(array($this, $method), $arguments);
} else {
// Value is a permission code to check the current member against

View File

@ -16,7 +16,7 @@ interface AfterCallAspect {
/**
* Call this aspect after a method is executed
*
* @param object $proxied
* @param SS_Object $proxied
* The object having the method called upon it.
* @param string $method
* The name of the method being called

View File

@ -14,7 +14,7 @@ interface BeforeCallAspect {
/**
* Call this aspect before a method is executed
*
* @param object $proxied
* @param SS_Object $proxied
* The object having the method called upon it.
* @param string $method
* The name of the method being called

View File

@ -356,7 +356,7 @@ class Injector {
*
* @param string $property
* the name of the property
* @param object $object
* @param SS_Object $object
* the object to be set
*/
public function addAutoProperty($property, $object) {
@ -585,7 +585,7 @@ class Injector {
* into them, so we can update that binding at a later point if needbe (ie
* if the managed service changes)
*
* @param object $object
* @param SS_Object $object
* The object to inject
* @param string $asType
* The ID this item was loaded as. This is so that the property configuration
@ -694,7 +694,7 @@ class Injector {
/**
* Helper to set a property's value
*
* @param object $object
* @param SS_Object $object
* Set an object's property to a specific value
* @param string $name
* The name of the property to set

View File

@ -9,7 +9,7 @@ use SilverStripe\Framework\Injector\Factory;
class SilverStripeInjectionCreator implements Factory {
public function create($class, array $params = array()) {
$class = Object::getCustomClass($class);
$class = SS_Object::getCustomClass($class);
$reflector = new ReflectionClass($class);
return $params ? $reflector->newInstanceArgs($params) : $reflector->newInstance();

View File

@ -76,7 +76,7 @@ class ClassInfo {
* Returns an array of the current class and all its ancestors and children
* which require a DB table.
*
* @param string|object $class
* @param string|SS_Object $class
* @todo Move this into data object
* @return array
*/
@ -103,7 +103,7 @@ class ClassInfo {
* Returns the root class (the first to extend from DataObject) for the
* passed class.
*
* @param string|object $class
* @param string|SS_Object $class
* @return string
*/
public static function baseDataClass($class) {
@ -162,7 +162,7 @@ class ClassInfo {
*
* eg: self::class_name('dataobJEct'); //returns 'DataObject'
*
* @param string|object $nameOrObject The classname or object you want to normalise
* @param string|SS_Object $nameOrObject The classname or object you want to normalise
*
* @return string The normalised class name
*/

View File

@ -77,7 +77,7 @@ class Config {
* A marker instance for the "anything" singleton value. Don't access
* directly, even in-class, always use self::anything()
*
* @var Object
* @var SS_Object
*/
private static $_anything = null;
@ -85,7 +85,7 @@ class Config {
* Get a marker class instance that is used to do a "remove anything with
* this key" by adding $key => Config::anything() to the suppress array
*
* @return Object
* @return SS_Object
*/
public static function anything() {
if (self::$_anything === null) {
@ -515,7 +515,7 @@ class Config {
if (($sourceOptions & self::EXCLUDE_EXTRA_SOURCES) != self::EXCLUDE_EXTRA_SOURCES) {
// If we don't have a fresh list of extra sources, get it from the class itself
if (!array_key_exists($class, $this->extraConfigSources)) {
$this->extraConfigSources[$class] = Object::get_extra_config_sources($class);
$this->extraConfigSources[$class] = SS_Object::get_extra_config_sources($class);
}
// Update $sources with any extra sources

View File

@ -214,7 +214,7 @@ class Convert {
* Convert a JSON encoded string into an object.
*
* @param string $val
* @return object|boolean
* @return SS_Object|boolean
*/
public static function json2obj($val) {
return json_decode($val);

View File

@ -158,7 +158,7 @@ Debug::loadErrorHandlers();
* data (e.g. the custom SilverStripe static handling).
*
* @param string $className
* @return Object
* @return SS_Object
*/
function singleton($className) {
if($className == "Config") user_error("Don't pass Config to singleton()", E_USER_ERROR);

View File

@ -549,7 +549,7 @@ class Diff
*
* $diff = new Diff($lines1, $lines2);
* $rev = $diff->reverse();
* @return object A Diff object representing the inverse of the
* @return SS_Object A Diff object representing the inverse of the
* original diff.
*/
public function reverse () {
@ -665,7 +665,7 @@ class Diff
* by passing through DomDocument::loadHTML and saveXML
*
* @param string $content HTML content
* @param object $cleaner Optional instance of a HTMLCleaner class to
* @param SS_Object $cleaner Optional instance of a HTMLCleaner class to
* use, overriding self::$html_cleaner_class
*/
public static function cleanHTML($content, $cleaner=null) {

View File

@ -21,7 +21,7 @@ abstract class Extension {
/**
* The object this extension is applied to.
*
* @var Object
* @var SS_Object
*/
protected $owner;
@ -55,7 +55,7 @@ abstract class Extension {
/**
* Set the owner of this extension.
* @param Object $owner The owner object,
* @param SS_Object $owner The owner object,
* @param string $ownerBaseClass The base class that the extension is applied to; this may be
* the class of owner, or it may be a parent. For example, if Versioned was applied to SiteTree,
* and then a Page object was instantiated, $owner would be a Page object, but $ownerBaseClass
@ -78,7 +78,7 @@ abstract class Extension {
/**
* Returns the owner of this extension.
*
* @return Object
* @return SS_Object
*/
public function getOwner() {
return $this->owner;

View File

@ -7,7 +7,7 @@
/**
* Base class for HTML cleaning implementations.
*/
abstract class HTMLCleaner extends Object {
abstract class HTMLCleaner extends SS_Object {
/**
* @var array

24
core/Object.php Executable file → Normal file
View File

@ -14,7 +14,7 @@
* @package framework
* @subpackage core
*/
abstract class Object {
abstract class SS_Object {
/**
* An array of extension names and parameters to be applied to this object upon construction.
@ -135,7 +135,7 @@ abstract class Object {
// Class to create should be the calling class if not Object,
// otherwise the first parameter
$class = get_called_class();
if($class == 'Object') $class = array_shift($args);
if($class == 'SS_Object' || $class == 'Object') $class = array_shift($args);
$class = self::getCustomClass($class);
@ -158,7 +158,7 @@ abstract class Object {
// Singleton to create should be the calling class if not Object,
// otherwise the first parameter
$class = get_called_class();
if($class === 'Object') $class = array_shift($args);
if($class === 'SS_Object') $class = array_shift($args);
return Injector::inst()->get($class);
}
@ -192,8 +192,8 @@ abstract class Object {
// an $extension value can contain parameters as a string,
// e.g. "Versioned('Stage','Live')"
if(strpos($classSpec,'(') === false) {
if($firstArg === null) self::$_cache_inst_args[$classSpec.$firstArg] = Object::create($classSpec);
else self::$_cache_inst_args[$classSpec.$firstArg] = Object::create($classSpec, $firstArg);
if($firstArg === null) self::$_cache_inst_args[$classSpec.$firstArg] = SS_Object::create($classSpec);
else self::$_cache_inst_args[$classSpec.$firstArg] = SS_Object::create($classSpec, $firstArg);
} else {
list($class, $args) = self::parse_class_spec($classSpec);
@ -201,7 +201,7 @@ abstract class Object {
if($firstArg !== null) array_unshift($args, $firstArg);
array_unshift($args, $class);
self::$_cache_inst_args[$classSpec.$firstArg] = call_user_func_array(array('Object','create'), $args);
self::$_cache_inst_args[$classSpec.$firstArg] = call_user_func_array(array('SS_Object','create'), $args);
}
}
@ -394,7 +394,7 @@ abstract class Object {
* defined
*/
public static function static_lookup($class, $name, $default = null) {
if (is_subclass_of($class, 'Object')) {
if (is_subclass_of($class, 'SS_Object')) {
if (isset($class::$$name)) {
$parent = get_parent_class($class);
if (!$parent || !isset($parent::$$name) || $parent::$$name !== $class::$$name) return $class::$$name;
@ -653,7 +653,7 @@ abstract class Object {
// --------------------------------------------------------------------------------------------------------------
private static $unextendable_classes = array('Object', 'ViewableData', 'RequestHandler');
private static $unextendable_classes = array('SS_Object', 'ViewableData', 'RequestHandler');
static public function get_extra_config_sources($class = null) {
if($class === null) $class = get_called_class();
@ -840,7 +840,7 @@ abstract class Object {
}
/**
* @param object $extension
* @param SS_Object $extension
* @return array
*/
protected function findMethodsFromExtension($extension) {
@ -957,21 +957,21 @@ abstract class Object {
// --------------------------------------------------------------------------------------------------------------
/**
* @see Object::get_static()
* @see SS_Object::get_static()
*/
public function stat($name, $uncached = false) {
return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::FIRST_SET);
}
/**
* @see Object::set_static()
* @see SS_Object::set_static()
*/
public function set_stat($name, $value) {
Config::inst()->update(($this->class ? $this->class : get_class($this)), $name, $value);
}
/**
* @see Object::uninherited_static()
* @see SS_Object::uninherited_static()
*/
public function uninherited($name) {
return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::UNINHERITED);

5
core/compat/Object.php Normal file
View File

@ -0,0 +1,5 @@
<?php
abstract class Object extends SS_Object
{
}

View File

@ -211,7 +211,7 @@ class SS_ClassManifest {
* Returns an array containing all the descendants (direct and indirect)
* of a class.
*
* @param string|object $class
* @param string|SS_Object $class
* @return array
*/
public function getDescendantsOf($class) {

View File

@ -91,7 +91,7 @@ class SS_ConfigStaticManifest {
protected $statics;
static protected $initial_classes = array(
'Object', 'ViewableData', 'Injector', 'Director'
'SS_Object', 'ViewableData', 'Injector', 'Director'
);
/**

View File

@ -131,7 +131,7 @@ class SS_Backtrace {
* Return the full function name. If showArgs is set to true, a string representation of the arguments will be
* shown
*
* @param Object $item
* @param SS_Object $item
* @param boolean $showArg
* @param Int $argCharLimit
* @return String

View File

@ -10,7 +10,7 @@
* @package framework
* @subpackage dev
*/
abstract class BuildTask extends Object {
abstract class BuildTask extends SS_Object {
/**
* Set a custom url segment (to follow dev/tasks/)

View File

@ -256,7 +256,7 @@ abstract class BulkLoader extends ViewableData {
* @subpackage bulkloading
* @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com)
*/
class BulkLoader_Result extends Object {
class BulkLoader_Result extends SS_Object {
/**
* @var array Stores a map of ID and ClassNames

View File

@ -18,7 +18,7 @@
* @package framework
* @subpackage core
*/
class CSSContentParser extends Object {
class CSSContentParser extends SS_Object {
protected $simpleXML = null;
public function __construct($content) {

View File

@ -26,7 +26,7 @@
* @package framework
* @subpackage bulkloading
*/
class CSVParser extends Object implements Iterator {
class CSVParser extends SS_Object implements Iterator {
/**
* @var string $filename

View File

@ -6,7 +6,7 @@
* @package framework
* @subpackage dev
*/
class SS_Cli extends Object {
class SS_Cli extends SS_Object {
/**
* Returns true if the current STDOUT supports the use of colour control codes.
*/

View File

@ -11,7 +11,7 @@
* @package framework
* @subpackage dev
*/
class DebugView extends Object {
class DebugView extends SS_Object {
/**
* Column size to wrap long strings to
@ -215,7 +215,7 @@ class DebugView extends Object {
/**
* Outputs a variable in a user presentable way
*
* @param object $val
* @param SS_Object $val
* @param array $caller Caller information
*/
public function writeVariable($val, $caller) {

View File

@ -61,7 +61,7 @@ class SS_Log {
/**
* @see SS_Log::get_logger()
* @var object
* @var SS_Object
*/
protected static $logger;
@ -86,7 +86,7 @@ class SS_Log {
/**
* Get the logger currently in use, or create a new one if it doesn't exist.
*
* @return object
* @return SS_Object
*/
public static function get_logger() {
if(!static::$logger) {
@ -122,7 +122,7 @@ class SS_Log {
/**
* Remove a writer instance from the logger.
* @param object $writer Zend_Log_Writer_Abstract instance
* @param SS_Object $writer Zend_Log_Writer_Abstract instance
*/
public static function remove_writer($writer) {
static::get_logger()->removeWriter($writer);
@ -130,7 +130,7 @@ class SS_Log {
/**
* Add a writer instance to the logger.
* @param object $writer Zend_Log_Writer_Abstract instance
* @param SS_Object $writer Zend_Log_Writer_Abstract instance
* @param const $priority Priority. Possible values: SS_Log::ERR, SS_Log::WARN or SS_Log::NOTICE
* @param $comparison Priority comparison operator. Acts on the integer values of the error
* levels, where more serious errors are lower numbers. By default this is "=", which means only

View File

@ -65,7 +65,7 @@
*
* @see http://code.google.com/p/spyc/
*/
class YamlFixture extends Object {
class YamlFixture extends SS_Object {
/**
* Absolute path to the .yml fixture file

View File

@ -23,7 +23,7 @@ class SS_ZendLog extends Zend_Log {
/**
* Remove a writer instance that exists in this logger.
* @param object Zend_Log_Writer_Abstract instance
* @param SS_Object Zend_Log_Writer_Abstract instance
*/
public function removeWriter($writer) {
foreach($this->_writers as $index => $existingWriter) {

View File

@ -7,7 +7,7 @@
* @package framework
* @subpackage email
*/
class Mailer extends Object {
class Mailer extends SS_Object {
/**
* Default encoding type for messages. Available options are:

View File

@ -185,7 +185,7 @@ class File extends DataObject {
* Replace "[file_link id=n]" shortcode with an anchor tag or link to the file.
* @param $arguments array Arguments to the shortcode
* @param $content string Content of the returned link (optional)
* @param $parser object Specify a parser to parse the content (see {@link ShortCodeParser})
* @param $parser SS_Object Specify a parser to parse the content (see {@link ShortCodeParser})
* @return string anchor HTML tag if content argument given, otherwise file path link
*/
public static function link_shortcode_handler($arguments, $content = null, $parser = null) {

View File

@ -70,7 +70,7 @@ class SS_FileFinder {
// We build our options array ourselves, because possibly no class or config manifest exists at this point
do {
$this->options = array_merge(Object::static_lookup($class, 'default_options'), $this->options);
$this->options = array_merge(SS_Object::static_lookup($class, 'default_options'), $this->options);
}
while ($class = get_parent_class($class));
}

View File

@ -27,7 +27,7 @@
*
* See {@link URLSegmentFilter} for a more generic implementation.
*/
class FileNameFilter extends Object {
class FileNameFilter extends SS_Object {
/**
* @config

View File

@ -5,7 +5,7 @@
* @package framework
* @subpackage filesystem
*/
class Filesystem extends Object {
class Filesystem extends SS_Object {
/**
* @config

View File

@ -4,7 +4,7 @@
* @package framework
* @subpackage filesystem
*/
class GDBackend extends Object implements Image_Backend {
class GDBackend extends SS_Object implements Image_Backend {
protected $gd, $width, $height;
protected $quality;
protected $interlace;

View File

@ -102,7 +102,7 @@ class Upload extends Controller {
* Set a different instance than {@link Upload_Validator}
* for this upload session.
*
* @param object $validator
* @param SS_Object $validator
*/
public function setValidator($validator) {
$this->validator = $validator;

View File

@ -58,7 +58,7 @@ class CompositeField extends FormField {
// Skipping FormField::__construct(), but we have to make sure this
// doesn't count as a broken constructor
$this->brokenOnConstruct = false;
Object::__construct();
SS_Object::__construct();
}
/**

View File

@ -514,7 +514,7 @@ class DateField_Disabled extends DateField {
* @package framework
* @subpackage forms
*/
class DateField_View_JQuery extends Object {
class DateField_View_JQuery extends SS_Object {
protected $field;

View File

@ -115,7 +115,7 @@ class FileField extends FormField {
// assume that the file is connected via a has-one
$hasOnes = $record->hasOne($this->name);
// try to create a file matching the relation
$file = (is_string($hasOnes)) ? Object::create($hasOnes) : new $fileClass();
$file = (is_string($hasOnes)) ? SS_Object::create($hasOnes) : new $fileClass();
} else if($record instanceof File) {
$file = $record;
} else {

View File

@ -7,7 +7,7 @@
* @uses DBField::scaffoldFormField()
* @uses DataObject::fieldLabels()
*/
class FormScaffolder extends Object {
class FormScaffolder extends SS_Object {
/**
* @var DataObject $obj The object defining the fields to be scaffolded
@ -131,7 +131,7 @@ class FormScaffolder extends Object {
$fieldClass = (isset($this->fieldClasses[$relationship]))
? $this->fieldClasses[$relationship]
: 'GridField';
$grid = Object::create($fieldClass,
$grid = SS_Object::create($fieldClass,
$relationship,
$this->obj->fieldLabel($relationship),
$this->obj->$relationship(),
@ -160,7 +160,7 @@ class FormScaffolder extends Object {
? $this->fieldClasses[$relationship]
: 'GridField';
$grid = Object::create($fieldClass,
$grid = SS_Object::create($fieldClass,
$relationship,
$this->obj->fieldLabel($relationship),
$this->obj->$relationship(),

View File

@ -13,7 +13,7 @@
* @package forms
* @subpackage transformations
*/
class FormTransformation extends Object {
class FormTransformation extends SS_Object {
public function transform(FormField $field) {
// Look for a performXXTransformation() method on the field itself.
// performReadonlyTransformation() is a pretty commonly applied method.

View File

@ -367,7 +367,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$fromWeb->addExtraClass('content ss-uploadfield');
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
$computerUploadField = Object::create('UploadField', 'AssetUploadField', '');
$computerUploadField = SS_Object::create('UploadField', 'AssetUploadField', '');
$computerUploadField->setConfig('previewMaxWidth', 40);
$computerUploadField->setConfig('previewMaxHeight', 30);
$computerUploadField->addExtraClass('ss-assetuploadfield');

View File

@ -1113,7 +1113,7 @@ class UploadField extends FileField {
// to default if there is no automatic relation
if ($relationClass = $this->getRelationAutosetClass(null)) {
// Create new object explicitly. Otherwise rely on Upload::load to choose the class.
$fileObject = Object::create($relationClass);
$fileObject = SS_Object::create($relationClass);
}
// Get the uploaded file into a new file object.

View File

@ -8,7 +8,7 @@
* @package forms
* @subpackage validators
*/
abstract class Validator extends Object {
abstract class Validator extends SS_Object {
/**
* @var Form $form

View File

@ -19,7 +19,7 @@
* @package forms
* @subpackage fields-gridfield
*/
class GridFieldConfig extends Object {
class GridFieldConfig extends SS_Object {
/**
* @var ArrayList

View File

@ -85,17 +85,17 @@ class GridFieldDetailForm implements GridField_URLHandler {
if(is_numeric($request->param('ID'))) {
$record = $gridField->getList()->byId($request->param("ID"));
} else {
$record = Object::create($gridField->getModelClass());
$record = SS_Object::create($gridField->getModelClass());
}
$class = $this->getItemRequestClass();
$handler = Object::create($class, $gridField, $this, $record, $requestHandler, $this->name);
$handler = SS_Object::create($class, $gridField, $this, $record, $requestHandler, $this->name);
$handler->setTemplate($this->template);
// if no validator has been set on the GridField and the record has a
// CMS validator, use that.
if(!$this->getValidator() && (method_exists($record, 'getCMSValidator') || $record instanceof Object && $record->hasMethod('getCMSValidator'))) {
if(!$this->getValidator() && (method_exists($record, 'getCMSValidator') || $record instanceof SS_Object && $record->hasMethod('getCMSValidator'))) {
$this->setValidator($record->getCMSValidator());
}

View File

@ -7,7 +7,7 @@
* @package forms
* @subpackage fields-gridfield
*/
class GridFieldLevelup extends Object implements GridField_HTMLProvider {
class GridFieldLevelup extends SS_Object implements GridField_HTMLProvider {
/**
* @var integer - the record id of the level up to

View File

@ -132,7 +132,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
$dir = 'desc';
}
$field = Object::create(
$field = SS_Object::create(
'GridField_FormAction', $gridField, 'SetOrder'.$fieldName, $title,
"sort$dir", array('SortColumn' => $columnField)
)->addExtraClass('ss-gridfield-sort');

View File

@ -37,7 +37,7 @@ class GridState extends HiddenField {
/**
* @param mixed $d
* @return object
* @return SS_Object
*/
public static function array_to_object($d) {
if(is_array($d)) {

View File

@ -62,7 +62,7 @@ require_once 'i18nSSLegacyAdapter.php';
* @package framework
* @subpackage misc
*/
class i18n extends Object implements TemplateGlobalProvider, Flushable {
class i18n extends SS_Object implements TemplateGlobalProvider, Flushable {
/**
* This static variable is used to store the current defined locale.

View File

@ -25,7 +25,7 @@
* @uses i18nEntityProvider
* @uses i18n
*/
class i18nTextCollector extends Object {
class i18nTextCollector extends SS_Object {
/**
* Default (master) locale

View File

@ -171,8 +171,8 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
/**
* Replaces an item in this list with another item.
*
* @param array|object $item
* @param array|object $with
* @param array|SS_Object $item
* @param array|SS_Object $with
* @return void;
*/
public function replace($item, $with) {
@ -188,7 +188,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
* Merges with another array or list by pushing all the items in it onto the
* end of this list.
*
* @param array|object $with
* @param array|SS_Object $with
*/
public function merge($with) {
foreach ($with as $item) $this->push($item);
@ -221,7 +221,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
/**
* Pushes an item onto the end of this list.
*
* @param array|object $item
* @param array|SS_Object $item
*/
public function push($item) {
$this->items[] = $item;
@ -230,7 +230,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
/**
* Pops the last element off the end of the list and returns it.
*
* @return array|object
* @return array|SS_Object
*/
public function pop() {
return array_pop($this->items);
@ -239,7 +239,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
/**
* Add an item onto the beginning of the list.
*
* @param array|object $item
* @param array|SS_Object $item
*/
public function unshift($item) {
array_unshift($this->items, $item);
@ -248,7 +248,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
/**
* Shifts the item off the beginning of the list and returns it.
*
* @return array|object
* @return array|SS_Object
*/
public function shift() {
return array_shift($this->items);
@ -725,7 +725,7 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
* Extracts a value from an item in the list, where the item is either an
* object or array.
*
* @param array|object $item
* @param array|SS_Object $item
* @param string $key
* @return mixed
*/

View File

@ -2429,7 +2429,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// Otherwise, we need to determine if this is a complex field
if(self::is_composite_field($this->class, $field)) {
$helper = $this->castingHelper($field);
$fieldObj = Object::create_from_string($helper, $field);
$fieldObj = SS_Object::create_from_string($helper, $field);
$compositeFields = $fieldObj->compositeDatabaseFields();
foreach ($compositeFields as $compositeName => $compositeType) {
@ -2687,7 +2687,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
}
$castingHelper = $this->castingHelper($fieldName);
if($castingHelper) {
$fieldObj = Object::create_from_string($castingHelper, $fieldName);
$fieldObj = SS_Object::create_from_string($castingHelper, $fieldName);
$fieldObj->setValue($val);
$fieldObj->saveInto($this);
} else {
@ -2999,7 +2999,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// General casting information for items in $db
} else if($helper = $this->db($fieldName)) {
$obj = Object::create_from_string($helper, $fieldName);
$obj = SS_Object::create_from_string($helper, $fieldName);
$obj->setValue($this->$fieldName, $this->record, false);
return $obj;

View File

@ -514,7 +514,7 @@ class DataQuery {
}
if($compositeFields) foreach($compositeFields as $k => $v) {
if((is_null($columns) || in_array($k, $columns)) && $v) {
$dbO = Object::create_from_string($v, $k);
$dbO = SS_Object::create_from_string($v, $k);
$dbO->addToQuery($query);
}
}

View File

@ -86,7 +86,7 @@ class ManyManyList extends RelationList {
$finalized = array();
foreach($this->extraFields as $field => $spec) {
$obj = Object::create_from_string($spec);
$obj = SS_Object::create_from_string($spec);
if($obj instanceof CompositeDBField) {
$this->_compositeExtraFields[$field] = array();
@ -131,7 +131,7 @@ class ManyManyList extends RelationList {
}
}
$obj = Object::create_from_string($this->extraFields[$fieldName], $fieldName);
$obj = SS_Object::create_from_string($this->extraFields[$fieldName], $fieldName);
$obj->setValue($value, null, false);
$add[$fieldName] = $obj;
@ -253,7 +253,7 @@ class ManyManyList extends RelationList {
foreach($this->extraFields as $fieldName => $fieldSpec) {
// Skip fields without an assignment
if(array_key_exists($fieldName, $extraFields)) {
$fieldObject = Object::create_from_string($fieldSpec, $fieldName);
$fieldObject = SS_Object::create_from_string($fieldSpec, $fieldName);
$fieldObject->setValue($extraFields[$fieldName]);
$fieldObject->writeToManipulation($manipulation[$this->joinTable]);
}

View File

@ -13,7 +13,7 @@
* @package framework
* @subpackage model
*/
class SS_Transliterator extends Object {
class SS_Transliterator extends SS_Object {
/**
* @config
* @var boolean Allow the use of iconv() to perform transliteration. Set to false to disable.

View File

@ -14,7 +14,7 @@
*
* See {@link FileNameFilter} for similar implementation for filesystem-based URLs.
*/
class URLSegmentFilter extends Object {
class URLSegmentFilter extends SS_Object {
/**
* @config

View File

@ -85,7 +85,7 @@ class UnsavedRelationList extends ArrayList {
/**
* Pushes an item onto the end of this list.
*
* @param array|object $item
* @param array|SS_Object $item
* @param array $extraFields
*/
public function push($item, $extraFields = null) {

View File

@ -6,7 +6,7 @@
* @package framework
* @subpackage core
*/
class ValidationResult extends Object {
class ValidationResult extends SS_Object {
/**
* @var bool - is the result valid or not
*/

View File

@ -342,7 +342,7 @@ abstract class DBSchemaManager {
$fieldSpec = substr($fieldSpec, 0, $pos);
}
$fieldObj = Object::create_from_string($fieldSpec, $fieldName);
$fieldObj = SS_Object::create_from_string($fieldSpec, $fieldName);
$fieldObj->arrayValue = $arrayValue;
$fieldObj->setTable($table);

View File

@ -192,7 +192,7 @@ class MySQLiConnector extends DBConnector {
case 'double':
$types .= 'd';
break;
case 'object': // Allowed if the object or resource has a __toString method
case 'SS_Object': // Allowed if the object or resource has a __toString method
case 'resource':
case 'string':
case 'NULL': // Take care that a where clause should use "where XX is null" not "where XX = null"

View File

@ -286,7 +286,7 @@ class PDOConnector extends DBConnector {
return PDO::PARAM_NULL;
case 'integer':
return PDO::PARAM_INT;
case 'object': // Allowed if the object or resource has a __toString method
case 'SS_Object': // Allowed if the object or resource has a __toString method
case 'resource':
case 'float': // Not actually returnable from get_type
case 'double':

View File

@ -85,7 +85,7 @@ abstract class DBField extends ViewableData {
* @return DBField
*/
public static function create_field($className, $value, $name = null, $object = null) {
$dbField = Object::create($className, $name, $object);
$dbField = SS_Object::create($className, $name, $object);
$dbField->setValue($value, null, false);
return $dbField;

View File

@ -2,16 +2,24 @@
if (PHP_MAJOR_VERSION < 7) {
spl_autoload_register('php5_compat_autoloader');
spl_autoload_register('php7_compat_autoloader');
} elseif (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 2) {
spl_autoload_register('php7_compat_autoloader');
}
function php5_compat_autoloader($classname) {
$classMap = array(
"int" => "/framework/model/fieldtypes/compat/Int.php",
"float" => "/framework/model/fieldtypes/compat/Float.php",
);
switch (strtolower($classname)) {
case 'int':
require_once BASE_PATH . '/framework/model/fieldtypes/compat/Int.php';
break;
case 'float':
require_once BASE_PATH . '/framework/model/fieldtypes/compat/Float.php';
break;
}
}
$classname = strtolower($classname);
if(isset($classMap[$classname])) {
require_once BASE_PATH . $classMap[$classname];
function php7_compat_autoloader($classname) {
if (strcasecmp($classname, 'object') === 0) {
require_once BASE_PATH . '/framework/core/compat/Object.php';
}
}

View File

@ -9,7 +9,7 @@
* @subpackage parsers
* @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com)
*/
class SQLFormatter extends Object {
class SQLFormatter extends SS_Object {
protected static $newline_before_tokens = array(
'SELECT',

View File

@ -9,7 +9,7 @@
* @package framework
* @subpackage misc
*/
class ShortcodeParser extends Object {
class ShortcodeParser extends SS_Object {
public function img_shortcode($attrs) {
return "<img src='".$attrs['src']."'>";

View File

@ -25,7 +25,7 @@
* @package framework
* @subpackage misc
*/
abstract class TextParser extends Object {
abstract class TextParser extends SS_Object {
protected $content;
/**

View File

@ -23,7 +23,7 @@
* @package framework
* @subpackage search
*/
class SearchContext extends Object {
class SearchContext extends SS_Object {
/**
* DataObject subclass to which search parameters relate to.

View File

@ -8,7 +8,7 @@
* @package framework
* @subpackage search
*/
abstract class SearchFilter extends Object {
abstract class SearchFilter extends SS_Object {
/**
* @var string Classname of the inspected {@link DataObject}

View File

@ -9,7 +9,7 @@
* @package framework
* @subpackage security
*/
abstract class Authenticator extends Object {
abstract class Authenticator extends SS_Object {
/**
* This variable holds all authenticators that should be used

View File

@ -15,7 +15,7 @@
* @package framework
* @subpackage security
*/
class PasswordValidator extends Object {
class PasswordValidator extends SS_Object {
private static $character_strength_tests = array(
'lowercase' => '/[a-z]/',

View File

@ -770,7 +770,7 @@ class Security extends Controller implements TemplateGlobalProvider {
* @return Form Returns the lost password form
*/
public function ChangePasswordForm() {
return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');
return SS_Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');
}
/**

View File

@ -28,7 +28,7 @@
*
* @todo Make token name form specific for additional forgery protection.
*/
class SecurityToken extends Object implements TemplateGlobalProvider {
class SecurityToken extends SS_Object implements TemplateGlobalProvider {
/**
* @var String

View File

@ -15,7 +15,7 @@ interface Factory {
*
* @param string $service The class name of the service.
* @param array $params The constructor parameters.
* @return object The created service instances.
* @return SS_Object The created service instances.
*/
public function create($service, array $params = array());

View File

@ -20,8 +20,8 @@ class ClassInfoTest extends SapphireTest {
}
public function testExists() {
$this->assertTrue(ClassInfo::exists('Object'));
$this->assertTrue(ClassInfo::exists('object'));
$this->assertTrue(ClassInfo::exists('SS_Object'));
$this->assertTrue(ClassInfo::exists('SS_Object'));
$this->assertTrue(ClassInfo::exists('ClassInfoTest'));
$this->assertTrue(ClassInfo::exists('CLASSINFOTEST'));
$this->assertTrue(ClassInfo::exists('stdClass'));
@ -97,7 +97,7 @@ class ClassInfoTest extends SapphireTest {
public function testAncestry() {
$ancestry = ClassInfo::ancestry('ClassInfoTest_ChildClass');
$expect = ArrayLib::valuekey(array(
'Object',
'SS_Object',
'ViewableData',
'DataObject',
'ClassInfoTest_BaseClass',
@ -191,7 +191,7 @@ class ClassInfoTest extends SapphireTest {
);
$this->assertNull(
ClassInfo::table_for_object_field('Object', 'Title')
ClassInfo::table_for_object_field('SS_Object', 'Title')
);
$this->assertNull(

View File

@ -1,6 +1,6 @@
<?php
class ConfigTest_DefinesFoo extends Object implements TestOnly {
class ConfigTest_DefinesFoo extends SS_Object implements TestOnly {
protected static $foo = 1;
}
@ -74,7 +74,7 @@ class ConfigStaticTest_Combined3 extends ConfigStaticTest_Combined2 {
private static $second = array('test_3');
}
class ConfigTest_TestNest extends Object implements TestOnly {
class ConfigTest_TestNest extends SS_Object implements TestOnly {
/** @config */
private static $foo = 3;
/** @config */
@ -249,17 +249,17 @@ class ConfigTest extends SapphireTest {
}
public function testStaticLookup() {
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFoo', 'foo'), 1);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFoo', 'bar'), null);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFoo', 'foo'), 1);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFoo', 'bar'), null);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesBar', 'foo'), null);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesBar', 'bar'), 2);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesBar', 'foo'), null);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesBar', 'bar'), 2);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooAndBar', 'foo'), 3);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooAndBar', 'bar'), 3);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooAndBar', 'foo'), 3);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooAndBar', 'bar'), 3);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'foo'), 4);
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'bar'), null);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'foo'), 4);
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'bar'), null);
}
public function testForClass() {

View File

@ -119,7 +119,7 @@ class ObjectTest extends SapphireTest {
$createdObj = ObjectTest_CreateTest::create('arg1', 'arg2', array(), null, 'arg5');
$this->assertEquals($createdObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5'));
$strongObj = Object::strong_create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5');
$strongObj = SS_Object::strong_create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5');
$this->assertEquals($strongObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5'));
}
@ -135,18 +135,18 @@ class ObjectTest extends SapphireTest {
$obj1 = ObjectTest_CreateTest::create();
$this->assertTrue($obj1 instanceof ObjectTest_CreateTest);
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
SS_Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
$obj2 = ObjectTest_CreateTest::create();
$this->assertTrue($obj2 instanceof ObjectTest_CreateTest2);
$obj2_2 = Object::strong_create('ObjectTest_CreateTest');
$obj2_2 = SS_Object::strong_create('ObjectTest_CreateTest');
$this->assertTrue($obj2_2 instanceof ObjectTest_CreateTest);
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true);
SS_Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true);
$obj3 = ObjectTest_CreateTest::create();
$this->assertTrue($obj3 instanceof ObjectTest_CreateTest3);
$obj3_2 = Object::strong_create('ObjectTest_CreateTest');
$obj3_2 = SS_Object::strong_create('ObjectTest_CreateTest');
$this->assertTrue($obj3_2 instanceof ObjectTest_CreateTest3);
}
@ -162,14 +162,14 @@ class ObjectTest extends SapphireTest {
public function testGetExtensions() {
$this->assertEquals(
Object::get_extensions('ObjectTest_ExtensionTest'),
SS_Object::get_extensions('ObjectTest_ExtensionTest'),
array(
'oBjEcTTEST_ExtendTest1',
"ObjectTest_ExtendTest2",
)
);
$this->assertEquals(
Object::get_extensions('ObjectTest_ExtensionTest', true),
SS_Object::get_extensions('ObjectTest_ExtensionTest', true),
array(
'oBjEcTTEST_ExtendTest1',
"ObjectTest_ExtendTest2('FOO', 'BAR')",
@ -317,7 +317,7 @@ class ObjectTest extends SapphireTest {
ObjectTest_ExtensionRemoveTest::remove_extension('ObjectTest_ExtendTest2');
$this->assertFalse(
Object::has_extension('ObjectTest_ExtensionRemoveTest', 'ObjectTest_ExtendTest2'),
SS_Object::has_extension('ObjectTest_ExtensionRemoveTest', 'ObjectTest_ExtendTest2'),
"Extension added through \$add_extension() are detected as removed in has_extension()"
);
@ -329,11 +329,11 @@ class ObjectTest extends SapphireTest {
}
public function testParentClass() {
$this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'Object');
$this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'SS_Object');
}
public function testIsA() {
$this->assertTrue(ObjectTest_MyObject::create() instanceof Object);
$this->assertTrue(ObjectTest_MyObject::create() instanceof SS_Object);
$this->assertTrue(ObjectTest_MyObject::create() instanceof ObjectTest_MyObject);
}
@ -402,84 +402,84 @@ class ObjectTest extends SapphireTest {
// Simple case
$this->assertEquals(
array('Versioned',array('Stage', 'Live')),
Object::parse_class_spec("Versioned('Stage','Live')")
SS_Object::parse_class_spec("Versioned('Stage','Live')")
);
// String with commas
$this->assertEquals(
array('Versioned',array('Stage,Live', 'Stage')),
Object::parse_class_spec("Versioned('Stage,Live','Stage')")
SS_Object::parse_class_spec("Versioned('Stage,Live','Stage')")
);
// String with quotes
$this->assertEquals(
array('Versioned',array('Stage\'Stage,Live\'Live', 'Live')),
Object::parse_class_spec("Versioned('Stage\'Stage,Live\'Live','Live')")
SS_Object::parse_class_spec("Versioned('Stage\'Stage,Live\'Live','Live')")
);
// True, false and null values
$this->assertEquals(
array('ClassName', array('string', true, array('string', false))),
Object::parse_class_spec('ClassName("string", true, array("string", false))')
SS_Object::parse_class_spec('ClassName("string", true, array("string", false))')
);
$this->assertEquals(
array('ClassName', array(true, false, null)),
Object::parse_class_spec('ClassName(true, false, null)')
SS_Object::parse_class_spec('ClassName(true, false, null)')
);
// Array
$this->assertEquals(
array('Enum',array(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')),
Object::parse_class_spec("Enum(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')")
SS_Object::parse_class_spec("Enum(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')")
);
// Nested array
$this->assertEquals(
array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')),
'Unsubmitted')),
Object::parse_class_spec(
SS_Object::parse_class_spec(
"Enum(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')), 'Unsubmitted')")
);
// 5.4 Shorthand Array
$this->assertEquals(
array('Enum',array(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')),
Object::parse_class_spec("Enum(['Accepted', 'Pending', 'Declined', 'Unsubmitted'], 'Unsubmitted')")
SS_Object::parse_class_spec("Enum(['Accepted', 'Pending', 'Declined', 'Unsubmitted'], 'Unsubmitted')")
);
// 5.4 Nested shorthand array
$this->assertEquals(
array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')),
'Unsubmitted')),
Object::parse_class_spec(
SS_Object::parse_class_spec(
"Enum(['Accepted', 'Pending', 'Declined', ['UnsubmittedA','UnsubmittedB']], 'Unsubmitted')")
);
// Associative array
$this->assertEquals(
array('Varchar', array(255, array('nullifyEmpty' => false))),
Object::parse_class_spec("Varchar(255, array('nullifyEmpty' => false))")
SS_Object::parse_class_spec("Varchar(255, array('nullifyEmpty' => false))")
);
// Nested associative array
$this->assertEquals(
array('Test', array('string', array('nested' => array('foo' => 'bar')))),
Object::parse_class_spec("Test('string', array('nested' => array('foo' => 'bar')))")
SS_Object::parse_class_spec("Test('string', array('nested' => array('foo' => 'bar')))")
);
// 5.4 shorthand associative array
$this->assertEquals(
array('Varchar', array(255, array('nullifyEmpty' => false))),
Object::parse_class_spec("Varchar(255, ['nullifyEmpty' => false])")
SS_Object::parse_class_spec("Varchar(255, ['nullifyEmpty' => false])")
);
// 5.4 shorthand nested associative array
$this->assertEquals(
array('Test', array('string', array('nested' => array('foo' => 'bar')))),
Object::parse_class_spec("Test('string', ['nested' => ['foo' => 'bar']])")
SS_Object::parse_class_spec("Test('string', ['nested' => ['foo' => 'bar']])")
);
// Namespaced class
$this->assertEquals(
array('Test\MyClass', array()),
Object::parse_class_spec('Test\MyClass')
SS_Object::parse_class_spec('Test\MyClass')
);
// Fully qualified namespaced class
$this->assertEquals(
array('\Test\MyClass', array()),
Object::parse_class_spec('\Test\MyClass')
SS_Object::parse_class_spec('\Test\MyClass')
);
}
}
@ -488,7 +488,7 @@ class ObjectTest extends SapphireTest {
* @ignore
*/
class ObjectTest_T1A extends Object {
class ObjectTest_T1A extends SS_Object {
public function testMethod() {
return true;
}
@ -497,19 +497,19 @@ class ObjectTest_T1A extends Object {
}
}
class ObjectTest_T1B extends Object {
class ObjectTest_T1B extends SS_Object {
public function someMethod() {
return true;
}
}
class ObjectTest_T1C extends Object {
class ObjectTest_T1C extends SS_Object {
public function t1cMethod() {
return true;
}
}
class ObjectTest_T2 extends Object {
class ObjectTest_T2 extends SS_Object {
protected $failover;
protected $failoverArr = array();
@ -541,7 +541,7 @@ class ObjectTest_T2 extends Object {
}
class ObjectTest_MyObject extends Object {
class ObjectTest_MyObject extends SS_Object {
public $title = 'my object';
/** @config */
private static $mystaticProperty = "MyObject";
@ -555,7 +555,7 @@ class ObjectTest_MySubObject extends ObjectTest_MyObject {
static $mystaticArray = array('two');
}
class ObjectTest_CreateTest extends Object {
class ObjectTest_CreateTest extends SS_Object {
public $constructArguments;
@ -566,10 +566,10 @@ class ObjectTest_CreateTest extends Object {
}
class ObjectTest_CreateTest2 extends Object {}
class ObjectTest_CreateTest3 extends Object {}
class ObjectTest_CreateTest2 extends SS_Object {}
class ObjectTest_CreateTest3 extends SS_Object {}
class ObjectTest_ExtensionTest extends Object {
class ObjectTest_ExtensionTest extends SS_Object {
private static $extensions = array (
'oBjEcTTEST_ExtendTest1',
@ -578,15 +578,15 @@ class ObjectTest_ExtensionTest extends Object {
}
class ObjectTest_ExtensionTest2 extends Object {
class ObjectTest_ExtensionTest2 extends SS_Object {
private static $extensions = array('ObjectTest_Extension');
}
class ObjectTest_ExtensionTest3 extends Object {
class ObjectTest_ExtensionTest3 extends SS_Object {
}
class ObjectTest_ExtensionRemoveTest extends Object {
class ObjectTest_ExtensionRemoveTest extends SS_Object {
private static $extensions = array (
'ObjectTest_ExtendTest1',
@ -596,7 +596,7 @@ class ObjectTest_ExtensionRemoveTest extends Object {
class ObjectTest_Extension extends Extension {}
class ObjectTest_CacheTest extends Object {
class ObjectTest_CacheTest extends SS_Object {
public $count = 0;
@ -611,7 +611,7 @@ class ObjectTest_CacheTest extends Object {
}
class ObjectTest_ExtendTest extends Object {
class ObjectTest_ExtendTest extends SS_Object {
private static $extensions = array('ObjectTest_ExtendTest1', 'ObjectTest_ExtendTest2');
public function extendableMethod($argument = null) { return "ExtendTest($argument)"; }
}
@ -635,7 +635,7 @@ class ObjectTest_ExtendTest4 extends ObjectTest_ExtendTest3 {
public function extendableMethod($argument = null) { return "ExtendTest4($argument)"; }
}
class ObjectTest_Extending extends Object implements TestOnly {
class ObjectTest_Extending extends SS_Object implements TestOnly {
private static $extensions = array(
'ObjectTest_Extending_Extension'

View File

@ -1,5 +1,5 @@
<?php
class i18nOtherModule extends Object {
class i18nOtherModule extends SS_Object {
public function mymethod() {
_t(
'i18nOtherModule.ENTITY',

View File

@ -13,7 +13,7 @@ class i18nTestModule extends DataObject implements TestOnly {
);
}
}
class i18nTestModule_Addition extends Object {
class i18nTestModule_Addition extends SS_Object {
public function myAdditionalMethod() {
_t('i18nTestModule.ADDITION','Addition');
}

View File

@ -1,5 +1,5 @@
<?php
class i18nTestSubModule extends Object {
class i18nTestSubModule extends SS_Object {
public function __construct() {
_t('i18nTestModule.OTHERENTITY', 'Other Entity');

View File

@ -613,7 +613,7 @@ class i18nTest_DataObject extends DataObject implements TestOnly {
}
class i18nTest_Object extends Object implements TestOnly, i18nEntityProvider {
class i18nTest_Object extends SS_Object implements TestOnly, i18nEntityProvider {
static $my_translatable_property = "Untranslated";
public static function my_translatable_property() {

View File

@ -843,7 +843,7 @@ class SSObjectCreator extends InjectionCreator {
if (strpos($class, '(') === false) {
return parent::create($class, $params);
} else {
list($class, $params) = Object::parse_class_spec($class);
list($class, $params) = SS_Object::parse_class_spec($class);
$params = $this->injector->convertServiceProperty($params);
return parent::create($class, $params);
}

View File

@ -20,7 +20,7 @@ class ManyManyListExtensionTest extends SapphireTest {
// This extends ManyManyListTest_Secondary with the secondary extension that adds the relationship back
// to the primary. The instance from the fixture is ManyManyListTest_SecondarySub, deliberately a sub-class of
// the extended class.
Object::add_extension('ManyManyListTest_Secondary', 'ManyManyListTest_IndirectSecondaryExtension');
SS_Object::add_extension('ManyManyListTest_Secondary', 'ManyManyListTest_IndirectSecondaryExtension');
// Test from the primary (not extended) to the secondary (which is extended)
$primary = $this->objFromFixture('ManyManyListTest_IndirectPrimary', 'manymany_extra_primary');

View File

@ -487,7 +487,7 @@ class MemberTest extends FunctionalTest {
* edit and delete their own record too.
*/
public function testCanManipulateOwnRecord() {
$extensions = $this->removeExtensions(Object::get_extensions('Member'));
$extensions = $this->removeExtensions(SS_Object::get_extensions('Member'));
$member = $this->objFromFixture('Member', 'test');
$member2 = $this->objFromFixture('Member', 'staffmember');
@ -515,7 +515,7 @@ class MemberTest extends FunctionalTest {
}
public function testAuthorisedMembersCanManipulateOthersRecords() {
$extensions = $this->removeExtensions(Object::get_extensions('Member'));
$extensions = $this->removeExtensions(SS_Object::get_extensions('Member'));
$member = $this->objFromFixture('Member', 'test');
$member2 = $this->objFromFixture('Member', 'staffmember');
@ -530,7 +530,7 @@ class MemberTest extends FunctionalTest {
}
public function testExtendedCan() {
$extensions = $this->removeExtensions(Object::get_extensions('Member'));
$extensions = $this->removeExtensions(SS_Object::get_extensions('Member'));
$member = $this->objFromFixture('Member', 'test');
/* Normal behaviour is that you can't view a member unless canView() on an extension returns true */

View File

@ -850,7 +850,7 @@ class Zend_Currency
if (!is_string($value) || (strpos($value, '0') === false)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("'" .
((gettype($value) === 'object') ? get_class($value) : $value)
((gettype($value) === 'SS_Object') ? get_class($value) : $value)
. "' is no format token");
}
}

View File

@ -371,7 +371,7 @@ class Zend_Loader_Autoloader
/**
* Add an autoloader to the beginning of the stack
*
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param SS_Object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param string|array $namespace Specific namespace(s) under which to register callback
* @return Zend_Loader_Autoloader
*/
@ -394,7 +394,7 @@ class Zend_Loader_Autoloader
/**
* Append an autoloader to the autoloader stack
*
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param SS_Object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param string|array $namespace Specific namespace(s) under which to register callback
* @return Zend_Loader_Autoloader
*/
@ -417,7 +417,7 @@ class Zend_Loader_Autoloader
/**
* Remove an autoloader from the autoloader stack
*
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param SS_Object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
* @param null|string|array $namespace Specific namespace(s) from which to remove autoloader
* @return Zend_Loader_Autoloader
*/

View File

@ -446,7 +446,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
*
* @param string $resource
* @param string $type
* @return object
* @return SS_Object
* @throws Zend_Loader_Exception if resource type not specified or invalid
*/
public function load($resource, $type = null)

View File

@ -242,7 +242,7 @@ class Zend_Log
* @param string $type 'writer' of 'filter'
* @param mixed $config Zend_Config or Array
* @param string $namespace
* @return object
* @return SS_Object
* @throws Zend_Log_Exception
*/
protected function _constructFromConfig($type, $config, $namespace)

View File

@ -14,8 +14,8 @@ class SimpleTestCompatibility {
/**
* Creates a copy whether in PHP5 or PHP4.
* @param object $object Thing to copy.
* @return object A copy.
* @param SS_Object $object Thing to copy.
* @return SS_Object A copy.
* @access public
* @static
*/
@ -128,7 +128,7 @@ class SimpleTestCompatibility {
/**
* Test to see if an object is a member of a
* class hiearchy.
* @param object $object Object to test.
* @param SS_Object $object Object to test.
* @param string $class Root name of hiearchy.
* @return boolean True if class in hiearchy.
* @access public

View File

@ -4,7 +4,7 @@
*
* @package MCManager.utils
* @author Moxiecode
* @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright <EFBFBD> 2007, Moxiecode Systems AB, All rights reserved.
*/
define('JSON_BOOL', 1);
@ -474,7 +474,7 @@ class Moxiecode_JSON {
case 'array':
return $this->_encodeArray($input);
case 'object':
case 'SS_Object':
return $this->_encodeArray(get_object_vars($input));
}

View File

@ -21,7 +21,7 @@ class ArrayData extends ViewableData {
protected $array;
/**
* @param object|array $value An associative array, or an object with simple properties.
* @param SS_Object|array $value An associative array, or an object with simple properties.
* Converts object properties to keys of an associative array.
*/
public function __construct($value) {

View File

@ -131,7 +131,7 @@ class SSViewer_Scope {
/**
* Gets the current object and resets the scope.
*
* @return object
* @return SS_Object
*/
public function self() {
$result = $this->itemIterator ? $this->itemIterator->current() : $this->item;
@ -637,7 +637,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
if ($val) {
$obj = $val['obj'];
if ($name === 'hasValue') {
$res = $obj instanceof Object
$res = $obj instanceof SS_Object
? $obj->exists()
: (bool)$obj;
} else {
@ -1139,10 +1139,10 @@ class SSViewer implements Flushable {
* Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call
*
* @param string $cacheFile - The path to the file that contains the template compiled to PHP
* @param Object $item - The item to use as the root scope for the template
* @param SS_Object $item - The item to use as the root scope for the template
* @param array|null $overlay - Any variables to layer on top of the scope
* @param array|null $underlay - Any variables to layer underneath the scope
* @param Object $inheritedScope - the current scope of a parent template including a sub-template
* @param SS_Object $inheritedScope - the current scope of a parent template including a sub-template
*
* @return string - The result of executing the template
*/
@ -1179,7 +1179,7 @@ class SSViewer implements Flushable {
*
* @param ViewableData $item
* @param array|null $arguments - arguments to an included template
* @param Object $inheritedScope - the current scope of a parent template including a sub-template
* @param SS_Object $inheritedScope - the current scope of a parent template including a sub-template
*
* @return HTMLText Parsed template output.
*/

View File

@ -9,7 +9,7 @@
* @package framework
* @subpackage view
*/
class ViewableData extends Object implements IteratorAggregate {
class ViewableData extends SS_Object implements IteratorAggregate {
/**
* An array of objects to cast certain fields to. This is set up as an array in the format:
@ -473,7 +473,7 @@ class ViewableData extends Object implements IteratorAggregate {
$castConstructor = $this->config()->default_cast;
}
$valueObject = Object::create_from_string($castConstructor, $fieldName);
$valueObject = SS_Object::create_from_string($castConstructor, $fieldName);
$valueObject->setValue($value, $this);
$value = $valueObject;
@ -516,7 +516,7 @@ class ViewableData extends Object implements IteratorAggregate {
public function hasValue($field, $arguments = null, $cache = true) {
$result = $cache ? $this->cachedCall($field, $arguments) : $this->obj($field, $arguments, false, false);
if(is_object($result) && $result instanceof Object) {
if(is_object($result) && $result instanceof SS_Object) {
return $result->exists();
} else {
// Empty paragraph checks are a workaround for TinyMCE
@ -537,7 +537,7 @@ class ViewableData extends Object implements IteratorAggregate {
*/
public function XML_val($field, $arguments = null, $cache = false) {
$result = $this->obj($field, $arguments, false, $cache);
return (is_object($result) && $result instanceof Object) ? $result->forTemplate() : $result;
return (is_object($result) && $result instanceof SS_Object) ? $result->forTemplate() : $result;
}
/**