diff --git a/composer.json b/composer.json index 65d0cd2..8b48736 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "sciactive/nymph-server", "description": "Powerful object data storage and querying for collaborative web apps.", - "version": "2.1.0", - "time": "2017-10-24", + "version": "2.2.0", + "time": "2017-10-25", "homepage": "http://nymph.io/", "type": "library", "authors": [ @@ -49,7 +49,7 @@ "sciactive/requirephp": "~1.3" }, "require-dev": { - "sciactive/hookphp": "~2.0", + "sciactive/hookphp": "~2.0.1", "phpunit/phpunit": "^6.1" } } diff --git a/composer.lock b/composer.lock index 2a620a8..7a8936e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c5175898cc2f7112f12650db60923838", + "content-hash": "0a2a76843dc726379cc43ceb3ff3cde6", "packages": [ { "name": "sciactive/requirephp", @@ -859,16 +859,16 @@ }, { "name": "sciactive/hookphp", - "version": "2.0.0", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sciactive/hookphp.git", - "reference": "f0605a702ee42eeb1d58220c1ad900e47a0b37cb" + "reference": "adde48e776bd98d01a639c9bccff0fbca0cea6d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sciactive/hookphp/zipball/f0605a702ee42eeb1d58220c1ad900e47a0b37cb", - "reference": "f0605a702ee42eeb1d58220c1ad900e47a0b37cb", + "url": "https://api.github.com/repos/sciactive/hookphp/zipball/adde48e776bd98d01a639c9bccff0fbca0cea6d6", + "reference": "adde48e776bd98d01a639c9bccff0fbca0cea6d6", "shasum": "" }, "require": { @@ -905,7 +905,7 @@ "interception", "method hooking" ], - "time": "2017-06-17T00:00:00+00:00" + "time": "2017-10-24T00:00:00+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/src/DataObjectInterface.php b/src/DataObjectInterface.php index 2110a1d..344ec7b 100644 --- a/src/DataObjectInterface.php +++ b/src/DataObjectInterface.php @@ -49,32 +49,6 @@ public function equals(&$object); * $array is not an array. */ public function inArray($array, $strict = false); - /** - * Get info about an object. - * - * This function is meant to provide a way to represent an object even when - * nothing is known about it. - * - * There are a few common types that most entities/objects should provide. - * - name - The name of the object. - * - type - The type of data this object represents. (E.g., "user", - * "customer", "page".) This can be localized. - * - types - The same as above, but pluralized. (E.g., "users".) - * - url_view - The URL where this object can be viewed. If the currently - * logged in user doesn't have the ability to view it, or there is no URL - * to view it, this should return null. - * - url_edit - The same as above, but for editing. - * - url_list - The URL where this object, and others like it, can be found. - * (E.g., to a list of users.) - * - icon - The class to apply for an icon representing this object. - * (Generally a Font Awesome or Bootstrap class.) - * - image - The URL to an image representing this object. - * - * @param string $type The type of information being requested. - * @return mixed The information, or null if the information doesn't exist or - * can't be returned. - */ - public function info($type); /** * Perform a less strict comparison of this object to another. * diff --git a/src/Drivers/DriverTrait.php b/src/Drivers/DriverTrait.php index 0449410..208716a 100644 --- a/src/Drivers/DriverTrait.php +++ b/src/Drivers/DriverTrait.php @@ -163,7 +163,7 @@ public function checkData( ( ( !isset($data[$cur_value[0]]) - && !$cur_value[1] + && $cur_value[1] == null ) || ( isset($data[$cur_value[0]]) @@ -203,17 +203,19 @@ public function checkData( '~', '[[:<:]]', '[[:>:]]', - '[:alnum:]]', - '[:alpha:]]', - '[:blank:]]', - '[:cntrl:]]', - '[:digit:]]', - '[:graph:]]', - '[:lower:]]', - '[:print:]]', - '[:punct:]]', - '[:space:]]', - '[:upper:]]', + '[:alnum:]', + '[:alpha:]', + '[:ascii:]', + '[:blank:]', + '[:cntrl:]', + '[:digit:]', + '[:graph:]', + '[:lower:]', + '[:print:]', + '[:punct:]', + '[:space:]', + '[:upper:]', + '[:word:]', '[:xdigit:]', ], [ @@ -222,6 +224,7 @@ public function checkData( '(?<=\w)\b', '[A-Za-z0-9]', '[A-Za-z]', + '[\x00-\x7F]', '\s', '[\000\001\002\003\004\005\006\007\008\009\010\011\012\013\014\015\016\017\018\019\020\021\022\023\024\025\026\027\028\029\030\031\032\033\034\035\036\037\177]', '\d', @@ -231,6 +234,7 @@ public function checkData( '[!"#$%&\'()*+,\-./:;<=>?@[\\\]^_`{|}\~]', '[\t\n\x0B\f\r ]', '[A-Z]', + '[A-Za-z0-9_]', '[0-9A-Fa-f]', ], $cur_value[1] diff --git a/src/Entity.php b/src/Entity.php index 85b6531..9309eb7 100644 --- a/src/Entity.php +++ b/src/Entity.php @@ -72,8 +72,6 @@ * @property int $guid The entity's Globally Unique ID. * @property int $cdate The entity's creation date, as a high precision Unix timestamp. The value is rounded to the ten thousandths digit. * @property int $mdate The entity's modification date, as a high precision Unix timestamp. The value is rounded to the ten thousandths digit. - * @property string $name An optional name of the entity. This will be provided - * in the "info" property of the JS object. */ class Entity implements EntityInterface { const ETYPE = 'entity'; @@ -708,17 +706,6 @@ public function inArray($array, $strict = false) { return $this->arraySearch($array, $strict) !== false; } - public function info($type) { - if ($type == 'name' && isset($this->name)) { - return $this->name; - } elseif ($type == 'type') { - return 'entity'; - } elseif ($type == 'types') { - return 'entities'; - } - return null; - } - public function is(&$object) { if ($this->isASleepingReference) { $this->referenceWake(); @@ -752,26 +739,6 @@ public function jsonSerialize($clientClassName = true) { $object->cdate = $this->cdate; $object->mdate = $this->mdate; $object->tags = $this->tags; - $object->info = [ - 'name' => $this->info('name'), - 'type' => $this->info('type'), - 'types' => $this->info('types') - ]; - if ($this->info('url_view')) { - $object->info['url_view'] = $this->info('url_view'); - } - if ($this->info('url_edit')) { - $object->info['url_edit'] = $this->info('url_edit'); - } - if ($this->info('url_list')) { - $object->info['url_list'] = $this->info('url_list'); - } - if ($this->info('icon')) { - $object->info['icon'] = $this->info('icon'); - } - if ($this->info('image')) { - $object->info['image'] = $this->info('image'); - } $object->data = []; foreach ($this->getData(true) as $key => $val) { if (!in_array($key, $this->privateData)) { diff --git a/src/Nymph.php b/src/Nymph.php index 7faeafb..a6c304f 100644 --- a/src/Nymph.php +++ b/src/Nymph.php @@ -26,7 +26,7 @@ * @link http://nymph.io/ */ class Nymph { - const VERSION = '2.1.0'; + const VERSION = '2.2.0'; public static function __callStatic($name, $args) { return call_user_func_array(array(RequirePHP::_('Nymph'), $name), $args); diff --git a/testing/TestModel.php b/testing/TestModel.php index 7bade62..be3e460 100644 --- a/testing/TestModel.php +++ b/testing/TestModel.php @@ -29,17 +29,6 @@ public function __construct($id = 0) { parent::__construct($id); } - public function info($type) { - if ($type == 'name' && isset($this->name)) { - return $this->name; - } elseif ($type == 'type') { - return 'test'; - } elseif ($type == 'types') { - return 'tests'; - } - return null; - } - public function useProtectedData() { $this->whitelistData = false; $this->protectedData = ['number']; diff --git a/testing/tests/EntityTest.php b/testing/tests/EntityTest.php index cce1315..adefd0f 100644 --- a/testing/tests/EntityTest.php +++ b/testing/tests/EntityTest.php @@ -243,8 +243,7 @@ public function testJSON($arr) { $this->assertJsonStringEqualsJsonString( '{"guid":' . $testEntity->guid.',"cdate":' . json_encode($testEntity->cdate) . ',"mdate":' . - json_encode($testEntity->mdate) . ',"tags":["test"],"info":' . - '{"name":"Entity Test","type":"test","types":"tests"},"data":' . + json_encode($testEntity->mdate) . ',"tags":["test"],"data":' . '{"reference":["nymph_entity_reference",' . $arr['refGuid'] . ',"TestModel"],"ref_array":[{"entity":' . '["nymph_entity_reference",' .