本文整理汇总了PHP中Store::get_metabox方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::get_metabox方法的具体用法?PHP Store::get_metabox怎么用?PHP Store::get_metabox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::get_metabox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Store
function select_value($pool_uri, $value, $pool_size)
{
if (!isset($this->bigfootMetabox)) {
$bigfoot = new Store(STORE_URI);
$this->bigfootMetabox = $bigfoot->get_metabox();
}
$changeset = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cs="http://purl.org/vocab/changeset/schema#">
<cs:ChangeSet>
<cs:subjectOfChange rdf:resource="' . $pool_uri . '"/>
<cs:creatorName>pool</cs:creatorName>
<cs:changeReason>Selecting key</cs:changeReason>
<cs:removal>
<rdf:Statement>
<rdf:subject rdf:resource="' . $pool_uri . '"/>
<rdf:predicate rdf:resource="http://purl.org/vocab/value-pools/schema#value"/>
<rdf:object>' . $value . '</rdf:object>
</rdf:Statement>
</cs:removal>
<cs:addition>
<rdf:Statement>
<rdf:subject rdf:resource="' . $pool_uri . '"/>
<rdf:predicate rdf:resource="http://purl.org/vocab/value-pools/schema#value"/>
<rdf:object>' . ($pool_size + $value) . '</rdf:object>
</rdf:Statement>
</cs:addition>
</cs:ChangeSet>
</rdf:RDF>';
$response = $this->bigfootMetabox->apply_changeset_rdfxml($changeset);
// echo "<pre>";
// echo htmlspecialchars(print_r($response, true));
// echo "</pre>";
return true;
}
示例2: update
/**
* Updates data in a platform store.
*
* Note that this method is in beta: it has been tested but there may be unusual corner cases that could result in data corruption
*
* Update the resource description for anything with a name of "shaggy" to have a name of "scooby":
*
* <code language="php">
* $dt = new DataTable('http://api.talis.com/stores/mystore');
* $dt->map('http://example.org/name', 'name');
* $dt->set('name', 'scooby');
* $dt->where('name', 'shaggy');
* $response = $dt->update();
* </code>
*
* The special variable "!_uri" can be used to refer to a specific resource.
*
* Update the resource description for http://example.com/thing to have a name of "scooby"
*
* <code language="php">
* $dt = new DataTable('http://api.talis.com/stores/mystore');
* $dt->map('http://example.org/name', 'name');
* $dt->set('name', 'scooby');
* $dt->where('_uri', 'http://example.com/thing');
* $response = $dt->update();
* </code>
*
* @return HttpResponse
*/
function update()
{
$cs = $this->get_update_changeset();
$changesets = $cs->get_subjects_of_type(CS_CHANGESET);
$store = new Store($this->_store_uri, $this->_credentials, $this->_request_factory);
$mb = $store->get_metabox();
if (count($changesets) > 0 && count($cs->get_resource_triple_values($changesets[0], CS_REMOVAL)) > 0) {
//printf("<p><strong>Posting a changeset</strong></p><pre>%s</pre>", $cs->to_turtle());
return $mb->apply_changeset_rdfxml($cs->to_rdfxml());
} else {
$g = $this->get_insert_graph('');
//printf("<p><strong>Submitting RDF</strong></p><pre>%s</pre>", $g->to_turtle());
return $mb->submit_turtle($g->to_turtle());
}
}
示例3: Credentials
function test_get_metabox_includes_sets_credentials()
{
$credentials = new Credentials('scooby', 'shaggy');
$store = new Store("http://example.org/store", $credentials);
$this->assertEquals($credentials, $store->get_metabox()->credentials);
}