mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
NEW Add php 7.2 support
This commit is contained in:
parent
ae130bff23
commit
9103816333
@ -12,6 +12,8 @@ addons:
|
|||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- php: 7.2
|
||||||
|
env: DB=MYSQL PDO=1
|
||||||
- php: 5.3
|
- php: 5.3
|
||||||
env: DB=MYSQL
|
env: DB=MYSQL
|
||||||
- php: 5.4
|
- php: 5.4
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
*
|
*
|
||||||
* Overload both of these to support legacy code.
|
* Overload both of these to support legacy code.
|
||||||
*/
|
*/
|
||||||
Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
|
SS_Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
|
||||||
Object::useCustomClass('Datetime', 'SS_Datetime', true);
|
SS_Object::useCustomClass('Datetime', 'SS_Datetime', true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root directory of TinyMCE
|
* The root directory of TinyMCE
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
*/
|
*/
|
||||||
abstract class CMSBatchAction extends Object {
|
abstract class CMSBatchAction extends SS_Object {
|
||||||
|
|
||||||
protected $managedClass = 'SiteTree';
|
protected $managedClass = 'SiteTree';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage admin
|
* @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
|
* An array of changes to be made to the menu items, in the order that the changes should be
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage admin
|
* @subpackage admin
|
||||||
*/
|
*/
|
||||||
class CMSMenuItem extends Object {
|
class CMSMenuItem extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (translated) menu title
|
* The (translated) menu title
|
||||||
|
@ -1891,7 +1891,7 @@ class LeftAndMain_TreeNode extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* Object represented by this node
|
* Object represented by this node
|
||||||
*
|
*
|
||||||
* @var Object
|
* @var SS_Object
|
||||||
*/
|
*/
|
||||||
protected $obj;
|
protected $obj;
|
||||||
|
|
||||||
@ -1924,7 +1924,7 @@ class LeftAndMain_TreeNode extends ViewableData {
|
|||||||
protected $filter;
|
protected $filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Object $obj
|
* @param SS_Object $obj
|
||||||
* @param string $link
|
* @param string $link
|
||||||
* @param bool $isCurrent
|
* @param bool $isCurrent
|
||||||
* @param string $numChildrenMethod
|
* @param string $numChildrenMethod
|
||||||
|
@ -201,9 +201,9 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
$form = new Form($this, "SearchForm",
|
$form = new Form($this, "SearchForm",
|
||||||
$context->getSearchFields(),
|
$context->getSearchFields(),
|
||||||
new FieldList(
|
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'),
|
->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)
|
->setUseButtonTag(true)
|
||||||
),
|
),
|
||||||
new RequiredFields()
|
new RequiredFields()
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage formatters
|
* @subpackage formatters
|
||||||
*/
|
*/
|
||||||
abstract class DataFormatter extends Object {
|
abstract class DataFormatter extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set priority from 0-100.
|
* Set priority from 0-100.
|
||||||
|
@ -54,7 +54,7 @@ class XMLDataFormatter extends DataFormatter {
|
|||||||
$fieldValue = $obj->obj($fieldName)->forTemplate();
|
$fieldValue = $obj->obj($fieldName)->forTemplate();
|
||||||
if(!mb_check_encoding($fieldValue,'utf-8')) $fieldValue = "(data is badly encoded)";
|
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();
|
$xml .= $fieldValue->toXML();
|
||||||
} else {
|
} else {
|
||||||
if('HTMLText' == $fieldType) {
|
if('HTMLText' == $fieldType) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">= 5.3.3, <7.2",
|
"php": "^5.3.3 || ^7",
|
||||||
"composer/installers": "~1.0",
|
"composer/installers": "~1.0",
|
||||||
"mustangostang/spyc": "^0.6.2"
|
"mustangostang/spyc": "^0.6.2"
|
||||||
},
|
},
|
||||||
@ -40,7 +40,7 @@
|
|||||||
"thirdparty/php-peg", "thirdparty/simpletest", "thirdparty/zend_translate_railsyaml"
|
"thirdparty/php-peg", "thirdparty/simpletest", "thirdparty/zend_translate_railsyaml"
|
||||||
],
|
],
|
||||||
"exclude-from-classmap": [
|
"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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* devs might know what they're doing and don't want contentnegotiator messing with their HTML4 doctypes,
|
* 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.
|
* but still find it useful to have self-closing tags removed.
|
||||||
*/
|
*/
|
||||||
class ContentNegotiator extends Object {
|
class ContentNegotiator extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
|
@ -165,7 +165,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
|
|||||||
$this->setResponse($response);
|
$this->setResponse($response);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if($body instanceof Object && $body->hasMethod('getViewer')) {
|
if($body instanceof SS_Object && $body->hasMethod('getViewer')) {
|
||||||
if(isset($_REQUEST['debug_request'])) {
|
if(isset($_REQUEST['debug_request'])) {
|
||||||
Debug::message("Request handler $body->class object to $this->class controller;"
|
Debug::message("Request handler $body->class object to $this->class controller;"
|
||||||
. "rendering with template returned by $body->class::getViewer()");
|
. "rendering with template returned by $body->class::getViewer()");
|
||||||
|
@ -422,7 +422,7 @@ class RequestHandler extends ViewableData {
|
|||||||
$isAllowed = true;
|
$isAllowed = true;
|
||||||
} elseif(substr($test, 0, 2) == '->') {
|
} elseif(substr($test, 0, 2) == '->') {
|
||||||
// Determined by custom method with "->" prefix
|
// 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);
|
$isAllowed = call_user_func_array(array($this, $method), $arguments);
|
||||||
} else {
|
} else {
|
||||||
// Value is a permission code to check the current member against
|
// Value is a permission code to check the current member against
|
||||||
|
@ -16,7 +16,7 @@ interface AfterCallAspect {
|
|||||||
/**
|
/**
|
||||||
* Call this aspect after a method is executed
|
* Call this aspect after a method is executed
|
||||||
*
|
*
|
||||||
* @param object $proxied
|
* @param SS_Object $proxied
|
||||||
* The object having the method called upon it.
|
* The object having the method called upon it.
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* The name of the method being called
|
* The name of the method being called
|
||||||
|
@ -14,7 +14,7 @@ interface BeforeCallAspect {
|
|||||||
/**
|
/**
|
||||||
* Call this aspect before a method is executed
|
* Call this aspect before a method is executed
|
||||||
*
|
*
|
||||||
* @param object $proxied
|
* @param SS_Object $proxied
|
||||||
* The object having the method called upon it.
|
* The object having the method called upon it.
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* The name of the method being called
|
* The name of the method being called
|
||||||
|
@ -356,7 +356,7 @@ class Injector {
|
|||||||
*
|
*
|
||||||
* @param string $property
|
* @param string $property
|
||||||
* the name of the property
|
* the name of the property
|
||||||
* @param object $object
|
* @param SS_Object $object
|
||||||
* the object to be set
|
* the object to be set
|
||||||
*/
|
*/
|
||||||
public function addAutoProperty($property, $object) {
|
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
|
* into them, so we can update that binding at a later point if needbe (ie
|
||||||
* if the managed service changes)
|
* if the managed service changes)
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param SS_Object $object
|
||||||
* The object to inject
|
* The object to inject
|
||||||
* @param string $asType
|
* @param string $asType
|
||||||
* The ID this item was loaded as. This is so that the property configuration
|
* 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
|
* Helper to set a property's value
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param SS_Object $object
|
||||||
* Set an object's property to a specific value
|
* Set an object's property to a specific value
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* The name of the property to set
|
* The name of the property to set
|
||||||
|
@ -9,7 +9,7 @@ use SilverStripe\Framework\Injector\Factory;
|
|||||||
class SilverStripeInjectionCreator implements Factory {
|
class SilverStripeInjectionCreator implements Factory {
|
||||||
|
|
||||||
public function create($class, array $params = array()) {
|
public function create($class, array $params = array()) {
|
||||||
$class = Object::getCustomClass($class);
|
$class = SS_Object::getCustomClass($class);
|
||||||
$reflector = new ReflectionClass($class);
|
$reflector = new ReflectionClass($class);
|
||||||
|
|
||||||
return $params ? $reflector->newInstanceArgs($params) : $reflector->newInstance();
|
return $params ? $reflector->newInstanceArgs($params) : $reflector->newInstance();
|
||||||
|
@ -76,7 +76,7 @@ class ClassInfo {
|
|||||||
* Returns an array of the current class and all its ancestors and children
|
* Returns an array of the current class and all its ancestors and children
|
||||||
* which require a DB table.
|
* which require a DB table.
|
||||||
*
|
*
|
||||||
* @param string|object $class
|
* @param string|SS_Object $class
|
||||||
* @todo Move this into data object
|
* @todo Move this into data object
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -103,7 +103,7 @@ class ClassInfo {
|
|||||||
* Returns the root class (the first to extend from DataObject) for the
|
* Returns the root class (the first to extend from DataObject) for the
|
||||||
* passed class.
|
* passed class.
|
||||||
*
|
*
|
||||||
* @param string|object $class
|
* @param string|SS_Object $class
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function baseDataClass($class) {
|
public static function baseDataClass($class) {
|
||||||
@ -162,7 +162,7 @@ class ClassInfo {
|
|||||||
*
|
*
|
||||||
* eg: self::class_name('dataobJEct'); //returns 'DataObject'
|
* 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
|
* @return string The normalised class name
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +77,7 @@ class Config {
|
|||||||
* A marker instance for the "anything" singleton value. Don't access
|
* A marker instance for the "anything" singleton value. Don't access
|
||||||
* directly, even in-class, always use self::anything()
|
* directly, even in-class, always use self::anything()
|
||||||
*
|
*
|
||||||
* @var Object
|
* @var SS_Object
|
||||||
*/
|
*/
|
||||||
private static $_anything = null;
|
private static $_anything = null;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class Config {
|
|||||||
* Get a marker class instance that is used to do a "remove anything with
|
* 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
|
* this key" by adding $key => Config::anything() to the suppress array
|
||||||
*
|
*
|
||||||
* @return Object
|
* @return SS_Object
|
||||||
*/
|
*/
|
||||||
public static function anything() {
|
public static function anything() {
|
||||||
if (self::$_anything === null) {
|
if (self::$_anything === null) {
|
||||||
@ -515,7 +515,7 @@ class Config {
|
|||||||
if (($sourceOptions & self::EXCLUDE_EXTRA_SOURCES) != self::EXCLUDE_EXTRA_SOURCES) {
|
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 we don't have a fresh list of extra sources, get it from the class itself
|
||||||
if (!array_key_exists($class, $this->extraConfigSources)) {
|
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
|
// Update $sources with any extra sources
|
||||||
|
@ -214,7 +214,7 @@ class Convert {
|
|||||||
* Convert a JSON encoded string into an object.
|
* Convert a JSON encoded string into an object.
|
||||||
*
|
*
|
||||||
* @param string $val
|
* @param string $val
|
||||||
* @return object|boolean
|
* @return SS_Object|boolean
|
||||||
*/
|
*/
|
||||||
public static function json2obj($val) {
|
public static function json2obj($val) {
|
||||||
return json_decode($val);
|
return json_decode($val);
|
||||||
|
@ -158,7 +158,7 @@ Debug::loadErrorHandlers();
|
|||||||
* data (e.g. the custom SilverStripe static handling).
|
* data (e.g. the custom SilverStripe static handling).
|
||||||
*
|
*
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* @return Object
|
* @return SS_Object
|
||||||
*/
|
*/
|
||||||
function singleton($className) {
|
function singleton($className) {
|
||||||
if($className == "Config") user_error("Don't pass Config to singleton()", E_USER_ERROR);
|
if($className == "Config") user_error("Don't pass Config to singleton()", E_USER_ERROR);
|
||||||
|
@ -549,7 +549,7 @@ class Diff
|
|||||||
*
|
*
|
||||||
* $diff = new Diff($lines1, $lines2);
|
* $diff = new Diff($lines1, $lines2);
|
||||||
* $rev = $diff->reverse();
|
* $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.
|
* original diff.
|
||||||
*/
|
*/
|
||||||
public function reverse () {
|
public function reverse () {
|
||||||
@ -665,7 +665,7 @@ class Diff
|
|||||||
* by passing through DomDocument::loadHTML and saveXML
|
* by passing through DomDocument::loadHTML and saveXML
|
||||||
*
|
*
|
||||||
* @param string $content HTML content
|
* @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
|
* use, overriding self::$html_cleaner_class
|
||||||
*/
|
*/
|
||||||
public static function cleanHTML($content, $cleaner=null) {
|
public static function cleanHTML($content, $cleaner=null) {
|
||||||
|
@ -21,7 +21,7 @@ abstract class Extension {
|
|||||||
/**
|
/**
|
||||||
* The object this extension is applied to.
|
* The object this extension is applied to.
|
||||||
*
|
*
|
||||||
* @var Object
|
* @var SS_Object
|
||||||
*/
|
*/
|
||||||
protected $owner;
|
protected $owner;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ abstract class Extension {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the owner of this 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
|
* @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,
|
* 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
|
* 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.
|
* Returns the owner of this extension.
|
||||||
*
|
*
|
||||||
* @return Object
|
* @return SS_Object
|
||||||
*/
|
*/
|
||||||
public function getOwner() {
|
public function getOwner() {
|
||||||
return $this->owner;
|
return $this->owner;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
/**
|
/**
|
||||||
* Base class for HTML cleaning implementations.
|
* Base class for HTML cleaning implementations.
|
||||||
*/
|
*/
|
||||||
abstract class HTMLCleaner extends Object {
|
abstract class HTMLCleaner extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
24
core/Object.php
Executable file → Normal file
24
core/Object.php
Executable file → Normal file
@ -14,7 +14,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage core
|
* @subpackage core
|
||||||
*/
|
*/
|
||||||
abstract class Object {
|
abstract class SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of extension names and parameters to be applied to this object upon construction.
|
* 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,
|
// Class to create should be the calling class if not Object,
|
||||||
// otherwise the first parameter
|
// otherwise the first parameter
|
||||||
$class = get_called_class();
|
$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);
|
$class = self::getCustomClass($class);
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ abstract class Object {
|
|||||||
// Singleton to create should be the calling class if not Object,
|
// Singleton to create should be the calling class if not Object,
|
||||||
// otherwise the first parameter
|
// otherwise the first parameter
|
||||||
$class = get_called_class();
|
$class = get_called_class();
|
||||||
if($class === 'Object') $class = array_shift($args);
|
if($class === 'SS_Object') $class = array_shift($args);
|
||||||
|
|
||||||
return Injector::inst()->get($class);
|
return Injector::inst()->get($class);
|
||||||
}
|
}
|
||||||
@ -192,8 +192,8 @@ abstract class Object {
|
|||||||
// an $extension value can contain parameters as a string,
|
// an $extension value can contain parameters as a string,
|
||||||
// e.g. "Versioned('Stage','Live')"
|
// e.g. "Versioned('Stage','Live')"
|
||||||
if(strpos($classSpec,'(') === false) {
|
if(strpos($classSpec,'(') === false) {
|
||||||
if($firstArg === null) self::$_cache_inst_args[$classSpec.$firstArg] = Object::create($classSpec);
|
if($firstArg === null) self::$_cache_inst_args[$classSpec.$firstArg] = SS_Object::create($classSpec);
|
||||||
else self::$_cache_inst_args[$classSpec.$firstArg] = Object::create($classSpec, $firstArg);
|
else self::$_cache_inst_args[$classSpec.$firstArg] = SS_Object::create($classSpec, $firstArg);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
list($class, $args) = self::parse_class_spec($classSpec);
|
list($class, $args) = self::parse_class_spec($classSpec);
|
||||||
@ -201,7 +201,7 @@ abstract class Object {
|
|||||||
if($firstArg !== null) array_unshift($args, $firstArg);
|
if($firstArg !== null) array_unshift($args, $firstArg);
|
||||||
array_unshift($args, $class);
|
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
|
* defined
|
||||||
*/
|
*/
|
||||||
public static function static_lookup($class, $name, $default = null) {
|
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)) {
|
if (isset($class::$$name)) {
|
||||||
$parent = get_parent_class($class);
|
$parent = get_parent_class($class);
|
||||||
if (!$parent || !isset($parent::$$name) || $parent::$$name !== $class::$$name) return $class::$$name;
|
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) {
|
static public function get_extra_config_sources($class = null) {
|
||||||
if($class === null) $class = get_called_class();
|
if($class === null) $class = get_called_class();
|
||||||
@ -840,7 +840,7 @@ abstract class Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $extension
|
* @param SS_Object $extension
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function findMethodsFromExtension($extension) {
|
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) {
|
public function stat($name, $uncached = false) {
|
||||||
return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::FIRST_SET);
|
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) {
|
public function set_stat($name, $value) {
|
||||||
Config::inst()->update(($this->class ? $this->class : get_class($this)), $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) {
|
public function uninherited($name) {
|
||||||
return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::UNINHERITED);
|
return Config::inst()->get(($this->class ? $this->class : get_class($this)), $name, Config::UNINHERITED);
|
||||||
|
5
core/compat/Object.php
Normal file
5
core/compat/Object.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class Object extends SS_Object
|
||||||
|
{
|
||||||
|
}
|
@ -211,7 +211,7 @@ class SS_ClassManifest {
|
|||||||
* Returns an array containing all the descendants (direct and indirect)
|
* Returns an array containing all the descendants (direct and indirect)
|
||||||
* of a class.
|
* of a class.
|
||||||
*
|
*
|
||||||
* @param string|object $class
|
* @param string|SS_Object $class
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getDescendantsOf($class) {
|
public function getDescendantsOf($class) {
|
||||||
|
@ -91,7 +91,7 @@ class SS_ConfigStaticManifest {
|
|||||||
protected $statics;
|
protected $statics;
|
||||||
|
|
||||||
static protected $initial_classes = array(
|
static protected $initial_classes = array(
|
||||||
'Object', 'ViewableData', 'Injector', 'Director'
|
'SS_Object', 'ViewableData', 'Injector', 'Director'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
|
* Return the full function name. If showArgs is set to true, a string representation of the arguments will be
|
||||||
* shown
|
* shown
|
||||||
*
|
*
|
||||||
* @param Object $item
|
* @param SS_Object $item
|
||||||
* @param boolean $showArg
|
* @param boolean $showArg
|
||||||
* @param Int $argCharLimit
|
* @param Int $argCharLimit
|
||||||
* @return String
|
* @return String
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage dev
|
* @subpackage dev
|
||||||
*/
|
*/
|
||||||
abstract class BuildTask extends Object {
|
abstract class BuildTask extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a custom url segment (to follow dev/tasks/)
|
* Set a custom url segment (to follow dev/tasks/)
|
||||||
|
@ -256,7 +256,7 @@ abstract class BulkLoader extends ViewableData {
|
|||||||
* @subpackage bulkloading
|
* @subpackage bulkloading
|
||||||
* @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com)
|
* @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
|
* @var array Stores a map of ID and ClassNames
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage core
|
* @subpackage core
|
||||||
*/
|
*/
|
||||||
class CSSContentParser extends Object {
|
class CSSContentParser extends SS_Object {
|
||||||
protected $simpleXML = null;
|
protected $simpleXML = null;
|
||||||
|
|
||||||
public function __construct($content) {
|
public function __construct($content) {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage bulkloading
|
* @subpackage bulkloading
|
||||||
*/
|
*/
|
||||||
class CSVParser extends Object implements Iterator {
|
class CSVParser extends SS_Object implements Iterator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $filename
|
* @var string $filename
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage dev
|
* @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.
|
* Returns true if the current STDOUT supports the use of colour control codes.
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage dev
|
* @subpackage dev
|
||||||
*/
|
*/
|
||||||
class DebugView extends Object {
|
class DebugView extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Column size to wrap long strings to
|
* Column size to wrap long strings to
|
||||||
@ -215,7 +215,7 @@ class DebugView extends Object {
|
|||||||
/**
|
/**
|
||||||
* Outputs a variable in a user presentable way
|
* Outputs a variable in a user presentable way
|
||||||
*
|
*
|
||||||
* @param object $val
|
* @param SS_Object $val
|
||||||
* @param array $caller Caller information
|
* @param array $caller Caller information
|
||||||
*/
|
*/
|
||||||
public function writeVariable($val, $caller) {
|
public function writeVariable($val, $caller) {
|
||||||
|
@ -61,7 +61,7 @@ class SS_Log {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SS_Log::get_logger()
|
* @see SS_Log::get_logger()
|
||||||
* @var object
|
* @var SS_Object
|
||||||
*/
|
*/
|
||||||
protected static $logger;
|
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.
|
* 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() {
|
public static function get_logger() {
|
||||||
if(!static::$logger) {
|
if(!static::$logger) {
|
||||||
@ -122,7 +122,7 @@ class SS_Log {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a writer instance from the logger.
|
* 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) {
|
public static function remove_writer($writer) {
|
||||||
static::get_logger()->removeWriter($writer);
|
static::get_logger()->removeWriter($writer);
|
||||||
@ -130,7 +130,7 @@ class SS_Log {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a writer instance to the logger.
|
* 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 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
|
* @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
|
* levels, where more serious errors are lower numbers. By default this is "=", which means only
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
*
|
*
|
||||||
* @see http://code.google.com/p/spyc/
|
* @see http://code.google.com/p/spyc/
|
||||||
*/
|
*/
|
||||||
class YamlFixture extends Object {
|
class YamlFixture extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Absolute path to the .yml fixture file
|
* Absolute path to the .yml fixture file
|
||||||
|
@ -23,7 +23,7 @@ class SS_ZendLog extends Zend_Log {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a writer instance that exists in this logger.
|
* 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) {
|
public function removeWriter($writer) {
|
||||||
foreach($this->_writers as $index => $existingWriter) {
|
foreach($this->_writers as $index => $existingWriter) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage email
|
* @subpackage email
|
||||||
*/
|
*/
|
||||||
class Mailer extends Object {
|
class Mailer extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default encoding type for messages. Available options are:
|
* Default encoding type for messages. Available options are:
|
||||||
|
@ -185,7 +185,7 @@ class File extends DataObject {
|
|||||||
* Replace "[file_link id=n]" shortcode with an anchor tag or link to the file.
|
* Replace "[file_link id=n]" shortcode with an anchor tag or link to the file.
|
||||||
* @param $arguments array Arguments to the shortcode
|
* @param $arguments array Arguments to the shortcode
|
||||||
* @param $content string Content of the returned link (optional)
|
* @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
|
* @return string anchor HTML tag if content argument given, otherwise file path link
|
||||||
*/
|
*/
|
||||||
public static function link_shortcode_handler($arguments, $content = null, $parser = null) {
|
public static function link_shortcode_handler($arguments, $content = null, $parser = null) {
|
||||||
|
@ -70,7 +70,7 @@ class SS_FileFinder {
|
|||||||
|
|
||||||
// We build our options array ourselves, because possibly no class or config manifest exists at this point
|
// We build our options array ourselves, because possibly no class or config manifest exists at this point
|
||||||
do {
|
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));
|
while ($class = get_parent_class($class));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*
|
*
|
||||||
* See {@link URLSegmentFilter} for a more generic implementation.
|
* See {@link URLSegmentFilter} for a more generic implementation.
|
||||||
*/
|
*/
|
||||||
class FileNameFilter extends Object {
|
class FileNameFilter extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage filesystem
|
* @subpackage filesystem
|
||||||
*/
|
*/
|
||||||
class Filesystem extends Object {
|
class Filesystem extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage filesystem
|
* @subpackage filesystem
|
||||||
*/
|
*/
|
||||||
class GDBackend extends Object implements Image_Backend {
|
class GDBackend extends SS_Object implements Image_Backend {
|
||||||
protected $gd, $width, $height;
|
protected $gd, $width, $height;
|
||||||
protected $quality;
|
protected $quality;
|
||||||
protected $interlace;
|
protected $interlace;
|
||||||
|
@ -102,7 +102,7 @@ class Upload extends Controller {
|
|||||||
* Set a different instance than {@link Upload_Validator}
|
* Set a different instance than {@link Upload_Validator}
|
||||||
* for this upload session.
|
* for this upload session.
|
||||||
*
|
*
|
||||||
* @param object $validator
|
* @param SS_Object $validator
|
||||||
*/
|
*/
|
||||||
public function setValidator($validator) {
|
public function setValidator($validator) {
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
|
@ -58,7 +58,7 @@ class CompositeField extends FormField {
|
|||||||
// Skipping FormField::__construct(), but we have to make sure this
|
// Skipping FormField::__construct(), but we have to make sure this
|
||||||
// doesn't count as a broken constructor
|
// doesn't count as a broken constructor
|
||||||
$this->brokenOnConstruct = false;
|
$this->brokenOnConstruct = false;
|
||||||
Object::__construct();
|
SS_Object::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -514,7 +514,7 @@ class DateField_Disabled extends DateField {
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage forms
|
* @subpackage forms
|
||||||
*/
|
*/
|
||||||
class DateField_View_JQuery extends Object {
|
class DateField_View_JQuery extends SS_Object {
|
||||||
|
|
||||||
protected $field;
|
protected $field;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class FileField extends FormField {
|
|||||||
// assume that the file is connected via a has-one
|
// assume that the file is connected via a has-one
|
||||||
$hasOnes = $record->hasOne($this->name);
|
$hasOnes = $record->hasOne($this->name);
|
||||||
// try to create a file matching the relation
|
// 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) {
|
} else if($record instanceof File) {
|
||||||
$file = $record;
|
$file = $record;
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @uses DBField::scaffoldFormField()
|
* @uses DBField::scaffoldFormField()
|
||||||
* @uses DataObject::fieldLabels()
|
* @uses DataObject::fieldLabels()
|
||||||
*/
|
*/
|
||||||
class FormScaffolder extends Object {
|
class FormScaffolder extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DataObject $obj The object defining the fields to be scaffolded
|
* @var DataObject $obj The object defining the fields to be scaffolded
|
||||||
@ -131,7 +131,7 @@ class FormScaffolder extends Object {
|
|||||||
$fieldClass = (isset($this->fieldClasses[$relationship]))
|
$fieldClass = (isset($this->fieldClasses[$relationship]))
|
||||||
? $this->fieldClasses[$relationship]
|
? $this->fieldClasses[$relationship]
|
||||||
: 'GridField';
|
: 'GridField';
|
||||||
$grid = Object::create($fieldClass,
|
$grid = SS_Object::create($fieldClass,
|
||||||
$relationship,
|
$relationship,
|
||||||
$this->obj->fieldLabel($relationship),
|
$this->obj->fieldLabel($relationship),
|
||||||
$this->obj->$relationship(),
|
$this->obj->$relationship(),
|
||||||
@ -160,7 +160,7 @@ class FormScaffolder extends Object {
|
|||||||
? $this->fieldClasses[$relationship]
|
? $this->fieldClasses[$relationship]
|
||||||
: 'GridField';
|
: 'GridField';
|
||||||
|
|
||||||
$grid = Object::create($fieldClass,
|
$grid = SS_Object::create($fieldClass,
|
||||||
$relationship,
|
$relationship,
|
||||||
$this->obj->fieldLabel($relationship),
|
$this->obj->fieldLabel($relationship),
|
||||||
$this->obj->$relationship(),
|
$this->obj->$relationship(),
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* @package forms
|
* @package forms
|
||||||
* @subpackage transformations
|
* @subpackage transformations
|
||||||
*/
|
*/
|
||||||
class FormTransformation extends Object {
|
class FormTransformation extends SS_Object {
|
||||||
public function transform(FormField $field) {
|
public function transform(FormField $field) {
|
||||||
// Look for a performXXTransformation() method on the field itself.
|
// Look for a performXXTransformation() method on the field itself.
|
||||||
// performReadonlyTransformation() is a pretty commonly applied method.
|
// performReadonlyTransformation() is a pretty commonly applied method.
|
||||||
|
@ -367,7 +367,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$fromWeb->addExtraClass('content ss-uploadfield');
|
$fromWeb->addExtraClass('content ss-uploadfield');
|
||||||
|
|
||||||
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
||||||
$computerUploadField = Object::create('UploadField', 'AssetUploadField', '');
|
$computerUploadField = SS_Object::create('UploadField', 'AssetUploadField', '');
|
||||||
$computerUploadField->setConfig('previewMaxWidth', 40);
|
$computerUploadField->setConfig('previewMaxWidth', 40);
|
||||||
$computerUploadField->setConfig('previewMaxHeight', 30);
|
$computerUploadField->setConfig('previewMaxHeight', 30);
|
||||||
$computerUploadField->addExtraClass('ss-assetuploadfield');
|
$computerUploadField->addExtraClass('ss-assetuploadfield');
|
||||||
|
@ -1113,7 +1113,7 @@ class UploadField extends FileField {
|
|||||||
// to default if there is no automatic relation
|
// to default if there is no automatic relation
|
||||||
if ($relationClass = $this->getRelationAutosetClass(null)) {
|
if ($relationClass = $this->getRelationAutosetClass(null)) {
|
||||||
// Create new object explicitly. Otherwise rely on Upload::load to choose the class.
|
// 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.
|
// Get the uploaded file into a new file object.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @package forms
|
* @package forms
|
||||||
* @subpackage validators
|
* @subpackage validators
|
||||||
*/
|
*/
|
||||||
abstract class Validator extends Object {
|
abstract class Validator extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Form $form
|
* @var Form $form
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* @package forms
|
* @package forms
|
||||||
* @subpackage fields-gridfield
|
* @subpackage fields-gridfield
|
||||||
*/
|
*/
|
||||||
class GridFieldConfig extends Object {
|
class GridFieldConfig extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ArrayList
|
* @var ArrayList
|
||||||
|
@ -85,17 +85,17 @@ class GridFieldDetailForm implements GridField_URLHandler {
|
|||||||
if(is_numeric($request->param('ID'))) {
|
if(is_numeric($request->param('ID'))) {
|
||||||
$record = $gridField->getList()->byId($request->param("ID"));
|
$record = $gridField->getList()->byId($request->param("ID"));
|
||||||
} else {
|
} else {
|
||||||
$record = Object::create($gridField->getModelClass());
|
$record = SS_Object::create($gridField->getModelClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = $this->getItemRequestClass();
|
$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);
|
$handler->setTemplate($this->template);
|
||||||
|
|
||||||
// if no validator has been set on the GridField and the record has a
|
// if no validator has been set on the GridField and the record has a
|
||||||
// CMS validator, use that.
|
// 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());
|
$this->setValidator($record->getCMSValidator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @package forms
|
* @package forms
|
||||||
* @subpackage fields-gridfield
|
* @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
|
* @var integer - the record id of the level up to
|
||||||
|
@ -132,7 +132,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
|
|||||||
$dir = 'desc';
|
$dir = 'desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
$field = Object::create(
|
$field = SS_Object::create(
|
||||||
'GridField_FormAction', $gridField, 'SetOrder'.$fieldName, $title,
|
'GridField_FormAction', $gridField, 'SetOrder'.$fieldName, $title,
|
||||||
"sort$dir", array('SortColumn' => $columnField)
|
"sort$dir", array('SortColumn' => $columnField)
|
||||||
)->addExtraClass('ss-gridfield-sort');
|
)->addExtraClass('ss-gridfield-sort');
|
||||||
|
@ -37,7 +37,7 @@ class GridState extends HiddenField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $d
|
* @param mixed $d
|
||||||
* @return object
|
* @return SS_Object
|
||||||
*/
|
*/
|
||||||
public static function array_to_object($d) {
|
public static function array_to_object($d) {
|
||||||
if(is_array($d)) {
|
if(is_array($d)) {
|
||||||
|
@ -62,7 +62,7 @@ require_once 'i18nSSLegacyAdapter.php';
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage misc
|
* @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.
|
* This static variable is used to store the current defined locale.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* @uses i18nEntityProvider
|
* @uses i18nEntityProvider
|
||||||
* @uses i18n
|
* @uses i18n
|
||||||
*/
|
*/
|
||||||
class i18nTextCollector extends Object {
|
class i18nTextCollector extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default (master) locale
|
* Default (master) locale
|
||||||
|
@ -171,8 +171,8 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
|
|||||||
/**
|
/**
|
||||||
* Replaces an item in this list with another item.
|
* Replaces an item in this list with another item.
|
||||||
*
|
*
|
||||||
* @param array|object $item
|
* @param array|SS_Object $item
|
||||||
* @param array|object $with
|
* @param array|SS_Object $with
|
||||||
* @return void;
|
* @return void;
|
||||||
*/
|
*/
|
||||||
public function replace($item, $with) {
|
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
|
* Merges with another array or list by pushing all the items in it onto the
|
||||||
* end of this list.
|
* end of this list.
|
||||||
*
|
*
|
||||||
* @param array|object $with
|
* @param array|SS_Object $with
|
||||||
*/
|
*/
|
||||||
public function merge($with) {
|
public function merge($with) {
|
||||||
foreach ($with as $item) $this->push($item);
|
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.
|
* Pushes an item onto the end of this list.
|
||||||
*
|
*
|
||||||
* @param array|object $item
|
* @param array|SS_Object $item
|
||||||
*/
|
*/
|
||||||
public function push($item) {
|
public function push($item) {
|
||||||
$this->items[] = $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.
|
* Pops the last element off the end of the list and returns it.
|
||||||
*
|
*
|
||||||
* @return array|object
|
* @return array|SS_Object
|
||||||
*/
|
*/
|
||||||
public function pop() {
|
public function pop() {
|
||||||
return array_pop($this->items);
|
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.
|
* Add an item onto the beginning of the list.
|
||||||
*
|
*
|
||||||
* @param array|object $item
|
* @param array|SS_Object $item
|
||||||
*/
|
*/
|
||||||
public function unshift($item) {
|
public function unshift($item) {
|
||||||
array_unshift($this->items, $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.
|
* Shifts the item off the beginning of the list and returns it.
|
||||||
*
|
*
|
||||||
* @return array|object
|
* @return array|SS_Object
|
||||||
*/
|
*/
|
||||||
public function shift() {
|
public function shift() {
|
||||||
return array_shift($this->items);
|
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
|
* Extracts a value from an item in the list, where the item is either an
|
||||||
* object or array.
|
* object or array.
|
||||||
*
|
*
|
||||||
* @param array|object $item
|
* @param array|SS_Object $item
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -2429,7 +2429,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
// Otherwise, we need to determine if this is a complex field
|
// Otherwise, we need to determine if this is a complex field
|
||||||
if(self::is_composite_field($this->class, $field)) {
|
if(self::is_composite_field($this->class, $field)) {
|
||||||
$helper = $this->castingHelper($field);
|
$helper = $this->castingHelper($field);
|
||||||
$fieldObj = Object::create_from_string($helper, $field);
|
$fieldObj = SS_Object::create_from_string($helper, $field);
|
||||||
|
|
||||||
$compositeFields = $fieldObj->compositeDatabaseFields();
|
$compositeFields = $fieldObj->compositeDatabaseFields();
|
||||||
foreach ($compositeFields as $compositeName => $compositeType) {
|
foreach ($compositeFields as $compositeName => $compositeType) {
|
||||||
@ -2687,7 +2687,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
$castingHelper = $this->castingHelper($fieldName);
|
$castingHelper = $this->castingHelper($fieldName);
|
||||||
if($castingHelper) {
|
if($castingHelper) {
|
||||||
$fieldObj = Object::create_from_string($castingHelper, $fieldName);
|
$fieldObj = SS_Object::create_from_string($castingHelper, $fieldName);
|
||||||
$fieldObj->setValue($val);
|
$fieldObj->setValue($val);
|
||||||
$fieldObj->saveInto($this);
|
$fieldObj->saveInto($this);
|
||||||
} else {
|
} else {
|
||||||
@ -2999,7 +2999,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
|
|
||||||
// General casting information for items in $db
|
// General casting information for items in $db
|
||||||
} else if($helper = $this->db($fieldName)) {
|
} 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);
|
$obj->setValue($this->$fieldName, $this->record, false);
|
||||||
return $obj;
|
return $obj;
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ class DataQuery {
|
|||||||
}
|
}
|
||||||
if($compositeFields) foreach($compositeFields as $k => $v) {
|
if($compositeFields) foreach($compositeFields as $k => $v) {
|
||||||
if((is_null($columns) || in_array($k, $columns)) && $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);
|
$dbO->addToQuery($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class ManyManyList extends RelationList {
|
|||||||
$finalized = array();
|
$finalized = array();
|
||||||
|
|
||||||
foreach($this->extraFields as $field => $spec) {
|
foreach($this->extraFields as $field => $spec) {
|
||||||
$obj = Object::create_from_string($spec);
|
$obj = SS_Object::create_from_string($spec);
|
||||||
|
|
||||||
if($obj instanceof CompositeDBField) {
|
if($obj instanceof CompositeDBField) {
|
||||||
$this->_compositeExtraFields[$field] = array();
|
$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);
|
$obj->setValue($value, null, false);
|
||||||
|
|
||||||
$add[$fieldName] = $obj;
|
$add[$fieldName] = $obj;
|
||||||
@ -253,7 +253,7 @@ class ManyManyList extends RelationList {
|
|||||||
foreach($this->extraFields as $fieldName => $fieldSpec) {
|
foreach($this->extraFields as $fieldName => $fieldSpec) {
|
||||||
// Skip fields without an assignment
|
// Skip fields without an assignment
|
||||||
if(array_key_exists($fieldName, $extraFields)) {
|
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->setValue($extraFields[$fieldName]);
|
||||||
$fieldObject->writeToManipulation($manipulation[$this->joinTable]);
|
$fieldObject->writeToManipulation($manipulation[$this->joinTable]);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage model
|
* @subpackage model
|
||||||
*/
|
*/
|
||||||
class SS_Transliterator extends Object {
|
class SS_Transliterator extends SS_Object {
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
* @var boolean Allow the use of iconv() to perform transliteration. Set to false to disable.
|
* @var boolean Allow the use of iconv() to perform transliteration. Set to false to disable.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* See {@link FileNameFilter} for similar implementation for filesystem-based URLs.
|
* See {@link FileNameFilter} for similar implementation for filesystem-based URLs.
|
||||||
*/
|
*/
|
||||||
class URLSegmentFilter extends Object {
|
class URLSegmentFilter extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
|
@ -85,7 +85,7 @@ class UnsavedRelationList extends ArrayList {
|
|||||||
/**
|
/**
|
||||||
* Pushes an item onto the end of this list.
|
* Pushes an item onto the end of this list.
|
||||||
*
|
*
|
||||||
* @param array|object $item
|
* @param array|SS_Object $item
|
||||||
* @param array $extraFields
|
* @param array $extraFields
|
||||||
*/
|
*/
|
||||||
public function push($item, $extraFields = null) {
|
public function push($item, $extraFields = null) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage core
|
* @subpackage core
|
||||||
*/
|
*/
|
||||||
class ValidationResult extends Object {
|
class ValidationResult extends SS_Object {
|
||||||
/**
|
/**
|
||||||
* @var bool - is the result valid or not
|
* @var bool - is the result valid or not
|
||||||
*/
|
*/
|
||||||
|
@ -342,7 +342,7 @@ abstract class DBSchemaManager {
|
|||||||
$fieldSpec = substr($fieldSpec, 0, $pos);
|
$fieldSpec = substr($fieldSpec, 0, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fieldObj = Object::create_from_string($fieldSpec, $fieldName);
|
$fieldObj = SS_Object::create_from_string($fieldSpec, $fieldName);
|
||||||
$fieldObj->arrayValue = $arrayValue;
|
$fieldObj->arrayValue = $arrayValue;
|
||||||
|
|
||||||
$fieldObj->setTable($table);
|
$fieldObj->setTable($table);
|
||||||
|
@ -192,7 +192,7 @@ class MySQLiConnector extends DBConnector {
|
|||||||
case 'double':
|
case 'double':
|
||||||
$types .= 'd';
|
$types .= 'd';
|
||||||
break;
|
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 'resource':
|
||||||
case 'string':
|
case 'string':
|
||||||
case 'NULL': // Take care that a where clause should use "where XX is null" not "where XX = null"
|
case 'NULL': // Take care that a where clause should use "where XX is null" not "where XX = null"
|
||||||
|
@ -286,7 +286,7 @@ class PDOConnector extends DBConnector {
|
|||||||
return PDO::PARAM_NULL;
|
return PDO::PARAM_NULL;
|
||||||
case 'integer':
|
case 'integer':
|
||||||
return PDO::PARAM_INT;
|
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 'resource':
|
||||||
case 'float': // Not actually returnable from get_type
|
case 'float': // Not actually returnable from get_type
|
||||||
case 'double':
|
case 'double':
|
||||||
|
@ -85,7 +85,7 @@ abstract class DBField extends ViewableData {
|
|||||||
* @return DBField
|
* @return DBField
|
||||||
*/
|
*/
|
||||||
public static function create_field($className, $value, $name = null, $object = null) {
|
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);
|
$dbField->setValue($value, null, false);
|
||||||
|
|
||||||
return $dbField;
|
return $dbField;
|
||||||
|
@ -2,16 +2,24 @@
|
|||||||
|
|
||||||
if (PHP_MAJOR_VERSION < 7) {
|
if (PHP_MAJOR_VERSION < 7) {
|
||||||
spl_autoload_register('php5_compat_autoloader');
|
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) {
|
function php5_compat_autoloader($classname) {
|
||||||
$classMap = array(
|
switch (strtolower($classname)) {
|
||||||
"int" => "/framework/model/fieldtypes/compat/Int.php",
|
case 'int':
|
||||||
"float" => "/framework/model/fieldtypes/compat/Float.php",
|
require_once BASE_PATH . '/framework/model/fieldtypes/compat/Int.php';
|
||||||
);
|
break;
|
||||||
|
case 'float':
|
||||||
$classname = strtolower($classname);
|
require_once BASE_PATH . '/framework/model/fieldtypes/compat/Float.php';
|
||||||
if(isset($classMap[$classname])) {
|
break;
|
||||||
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';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @subpackage parsers
|
* @subpackage parsers
|
||||||
* @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com)
|
* @author Ingo Schommer, Silverstripe Ltd. (<firstname>@silverstripe.com)
|
||||||
*/
|
*/
|
||||||
class SQLFormatter extends Object {
|
class SQLFormatter extends SS_Object {
|
||||||
|
|
||||||
protected static $newline_before_tokens = array(
|
protected static $newline_before_tokens = array(
|
||||||
'SELECT',
|
'SELECT',
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage misc
|
* @subpackage misc
|
||||||
*/
|
*/
|
||||||
class ShortcodeParser extends Object {
|
class ShortcodeParser extends SS_Object {
|
||||||
|
|
||||||
public function img_shortcode($attrs) {
|
public function img_shortcode($attrs) {
|
||||||
return "<img src='".$attrs['src']."'>";
|
return "<img src='".$attrs['src']."'>";
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage misc
|
* @subpackage misc
|
||||||
*/
|
*/
|
||||||
abstract class TextParser extends Object {
|
abstract class TextParser extends SS_Object {
|
||||||
protected $content;
|
protected $content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage search
|
* @subpackage search
|
||||||
*/
|
*/
|
||||||
class SearchContext extends Object {
|
class SearchContext extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataObject subclass to which search parameters relate to.
|
* DataObject subclass to which search parameters relate to.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage search
|
* @subpackage search
|
||||||
*/
|
*/
|
||||||
abstract class SearchFilter extends Object {
|
abstract class SearchFilter extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Classname of the inspected {@link DataObject}
|
* @var string Classname of the inspected {@link DataObject}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage security
|
* @subpackage security
|
||||||
*/
|
*/
|
||||||
abstract class Authenticator extends Object {
|
abstract class Authenticator extends SS_Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This variable holds all authenticators that should be used
|
* This variable holds all authenticators that should be used
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage security
|
* @subpackage security
|
||||||
*/
|
*/
|
||||||
class PasswordValidator extends Object {
|
class PasswordValidator extends SS_Object {
|
||||||
|
|
||||||
private static $character_strength_tests = array(
|
private static $character_strength_tests = array(
|
||||||
'lowercase' => '/[a-z]/',
|
'lowercase' => '/[a-z]/',
|
||||||
|
@ -770,7 +770,7 @@ class Security extends Controller implements TemplateGlobalProvider {
|
|||||||
* @return Form Returns the lost password form
|
* @return Form Returns the lost password form
|
||||||
*/
|
*/
|
||||||
public function ChangePasswordForm() {
|
public function ChangePasswordForm() {
|
||||||
return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');
|
return SS_Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* @todo Make token name form specific for additional forgery protection.
|
* @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
|
* @var String
|
||||||
|
@ -15,7 +15,7 @@ interface Factory {
|
|||||||
*
|
*
|
||||||
* @param string $service The class name of the service.
|
* @param string $service The class name of the service.
|
||||||
* @param array $params The constructor parameters.
|
* @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());
|
public function create($service, array $params = array());
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ class ClassInfoTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testExists() {
|
public function testExists() {
|
||||||
$this->assertTrue(ClassInfo::exists('Object'));
|
$this->assertTrue(ClassInfo::exists('SS_Object'));
|
||||||
$this->assertTrue(ClassInfo::exists('object'));
|
$this->assertTrue(ClassInfo::exists('SS_Object'));
|
||||||
$this->assertTrue(ClassInfo::exists('ClassInfoTest'));
|
$this->assertTrue(ClassInfo::exists('ClassInfoTest'));
|
||||||
$this->assertTrue(ClassInfo::exists('CLASSINFOTEST'));
|
$this->assertTrue(ClassInfo::exists('CLASSINFOTEST'));
|
||||||
$this->assertTrue(ClassInfo::exists('stdClass'));
|
$this->assertTrue(ClassInfo::exists('stdClass'));
|
||||||
@ -97,7 +97,7 @@ class ClassInfoTest extends SapphireTest {
|
|||||||
public function testAncestry() {
|
public function testAncestry() {
|
||||||
$ancestry = ClassInfo::ancestry('ClassInfoTest_ChildClass');
|
$ancestry = ClassInfo::ancestry('ClassInfoTest_ChildClass');
|
||||||
$expect = ArrayLib::valuekey(array(
|
$expect = ArrayLib::valuekey(array(
|
||||||
'Object',
|
'SS_Object',
|
||||||
'ViewableData',
|
'ViewableData',
|
||||||
'DataObject',
|
'DataObject',
|
||||||
'ClassInfoTest_BaseClass',
|
'ClassInfoTest_BaseClass',
|
||||||
@ -191,7 +191,7 @@ class ClassInfoTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertNull(
|
$this->assertNull(
|
||||||
ClassInfo::table_for_object_field('Object', 'Title')
|
ClassInfo::table_for_object_field('SS_Object', 'Title')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertNull(
|
$this->assertNull(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ConfigTest_DefinesFoo extends Object implements TestOnly {
|
class ConfigTest_DefinesFoo extends SS_Object implements TestOnly {
|
||||||
protected static $foo = 1;
|
protected static $foo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class ConfigStaticTest_Combined3 extends ConfigStaticTest_Combined2 {
|
|||||||
private static $second = array('test_3');
|
private static $second = array('test_3');
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConfigTest_TestNest extends Object implements TestOnly {
|
class ConfigTest_TestNest extends SS_Object implements TestOnly {
|
||||||
/** @config */
|
/** @config */
|
||||||
private static $foo = 3;
|
private static $foo = 3;
|
||||||
/** @config */
|
/** @config */
|
||||||
@ -249,17 +249,17 @@ class ConfigTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testStaticLookup() {
|
public function testStaticLookup() {
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFoo', 'foo'), 1);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFoo', 'foo'), 1);
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFoo', 'bar'), null);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFoo', 'bar'), null);
|
||||||
|
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesBar', 'foo'), null);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesBar', 'foo'), null);
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesBar', 'bar'), 2);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesBar', 'bar'), 2);
|
||||||
|
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooAndBar', 'foo'), 3);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooAndBar', 'foo'), 3);
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooAndBar', 'bar'), 3);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooAndBar', 'bar'), 3);
|
||||||
|
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'foo'), 4);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'foo'), 4);
|
||||||
$this->assertEquals(Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'bar'), null);
|
$this->assertEquals(SS_Object::static_lookup('ConfigTest_DefinesFooDoesntExtendObject', 'bar'), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testForClass() {
|
public function testForClass() {
|
||||||
|
@ -119,7 +119,7 @@ class ObjectTest extends SapphireTest {
|
|||||||
$createdObj = ObjectTest_CreateTest::create('arg1', 'arg2', array(), null, 'arg5');
|
$createdObj = ObjectTest_CreateTest::create('arg1', 'arg2', array(), null, 'arg5');
|
||||||
$this->assertEquals($createdObj->constructArguments, array('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'));
|
$this->assertEquals($strongObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,18 +135,18 @@ class ObjectTest extends SapphireTest {
|
|||||||
$obj1 = ObjectTest_CreateTest::create();
|
$obj1 = ObjectTest_CreateTest::create();
|
||||||
$this->assertTrue($obj1 instanceof ObjectTest_CreateTest);
|
$this->assertTrue($obj1 instanceof ObjectTest_CreateTest);
|
||||||
|
|
||||||
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
|
SS_Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
|
||||||
$obj2 = ObjectTest_CreateTest::create();
|
$obj2 = ObjectTest_CreateTest::create();
|
||||||
$this->assertTrue($obj2 instanceof ObjectTest_CreateTest2);
|
$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);
|
$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();
|
$obj3 = ObjectTest_CreateTest::create();
|
||||||
$this->assertTrue($obj3 instanceof ObjectTest_CreateTest3);
|
$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);
|
$this->assertTrue($obj3_2 instanceof ObjectTest_CreateTest3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,14 +162,14 @@ class ObjectTest extends SapphireTest {
|
|||||||
|
|
||||||
public function testGetExtensions() {
|
public function testGetExtensions() {
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
Object::get_extensions('ObjectTest_ExtensionTest'),
|
SS_Object::get_extensions('ObjectTest_ExtensionTest'),
|
||||||
array(
|
array(
|
||||||
'oBjEcTTEST_ExtendTest1',
|
'oBjEcTTEST_ExtendTest1',
|
||||||
"ObjectTest_ExtendTest2",
|
"ObjectTest_ExtendTest2",
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
Object::get_extensions('ObjectTest_ExtensionTest', true),
|
SS_Object::get_extensions('ObjectTest_ExtensionTest', true),
|
||||||
array(
|
array(
|
||||||
'oBjEcTTEST_ExtendTest1',
|
'oBjEcTTEST_ExtendTest1',
|
||||||
"ObjectTest_ExtendTest2('FOO', 'BAR')",
|
"ObjectTest_ExtendTest2('FOO', 'BAR')",
|
||||||
@ -317,7 +317,7 @@ class ObjectTest extends SapphireTest {
|
|||||||
|
|
||||||
ObjectTest_ExtensionRemoveTest::remove_extension('ObjectTest_ExtendTest2');
|
ObjectTest_ExtensionRemoveTest::remove_extension('ObjectTest_ExtendTest2');
|
||||||
$this->assertFalse(
|
$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()"
|
"Extension added through \$add_extension() are detected as removed in has_extension()"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -329,11 +329,11 @@ class ObjectTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testParentClass() {
|
public function testParentClass() {
|
||||||
$this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'Object');
|
$this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'SS_Object');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsA() {
|
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);
|
$this->assertTrue(ObjectTest_MyObject::create() instanceof ObjectTest_MyObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,84 +402,84 @@ class ObjectTest extends SapphireTest {
|
|||||||
// Simple case
|
// Simple case
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Versioned',array('Stage', 'Live')),
|
array('Versioned',array('Stage', 'Live')),
|
||||||
Object::parse_class_spec("Versioned('Stage','Live')")
|
SS_Object::parse_class_spec("Versioned('Stage','Live')")
|
||||||
);
|
);
|
||||||
// String with commas
|
// String with commas
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Versioned',array('Stage,Live', 'Stage')),
|
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
|
// String with quotes
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Versioned',array('Stage\'Stage,Live\'Live', 'Live')),
|
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
|
// True, false and null values
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('ClassName', array('string', true, array('string', false))),
|
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(
|
$this->assertEquals(
|
||||||
array('ClassName', array(true, false, null)),
|
array('ClassName', array(true, false, null)),
|
||||||
Object::parse_class_spec('ClassName(true, false, null)')
|
SS_Object::parse_class_spec('ClassName(true, false, null)')
|
||||||
);
|
);
|
||||||
|
|
||||||
// Array
|
// Array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Enum',array(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')),
|
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
|
// Nested array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')),
|
array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')),
|
||||||
'Unsubmitted')),
|
'Unsubmitted')),
|
||||||
Object::parse_class_spec(
|
SS_Object::parse_class_spec(
|
||||||
"Enum(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')), 'Unsubmitted')")
|
"Enum(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')), 'Unsubmitted')")
|
||||||
);
|
);
|
||||||
// 5.4 Shorthand Array
|
// 5.4 Shorthand Array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Enum',array(array('Accepted', 'Pending', 'Declined', 'Unsubmitted'), 'Unsubmitted')),
|
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
|
// 5.4 Nested shorthand array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')),
|
array('Enum',array(array('Accepted', 'Pending', 'Declined', array('UnsubmittedA','UnsubmittedB')),
|
||||||
'Unsubmitted')),
|
'Unsubmitted')),
|
||||||
Object::parse_class_spec(
|
SS_Object::parse_class_spec(
|
||||||
"Enum(['Accepted', 'Pending', 'Declined', ['UnsubmittedA','UnsubmittedB']], 'Unsubmitted')")
|
"Enum(['Accepted', 'Pending', 'Declined', ['UnsubmittedA','UnsubmittedB']], 'Unsubmitted')")
|
||||||
);
|
);
|
||||||
|
|
||||||
// Associative array
|
// Associative array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Varchar', array(255, array('nullifyEmpty' => false))),
|
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
|
// Nested associative array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Test', array('string', array('nested' => array('foo' => 'bar')))),
|
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
|
// 5.4 shorthand associative array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Varchar', array(255, array('nullifyEmpty' => false))),
|
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
|
// 5.4 shorthand nested associative array
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Test', array('string', array('nested' => array('foo' => 'bar')))),
|
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
|
// Namespaced class
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('Test\MyClass', array()),
|
array('Test\MyClass', array()),
|
||||||
Object::parse_class_spec('Test\MyClass')
|
SS_Object::parse_class_spec('Test\MyClass')
|
||||||
);
|
);
|
||||||
// Fully qualified namespaced class
|
// Fully qualified namespaced class
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('\Test\MyClass', array()),
|
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
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ObjectTest_T1A extends Object {
|
class ObjectTest_T1A extends SS_Object {
|
||||||
public function testMethod() {
|
public function testMethod() {
|
||||||
return true;
|
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() {
|
public function someMethod() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObjectTest_T1C extends Object {
|
class ObjectTest_T1C extends SS_Object {
|
||||||
public function t1cMethod() {
|
public function t1cMethod() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObjectTest_T2 extends Object {
|
class ObjectTest_T2 extends SS_Object {
|
||||||
protected $failover;
|
protected $failover;
|
||||||
protected $failoverArr = array();
|
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';
|
public $title = 'my object';
|
||||||
/** @config */
|
/** @config */
|
||||||
private static $mystaticProperty = "MyObject";
|
private static $mystaticProperty = "MyObject";
|
||||||
@ -555,7 +555,7 @@ class ObjectTest_MySubObject extends ObjectTest_MyObject {
|
|||||||
static $mystaticArray = array('two');
|
static $mystaticArray = array('two');
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObjectTest_CreateTest extends Object {
|
class ObjectTest_CreateTest extends SS_Object {
|
||||||
|
|
||||||
public $constructArguments;
|
public $constructArguments;
|
||||||
|
|
||||||
@ -566,10 +566,10 @@ class ObjectTest_CreateTest extends Object {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObjectTest_CreateTest2 extends Object {}
|
class ObjectTest_CreateTest2 extends SS_Object {}
|
||||||
class ObjectTest_CreateTest3 extends Object {}
|
class ObjectTest_CreateTest3 extends SS_Object {}
|
||||||
|
|
||||||
class ObjectTest_ExtensionTest extends Object {
|
class ObjectTest_ExtensionTest extends SS_Object {
|
||||||
|
|
||||||
private static $extensions = array (
|
private static $extensions = array (
|
||||||
'oBjEcTTEST_ExtendTest1',
|
'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');
|
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 (
|
private static $extensions = array (
|
||||||
'ObjectTest_ExtendTest1',
|
'ObjectTest_ExtendTest1',
|
||||||
@ -596,7 +596,7 @@ class ObjectTest_ExtensionRemoveTest extends Object {
|
|||||||
|
|
||||||
class ObjectTest_Extension extends Extension {}
|
class ObjectTest_Extension extends Extension {}
|
||||||
|
|
||||||
class ObjectTest_CacheTest extends Object {
|
class ObjectTest_CacheTest extends SS_Object {
|
||||||
|
|
||||||
public $count = 0;
|
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');
|
private static $extensions = array('ObjectTest_ExtendTest1', 'ObjectTest_ExtendTest2');
|
||||||
public function extendableMethod($argument = null) { return "ExtendTest($argument)"; }
|
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)"; }
|
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(
|
private static $extensions = array(
|
||||||
'ObjectTest_Extending_Extension'
|
'ObjectTest_Extending_Extension'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
class i18nOtherModule extends Object {
|
class i18nOtherModule extends SS_Object {
|
||||||
public function mymethod() {
|
public function mymethod() {
|
||||||
_t(
|
_t(
|
||||||
'i18nOtherModule.ENTITY',
|
'i18nOtherModule.ENTITY',
|
||||||
|
@ -13,7 +13,7 @@ class i18nTestModule extends DataObject implements TestOnly {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class i18nTestModule_Addition extends Object {
|
class i18nTestModule_Addition extends SS_Object {
|
||||||
public function myAdditionalMethod() {
|
public function myAdditionalMethod() {
|
||||||
_t('i18nTestModule.ADDITION','Addition');
|
_t('i18nTestModule.ADDITION','Addition');
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
class i18nTestSubModule extends Object {
|
class i18nTestSubModule extends SS_Object {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
_t('i18nTestModule.OTHERENTITY', 'Other Entity');
|
_t('i18nTestModule.OTHERENTITY', 'Other Entity');
|
||||||
|
|
||||||
|
@ -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";
|
static $my_translatable_property = "Untranslated";
|
||||||
|
|
||||||
public static function my_translatable_property() {
|
public static function my_translatable_property() {
|
||||||
|
@ -843,7 +843,7 @@ class SSObjectCreator extends InjectionCreator {
|
|||||||
if (strpos($class, '(') === false) {
|
if (strpos($class, '(') === false) {
|
||||||
return parent::create($class, $params);
|
return parent::create($class, $params);
|
||||||
} else {
|
} else {
|
||||||
list($class, $params) = Object::parse_class_spec($class);
|
list($class, $params) = SS_Object::parse_class_spec($class);
|
||||||
$params = $this->injector->convertServiceProperty($params);
|
$params = $this->injector->convertServiceProperty($params);
|
||||||
return parent::create($class, $params);
|
return parent::create($class, $params);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class ManyManyListExtensionTest extends SapphireTest {
|
|||||||
// This extends ManyManyListTest_Secondary with the secondary extension that adds the relationship back
|
// 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
|
// to the primary. The instance from the fixture is ManyManyListTest_SecondarySub, deliberately a sub-class of
|
||||||
// the extended class.
|
// 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)
|
// Test from the primary (not extended) to the secondary (which is extended)
|
||||||
$primary = $this->objFromFixture('ManyManyListTest_IndirectPrimary', 'manymany_extra_primary');
|
$primary = $this->objFromFixture('ManyManyListTest_IndirectPrimary', 'manymany_extra_primary');
|
||||||
|
@ -487,7 +487,7 @@ class MemberTest extends FunctionalTest {
|
|||||||
* edit and delete their own record too.
|
* edit and delete their own record too.
|
||||||
*/
|
*/
|
||||||
public function testCanManipulateOwnRecord() {
|
public function testCanManipulateOwnRecord() {
|
||||||
$extensions = $this->removeExtensions(Object::get_extensions('Member'));
|
$extensions = $this->removeExtensions(SS_Object::get_extensions('Member'));
|
||||||
$member = $this->objFromFixture('Member', 'test');
|
$member = $this->objFromFixture('Member', 'test');
|
||||||
$member2 = $this->objFromFixture('Member', 'staffmember');
|
$member2 = $this->objFromFixture('Member', 'staffmember');
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ class MemberTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testAuthorisedMembersCanManipulateOthersRecords() {
|
public function testAuthorisedMembersCanManipulateOthersRecords() {
|
||||||
$extensions = $this->removeExtensions(Object::get_extensions('Member'));
|
$extensions = $this->removeExtensions(SS_Object::get_extensions('Member'));
|
||||||
$member = $this->objFromFixture('Member', 'test');
|
$member = $this->objFromFixture('Member', 'test');
|
||||||
$member2 = $this->objFromFixture('Member', 'staffmember');
|
$member2 = $this->objFromFixture('Member', 'staffmember');
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ class MemberTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testExtendedCan() {
|
public function testExtendedCan() {
|
||||||
$extensions = $this->removeExtensions(Object::get_extensions('Member'));
|
$extensions = $this->removeExtensions(SS_Object::get_extensions('Member'));
|
||||||
$member = $this->objFromFixture('Member', 'test');
|
$member = $this->objFromFixture('Member', 'test');
|
||||||
|
|
||||||
/* Normal behaviour is that you can't view a member unless canView() on an extension returns true */
|
/* Normal behaviour is that you can't view a member unless canView() on an extension returns true */
|
||||||
|
2
thirdparty/Zend/Currency.php
vendored
2
thirdparty/Zend/Currency.php
vendored
@ -850,7 +850,7 @@ class Zend_Currency
|
|||||||
if (!is_string($value) || (strpos($value, '0') === false)) {
|
if (!is_string($value) || (strpos($value, '0') === false)) {
|
||||||
require_once 'Zend/Currency/Exception.php';
|
require_once 'Zend/Currency/Exception.php';
|
||||||
throw new Zend_Currency_Exception("'" .
|
throw new Zend_Currency_Exception("'" .
|
||||||
((gettype($value) === 'object') ? get_class($value) : $value)
|
((gettype($value) === 'SS_Object') ? get_class($value) : $value)
|
||||||
. "' is no format token");
|
. "' is no format token");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
thirdparty/Zend/Loader/Autoloader.php
vendored
6
thirdparty/Zend/Loader/Autoloader.php
vendored
@ -371,7 +371,7 @@ class Zend_Loader_Autoloader
|
|||||||
/**
|
/**
|
||||||
* Add an autoloader to the beginning of the stack
|
* 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
|
* @param string|array $namespace Specific namespace(s) under which to register callback
|
||||||
* @return Zend_Loader_Autoloader
|
* @return Zend_Loader_Autoloader
|
||||||
*/
|
*/
|
||||||
@ -394,7 +394,7 @@ class Zend_Loader_Autoloader
|
|||||||
/**
|
/**
|
||||||
* Append an autoloader to the autoloader stack
|
* 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
|
* @param string|array $namespace Specific namespace(s) under which to register callback
|
||||||
* @return Zend_Loader_Autoloader
|
* @return Zend_Loader_Autoloader
|
||||||
*/
|
*/
|
||||||
@ -417,7 +417,7 @@ class Zend_Loader_Autoloader
|
|||||||
/**
|
/**
|
||||||
* Remove an autoloader from the autoloader stack
|
* 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
|
* @param null|string|array $namespace Specific namespace(s) from which to remove autoloader
|
||||||
* @return Zend_Loader_Autoloader
|
* @return Zend_Loader_Autoloader
|
||||||
*/
|
*/
|
||||||
|
@ -446,7 +446,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
|||||||
*
|
*
|
||||||
* @param string $resource
|
* @param string $resource
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return object
|
* @return SS_Object
|
||||||
* @throws Zend_Loader_Exception if resource type not specified or invalid
|
* @throws Zend_Loader_Exception if resource type not specified or invalid
|
||||||
*/
|
*/
|
||||||
public function load($resource, $type = null)
|
public function load($resource, $type = null)
|
||||||
|
2
thirdparty/Zend/Log.php
vendored
2
thirdparty/Zend/Log.php
vendored
@ -242,7 +242,7 @@ class Zend_Log
|
|||||||
* @param string $type 'writer' of 'filter'
|
* @param string $type 'writer' of 'filter'
|
||||||
* @param mixed $config Zend_Config or Array
|
* @param mixed $config Zend_Config or Array
|
||||||
* @param string $namespace
|
* @param string $namespace
|
||||||
* @return object
|
* @return SS_Object
|
||||||
* @throws Zend_Log_Exception
|
* @throws Zend_Log_Exception
|
||||||
*/
|
*/
|
||||||
protected function _constructFromConfig($type, $config, $namespace)
|
protected function _constructFromConfig($type, $config, $namespace)
|
||||||
|
6
thirdparty/simpletest/compatibility.php
vendored
6
thirdparty/simpletest/compatibility.php
vendored
@ -14,8 +14,8 @@ class SimpleTestCompatibility {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a copy whether in PHP5 or PHP4.
|
* Creates a copy whether in PHP5 or PHP4.
|
||||||
* @param object $object Thing to copy.
|
* @param SS_Object $object Thing to copy.
|
||||||
* @return object A copy.
|
* @return SS_Object A copy.
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
@ -128,7 +128,7 @@ class SimpleTestCompatibility {
|
|||||||
/**
|
/**
|
||||||
* Test to see if an object is a member of a
|
* Test to see if an object is a member of a
|
||||||
* class hiearchy.
|
* class hiearchy.
|
||||||
* @param object $object Object to test.
|
* @param SS_Object $object Object to test.
|
||||||
* @param string $class Root name of hiearchy.
|
* @param string $class Root name of hiearchy.
|
||||||
* @return boolean True if class in hiearchy.
|
* @return boolean True if class in hiearchy.
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @package MCManager.utils
|
* @package MCManager.utils
|
||||||
* @author Moxiecode
|
* @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);
|
define('JSON_BOOL', 1);
|
||||||
@ -474,7 +474,7 @@ class Moxiecode_JSON {
|
|||||||
case 'array':
|
case 'array':
|
||||||
return $this->_encodeArray($input);
|
return $this->_encodeArray($input);
|
||||||
|
|
||||||
case 'object':
|
case 'SS_Object':
|
||||||
return $this->_encodeArray(get_object_vars($input));
|
return $this->_encodeArray(get_object_vars($input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class ArrayData extends ViewableData {
|
|||||||
protected $array;
|
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.
|
* Converts object properties to keys of an associative array.
|
||||||
*/
|
*/
|
||||||
public function __construct($value) {
|
public function __construct($value) {
|
||||||
|
@ -131,7 +131,7 @@ class SSViewer_Scope {
|
|||||||
/**
|
/**
|
||||||
* Gets the current object and resets the scope.
|
* Gets the current object and resets the scope.
|
||||||
*
|
*
|
||||||
* @return object
|
* @return SS_Object
|
||||||
*/
|
*/
|
||||||
public function self() {
|
public function self() {
|
||||||
$result = $this->itemIterator ? $this->itemIterator->current() : $this->item;
|
$result = $this->itemIterator ? $this->itemIterator->current() : $this->item;
|
||||||
@ -637,7 +637,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
|
|||||||
if ($val) {
|
if ($val) {
|
||||||
$obj = $val['obj'];
|
$obj = $val['obj'];
|
||||||
if ($name === 'hasValue') {
|
if ($name === 'hasValue') {
|
||||||
$res = $obj instanceof Object
|
$res = $obj instanceof SS_Object
|
||||||
? $obj->exists()
|
? $obj->exists()
|
||||||
: (bool)$obj;
|
: (bool)$obj;
|
||||||
} else {
|
} else {
|
||||||
@ -1139,10 +1139,10 @@ class SSViewer implements Flushable {
|
|||||||
* Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call
|
* 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 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 $overlay - Any variables to layer on top of the scope
|
||||||
* @param array|null $underlay - Any variables to layer underneath 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
|
* @return string - The result of executing the template
|
||||||
*/
|
*/
|
||||||
@ -1179,7 +1179,7 @@ class SSViewer implements Flushable {
|
|||||||
*
|
*
|
||||||
* @param ViewableData $item
|
* @param ViewableData $item
|
||||||
* @param array|null $arguments - arguments to an included template
|
* @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.
|
* @return HTMLText Parsed template output.
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @package framework
|
* @package framework
|
||||||
* @subpackage view
|
* @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:
|
* 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;
|
$castConstructor = $this->config()->default_cast;
|
||||||
}
|
}
|
||||||
|
|
||||||
$valueObject = Object::create_from_string($castConstructor, $fieldName);
|
$valueObject = SS_Object::create_from_string($castConstructor, $fieldName);
|
||||||
$valueObject->setValue($value, $this);
|
$valueObject->setValue($value, $this);
|
||||||
|
|
||||||
$value = $valueObject;
|
$value = $valueObject;
|
||||||
@ -516,7 +516,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
|||||||
public function hasValue($field, $arguments = null, $cache = true) {
|
public function hasValue($field, $arguments = null, $cache = true) {
|
||||||
$result = $cache ? $this->cachedCall($field, $arguments) : $this->obj($field, $arguments, false, false);
|
$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();
|
return $result->exists();
|
||||||
} else {
|
} else {
|
||||||
// Empty paragraph checks are a workaround for TinyMCE
|
// 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) {
|
public function XML_val($field, $arguments = null, $cache = false) {
|
||||||
$result = $this->obj($field, $arguments, false, $cache);
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user