當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。