当前位置: 首页>>代码示例>>PHP>>正文


PHP Annotation::isAccessValid方法代码示例

本文整理汇总了PHP中Annotation::isAccessValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::isAccessValid方法的具体用法?PHP Annotation::isAccessValid怎么用?PHP Annotation::isAccessValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Annotation的用法示例。


在下文中一共展示了Annotation::isAccessValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setAccess

 function setAccess($access)
 {
     if (Annotation::isAccessValid($access)) {
         $this->access = $access;
     }
 }
开发者ID:njorth,项目名称:marginalia,代码行数:6,代码来源:annotation.php

示例2: annotationFromParams

 /**
  * Set annotation fields based on parameters (e.g. from $_POST)
  * For updates, first retrieve the stored annotation, then update it here.
  * If this fails, the passed annotation object may have already been altered.
  * Different implementations may have different annotation objects.  All should
  * be compatible with this code if they have the appropriate getters and setters.
  */
 function annotationFromParams(&$annotation, &$params)
 {
     // ID
     // must be setAnnotationId, not setId, because of a conflict with a base class method in OJS
     if (array_key_exists('id', $params)) {
         $id = $params['id'];
         $annotation->setAnnotationId($id);
     }
     // UserId
     if (array_key_exists('userid', $params)) {
         $userid = $params['userid'];
         $annotation->setUserId($userid);
     }
     // UserName
     if (array_key_exists('username', $params)) {
         $userName = $params['username'];
         $annotation->setUserName($userName);
     }
     // Sequence Range
     if (array_key_exists('sequence-range', $params)) {
         $sequenceRange = new SequenceRange();
         $sequenceRange->fromString($params['sequence-range']);
         $annotation->setSequenceRange($sequenceRange);
     }
     // XPath Range
     if (array_key_exists('xpath-range', $params)) {
         $xpathRange = new XPathRange();
         $xpathRange->fromString($params['xpath-range']);
         if (!XPathPoint::isXPathSafe($xpathRange->start->getPathStr()) || !XPathPoint::isXPathSafe($xpathRange->end->getPathStr())) {
             return XPATH_SECURITY_ERROR;
         }
         $annotation->setXPathRange($xpathRange);
     }
     // URL
     if (array_key_exists('url', $params)) {
         $url = $params['url'];
         if (!$url || !MarginaliaHelper::isUrlSafe($url)) {
             return URL_SCHEME_ERROR;
         }
         $annotation->setUrl($url);
     }
     // Note
     if (array_key_exists('note', $params)) {
         $note = $params['note'];
         $annotation->setNote($note);
     }
     // Quote
     if (array_key_exists('quote', $params)) {
         $quote = $params['quote'];
         $annotation->setQuote($quote);
     }
     // QuoteTitle
     if (array_key_exists('quote_title', $params)) {
         $quoteTitle = $params['quote_title'];
         $annotation->setQuoteTitle($quoteTitle);
     }
     // QuoteAuthorId
     if (array_key_exists('quote_author_id', $params)) {
         $quoteAuthorId = $params['quote_author_id'];
         $annotation->setQuoteAuthorId($quoteAuthorId);
     }
     // QuoteAuthorName
     if (array_key_exists('quote_author_name', $params)) {
         $quoteAuthorName = $params['quote_author_name'];
         $annotation->setQuoteAuthorName($quoteAuthorName);
     }
     // Access
     if (array_key_exists('access', $params)) {
         $access = $params['access'];
         if (!Annotation::isAccessValid($access)) {
             return ACCESS_VALUE_ERROR;
         }
         $annotation->setAccess($access);
     }
     // Action
     if (array_key_exists('action', $params)) {
         $action = $params['action'];
         if (!Annotation::isActionValid($action)) {
             return ACTION_VALUE_ERROR;
         }
         $annotation->setAction($action);
     }
     // Link
     if (array_key_exists('link', $params)) {
         $link = $params['link'];
         if ($link && !MarginaliaHelper::isUrlSafe($link)) {
             return URL_SCHEME_ERROR;
         }
         $annotation->setLink($link);
     }
     // Link Title
     if (array_key_exists('link_title', $params)) {
         $title = $params['link_title'];
//.........这里部分代码省略.........
开发者ID:njorth,项目名称:marginalia,代码行数:101,代码来源:MarginaliaHelper.php

示例3: setAccess

 function setAccess($access)
 {
     if (Annotation::isAccessValid($access)) {
         $this->setData('access', $access);
     }
 }
开发者ID:njorth,项目名称:marginalia,代码行数:6,代码来源:Annotation.inc.php


注:本文中的Annotation::isAccessValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。