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


PHP SpecialPage::msg方法代码示例

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


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

示例1: getUserLinks

 /**
  * Links to different places.
  *
  * @note This function is also called in DeletedContributionsPage
  * @param SpecialPage $sp SpecialPage instance, for context
  * @param User $target Target user object
  * @return array
  */
 public static function getUserLinks(SpecialPage $sp, User $target)
 {
     $id = $target->getId();
     $username = $target->getName();
     $userpage = $target->getUserPage();
     $talkpage = $target->getTalkPage();
     $linkRenderer = $sp->getLinkRenderer();
     $tools['user-talk'] = $linkRenderer->makeLink($talkpage, $sp->msg('sp-contributions-talk')->text());
     if ($id !== null || $id === null && IP::isIPAddress($username)) {
         if ($sp->getUser()->isAllowed('block')) {
             # Block / Change block / Unblock links
             if ($target->isBlocked() && $target->getBlock()->getType() != Block::TYPE_AUTO) {
                 $tools['block'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Block', $username), $sp->msg('change-blocklink')->text());
                 $tools['unblock'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Unblock', $username), $sp->msg('unblocklink')->text());
             } else {
                 # User is not blocked
                 $tools['block'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Block', $username), $sp->msg('blocklink')->text());
             }
         }
         # Block log link
         $tools['log-block'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Log', 'block'), $sp->msg('sp-contributions-blocklog')->text(), [], ['page' => $userpage->getPrefixedText()]);
         # Suppression log link (bug 59120)
         if ($sp->getUser()->isAllowed('suppressionlog')) {
             $tools['log-suppression'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Log', 'suppress'), $sp->msg('sp-contributions-suppresslog', $username)->text(), [], ['offender' => $username]);
         }
     }
     # Uploads
     $tools['uploads'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Listfiles', $username), $sp->msg('sp-contributions-uploads')->text());
     # Other logs link
     $tools['logs'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Log', $username), $sp->msg('sp-contributions-logs')->text());
     # Add link to deleted user contributions for priviledged users
     if ($sp->getUser()->isAllowed('deletedhistory')) {
         $tools['deletedcontribs'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('DeletedContributions', $username), $sp->msg('sp-contributions-deleted', $username)->text());
     }
     # Add a link to change user rights for privileged users
     $userrightsPage = new UserrightsPage();
     $userrightsPage->setContext($sp->getContext());
     if ($userrightsPage->userCanChangeRights($target)) {
         $tools['userrights'] = $linkRenderer->makeKnownLink(SpecialPage::getTitleFor('Userrights', $username), $sp->msg('sp-contributions-userrights')->text());
     }
     Hooks::run('ContributionsToolLinks', [$id, $userpage, &$tools, $sp]);
     return $tools;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:51,代码来源:SpecialContributions.php


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