本文整理汇总了PHP中UUID::isUUID方法的典型用法代码示例。如果您正苦于以下问题:PHP UUID::isUUID方法的具体用法?PHP UUID::isUUID怎么用?PHP UUID::isUUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UUID
的用法示例。
在下文中一共展示了UUID::isUUID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: locateObject
public function locateObject($slug, $parent = null, $kind = null, $universe = null)
{
$query = array();
$query['limit'] = 1;
if ($parent !== false) {
$query['parent'] = $parent;
}
if ($kind !== null) {
$query['kind'] = $kind;
}
if ($universe !== null) {
$query['universe'] = $universe;
}
if (null !== ($uuid = UUID::isUUID($slug))) {
$query['uuid'] = $uuid;
} else {
if (strpos($slug, ':') !== false) {
$query['iri'] = $slug;
} else {
$query['tag'] = $slug;
}
}
$rs = $this->query($query);
foreach ($rs as $obj) {
return $obj;
}
return null;
}
示例2: getObject
protected function getObject()
{
$this->title = $this->object->title;
$this->crumbName = $this->object->title;
$this->addCrumb();
if (null !== ($tag = $this->request->consume())) {
$obj = null;
if (null !== ($uuid = UUID::isUUID($tag))) {
$rs = $this->model->query(array('uuid' => $uuid, 'parent' => $this->object->uuid));
$obj = $rs->next();
} else {
$rs = $this->model->query(array('tag' => $tag, 'parent' => $this->object->uuid));
$obj = $rs->next();
}
if (!$obj) {
return $this->error(Error::OBJECT_NOT_FOUND);
}
switch ($obj->kind) {
case 'episode':
require_once dirname(__FILE__) . '/browse-episode.php';
$inst = new MediaBrowseEpisode();
$inst->object = $obj;
$inst->process($this->request);
return false;
}
print_r($obj);
die('-- unhandled object --');
}
$this->object->merge();
$this->episodes = $this->model->query(array('kind' => 'episode', 'parent' => $this->object->uuid));
if ($this->episodes->EOF) {
$this->episodes = null;
}
return true;
}
示例3: verify
public function verify()
{
$model = self::$models[get_class($this)];
if (isset($this->show)) {
if (null !== ($uuid = UUID::isUUID($this->show)) || null !== ($uuid = $model->uuidForCurie($this->show))) {
$this->referenceObject('show', $uuid);
} else {
return "Referenced show '" . $this->show . "' does not exist yet.";
}
}
return parent::verify();
}
示例4: verify
public function verify()
{
$model = self::$models[get_class($this)];
if (isset($this->episode)) {
if (null !== ($uuid = UUID::isUUID($this->episode)) || null !== ($uuid = $model->uuidForCurie($this->episode))) {
$this->referenceObject('episode', $uuid);
} else {
return "Referenced episode '" . $this->episode . "' does not exist yet.";
}
}
if (true !== ($r = $this->verifyCredits())) {
return $r;
}
return parent::verify();
}
示例5: getObject
protected function getObject()
{
if (null === ($tag = $this->request->consume())) {
return true;
}
if ($uuid = UUID::isUUID($tag)) {
$this->object = $this->model->objectForUUID($uuid);
} else {
$this->object = $this->model->locateObject($tag);
}
if ($this->object) {
if ($this->object instanceof Episode) {
if (isset($this->object->series) || isset($this->object->show)) {
$this->request->redirect($this->request->base . $this->object->relativeURI);
return false;
}
require_once dirname(__FILE__) . '/browse-episode.php';
$inst = new MediaBrowseEpisode();
$inst->object = $this->object;
$inst->process($this->request);
return false;
}
if ($this->object instanceof Show) {
if ($this->object->kind == 'series') {
$this->request->redirect($this->request->base . $this->object->relativeURI);
}
require_once dirname(__FILE__) . '/browse-show.php';
$inst = new MediaBrowseShow();
$inst->object = $this->object;
$inst->process($this->request);
return false;
}
if ($this->object instanceof Scheme) {
require_once dirname(__FILE__) . '/browse-classes.php';
$inst = new MediaBrowseClasses();
$inst->object = $this->object;
$inst->process($this->request);
return false;
}
print_r($this->object);
die;
}
return $this->error(Error::OBJECT_NOT_FOUND);
}
示例6: writeRDFResource
protected function writeRDFResource($tag, $uri, $fragment)
{
if (UUID::isUUID($uri)) {
/* Fetch target */
} else {
if (substr($uri, 0, 1) == '/') {
writeLn('<' . $tag . ' rdf:resource="' . _e($uri . '#' . $fragment) . '" />');
} else {
writeLn('<' . $tag . ' rdf:resource="' . _e($uri) . '" />');
}
}
}
示例7: rdfReference
protected function rdfReference($uri, $request, $fragment = null, $all = false)
{
if (strlen($fragment)) {
$fragment = '#' . $fragment;
}
if (null !== ($uuid = UUID::isUUID($uri))) {
/* Fetch target */
$obj = self::$models[get_class($this)]->objectForUUID($uuid);
if ($all) {
$list = array();
while ($obj && $obj->kind != 'scheme') {
$list[] = new RDFURI($request->base . $obj->__get('instanceRelativeURI'));
$obj = $obj['parent'];
}
return $list;
}
return new RDFURI($request->base . $obj->__get('instanceRelativeURI'));
}
if (substr($uri, 0, 1) == '/') {
return new RDFURI($uri . $fragment);
}
return new RDFURI($uri);
}
示例8: verify
public function verify()
{
if (true !== ($r = parent::verify())) {
return $r;
}
$model = self::$models[get_class($this)];
if (!isset($this->parent)) {
$this->parent = null;
}
if (!isset($this->iri)) {
$this->iri = null;
}
$cs = $model->locateObject('[scheme:' . $this->kind . ']', null, 'scheme');
$this->referenceObject('scheme', $cs);
if (!isset($this->fragment)) {
$this->fragment = $cs->singular;
}
$root = '/' . $cs->relativeURI;
$parent = $this->parent;
if (substr($parent, 1, 0) == '/') {
$parent = substr($parent, 1);
}
if (!strncmp($parent, $root, strlen($root))) {
$parent = substr($parent, strlen($root));
}
if (strlen($parent)) {
if (null === ($uuid = UUID::isUUID($parent))) {
$uuid = $model->createClassificationPath($cs, $parent);
}
if (null === $uuid && strlen($parent)) {
return 'Referenced parent path "' . $this->parent . '" is invalid';
}
} else {
$this->parent = $parent = null;
$uuid = $cs->uuid;
}
$this->referenceObject('parent', $uuid);
if (!isset($this->slug) || !strlen($this->slug)) {
$this->slug = $this->uuid;
}
$p = $this->parent;
$uri = array($this->slug);
$ancestors = array();
while ($p !== null) {
$ancestors[] = $p;
$data = $model->dataForUUID($p);
array_unshift($uri, $data['slug']);
$p = isset($data['parent']) ? $data['parent'] : null;
}
$this->relativeURI = implode('/', $uri);
$this->iri[] = $root . implode('/', $uri);
$this->ancestors = $ancestors;
return true;
}