Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
me@iandavis.com committed Mar 25, 2009
1 parent 0567993 commit bdc2cc5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
7 changes: 7 additions & 0 deletions paget_form.class.php
Expand Up @@ -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:
* <ul>
* <li>note - a long text field, typically rendered as a textarea</li>
* <li>resource - a field for entering URIs</li>
* </ul>
**/
function define_field($field_name, $property, $resource = 'this', $type = '') {
$this->_fields[$field_name] = array('resource' => $resource, 'property' => $property, 'type' => $type);
}
Expand Down
2 changes: 1 addition & 1 deletion paget_request.class.php
Expand Up @@ -218,7 +218,7 @@ function _getAcceptHeader()
}
return $accepts;
}
return array('text/html');
return array('*/*');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion paget_seeotherredirect.class.php
@@ -1,5 +1,5 @@
<?php

// OBSOLETE

class PAGET_SeeOtherRedirect {
var $_uri;
Expand Down
9 changes: 6 additions & 3 deletions paget_urispace.class.php
Expand Up @@ -51,10 +51,9 @@ function get_resource($request) {
$desc = $this->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;
Expand Down Expand Up @@ -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;
}

}


Expand Down
2 changes: 2 additions & 0 deletions tests/runtests.php
Expand Up @@ -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';
Expand All @@ -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');
Expand Down

0 comments on commit bdc2cc5

Please sign in to comment.