diff --git a/paget_form.class.php b/paget_form.class.php index a51f07d..6a3ee1f 100644 --- a/paget_form.class.php +++ b/paget_form.class.php @@ -49,6 +49,13 @@ function define_subresource($resource_name, $relation_to_primary) { $this->_resources[$resource_name] = array('uri' => $this->get_subresource_uri($resource_name), 'relation' => $relation_to_primary); } + /** + * Predefined field types: + * + **/ function define_field($field_name, $property, $resource = 'this', $type = '') { $this->_fields[$field_name] = array('resource' => $resource, 'property' => $property, 'type' => $type); } diff --git a/paget_request.class.php b/paget_request.class.php index 49b2dab..3291ab1 100644 --- a/paget_request.class.php +++ b/paget_request.class.php @@ -218,7 +218,7 @@ function _getAcceptHeader() } return $accepts; } - return array('text/html'); + return array('*/*'); } /** diff --git a/paget_seeotherredirect.class.php b/paget_seeotherredirect.class.php index d8e529d..7870eb5 100644 --- a/paget_seeotherredirect.class.php +++ b/paget_seeotherredirect.class.php @@ -1,5 +1,5 @@ get_description($res->get_best_description_uri()); $form = $this->get_form($this->_forms[$path], $uri, $desc); return $form; -// return new PAGET_PermanentRedirect('http://' . $_SERVER["HTTP_HOST"] . $this->_redirects[$path]); } - - if (preg_match('~^(.+)\.(html|rdf|xml|turtle|json)$~', $uri)) { + + if ($this->is_ir($uri)) { $desc = $this->get_description($uri); if ($desc == null ) return null; if ($desc->is_valid()) return $desc; @@ -159,6 +158,10 @@ function _has_http_method(&$resource, $method) return FALSE; } + function is_ir($uri) { + return preg_match('~^(.+)\.(html|rdf|xml|turtle|json)$~', $uri) ? TRUE : FALSE; + } + } diff --git a/tests/runtests.php b/tests/runtests.php index 921cf7b..d7f04ad 100644 --- a/tests/runtests.php +++ b/tests/runtests.php @@ -3,6 +3,7 @@ define('PHPUnit_MAIN_METHOD', 'PAGET_AllTests::main'); } require_once dirname(__FILE__) . '/paget_resourcedescription.test.php'; +require_once dirname(__FILE__) . '/paget_urispace.test.php'; require_once dirname(__FILE__) . '/paget_simplepropertylabeller.test.php'; require_once dirname(__FILE__) . '/paget_simpleinferencer.test.php'; require_once dirname(__FILE__) . '/paget_form.test.php'; @@ -19,6 +20,7 @@ public static function suite() $suite = new PHPUnit_Framework_TestSuite('Paget Framework Tests'); //$suite->addTestSuite('PAGET_ResourceDescriptionTest'); + $suite->addTestSuite('PAGET_UriSpaceTest'); $suite->addTestSuite('PAGET_SimplePropertyLabellerTest'); $suite->addTestSuite('PAGET_SimpleInferencerTest'); $suite->addTestSuite('PAGET_FormTest');