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


PHP LogPage::getRestriction方法代码示例

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


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

示例1: getTypeSelector

 /**
  * Returns log page selector.
  * @return XmlSelect
  * @since 1.19
  */
 public function getTypeSelector()
 {
     $typesByName = array();
     // Temporary array
     // First pass to load the log names
     foreach (LogPage::validTypes() as $type) {
         $page = new LogPage($type);
         $restriction = $page->getRestriction();
         if ($this->getUser()->isAllowed($restriction)) {
             $typesByName[$type] = $page->getName()->text();
         }
     }
     // Second pass to sort by name
     asort($typesByName);
     // Always put "All public logs" on top
     $public = $typesByName[''];
     unset($typesByName['']);
     $typesByName = array('' => $public) + $typesByName;
     $select = new XmlSelect('type');
     foreach ($typesByName as $type => $name) {
         $select->addOption($name, $type);
     }
     return $select;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:29,代码来源:LogEventsList.php

示例2: getDisallowedErrorMessage

 /**
  * @todo Move this to AbstractBlock and use for summary/header/etc.
  * @param AbstractRevision $revision
  * @return Message
  */
 protected function getDisallowedErrorMessage(AbstractRevision $revision)
 {
     if (in_array($this->action, array('moderate-topic', 'moderate-post'))) {
         /*
          * When failing to moderate an already moderated action (like
          * undo), show the more general "you have insufficient
          * permissions for this action" message, rather than the
          * specialized "this topic is <hidden|deleted|suppressed>" msg.
          */
         return $this->context->msg('flow-error-not-allowed');
     }
     $state = $revision->getModerationState();
     // display simple message
     // i18n messages:
     //  flow-error-not-allowed-hide,
     //  flow-error-not-allowed-reply-to-hide-topic
     //  flow-error-not-allowed-delete
     //  flow-error-not-allowed-reply-to-delete-topic
     //  flow-error-not-allowed-suppress
     //  flow-error-not-allowed-reply-to-suppress-topic
     if ($revision instanceof PostRevision) {
         $type = $revision->isTopicTitle() ? 'topic' : 'post';
     } else {
         $type = $revision->getRevisionType();
     }
     // Show a snippet of the relevant log entry if available.
     if (\LogPage::isLogType($state)) {
         // check if user has sufficient permissions to see log
         $logPage = new \LogPage($state);
         if ($this->context->getUser()->isAllowed($logPage->getRestriction())) {
             // LogEventsList::showLogExtract will write to OutputPage, but we
             // actually just want that text, to write it ourselves wherever we want,
             // so let's create an OutputPage object to then get the content from.
             $rc = new \RequestContext();
             $output = $rc->getOutput();
             // get log extract
             $entries = \LogEventsList::showLogExtract($output, array($state), $this->workflow->getArticleTitle()->getPrefixedText(), '', array('lim' => 10, 'showIfEmpty' => false, 'msgKey' => array(array("flow-error-not-allowed-{$this->action}-to-{$state}-{$type}", "flow-error-not-allowed-{$state}-extract"))));
             // check if there were any log extracts
             if ($entries) {
                 $message = new \RawMessage('$1');
                 return $message->rawParams($output->getHTML());
             }
         }
     }
     return $this->context->msg(array("flow-error-not-allowed-{$this->action}-to-{$state}-{$type}", "flow-error-not-allowed-{$state}", "flow-error-not-allowed"));
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:51,代码来源:Topic.php


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