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


PHP Message::newFromKey方法代码示例

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


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

示例1: getMenuFromMessage

 /**
  * @param \Message|string|string[] $message
  * @param bool                     $forContent
  *
  * @throws \MWException
  *
  * @return Menu
  */
 public function getMenuFromMessage($message, $forContent = false)
 {
     if (is_string($message) || is_array($message)) {
         $message = \Message::newFromKey($message);
     }
     $this->assert(is_a($message, '\\Message'), 'String, array of strings or Message object expected.', $message);
     if ($forContent) {
         $message = $message->inContentLanguage();
     }
     if (!$message->exists()) {
         return $this->getMenuFromMessageText('', $forContent);
     }
     return $this->getMenuFromMessageText($message->text(), $forContent);
 }
开发者ID:atawsports2,项目名称:mediawiki-skins-chameleon,代码行数:22,代码来源:MenuFactory.php

示例2: testUserForCreation

 public function testUserForCreation($user, $autocreate, array $options = [])
 {
     $block = $user->isBlockedFromCreateAccount();
     if ($block) {
         $errorParams = [$block->getTarget(), $block->mReason ?: \Message::newFromKey('blockednoreason')->text(), $block->getByName()];
         if ($block->getType() === \Block::TYPE_RANGE) {
             $errorMessage = 'cantcreateaccount-range-text';
             $errorParams[] = $this->manager->getRequest()->getIP();
         } else {
             $errorMessage = 'cantcreateaccount-text';
         }
         return StatusValue::newFatal(new \Message($errorMessage, $errorParams));
     } else {
         return StatusValue::newGood();
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:16,代码来源:CheckBlocksSecondaryAuthenticationProvider.php

示例3: getMenuFromMessage

 /**
  * @param \Message|string|string[] $message
  * @param bool                     $forContent
  *
  * @throws \MWException
  *
  * @return Menu
  */
 public function getMenuFromMessage($message, $forContent = false)
 {
     if (is_string($message) || is_array($message)) {
         $message = \Message::newFromKey($message);
     }
     if (!is_a($message, '\\Message')) {
         throw new \MWException('String, array of strings or Message object expected. Got ' . is_object($message) ? get_class($message) : gettype($message) . '.');
     }
     if ($forContent) {
         $message = $message->inContentLanguage();
     }
     if (!$message->exists()) {
         return $this->getMenuFromMessageText('', $forContent);
     }
     return $this->getMenuFromMessageText($message->text(), $forContent);
 }
开发者ID:eadpucv,项目名称:mediawiki-skins-chameleon,代码行数:24,代码来源:MenuFactory.php

示例4: getHtml

 /**
  * Builds the HTML code for this component
  *
  * @return String the HTML code
  */
 public function getHtml()
 {
     $ret = '';
     $sidebar = $this->getSkinTemplate()->getSidebar(array('search' => false, 'toolbox' => false, 'languages' => false));
     $msg = \Message::newFromKey('skin-chameleon-navmenu-flatten');
     if ($msg->exists()) {
         $flatten = array_map('trim', explode(';', $msg->plain()));
     } elseif ($this->getDomElement() !== null) {
         $flatten = array_map('trim', explode(';', $this->getDomElement()->getAttribute('flatten')));
     } else {
         $flatten = array();
     }
     // create a dropdown for each sidebar box
     foreach ($sidebar as $boxName => $box) {
         $ret .= $this->getDropdownForNavMenu($boxName, $box, array_search($boxName, $flatten) !== false);
     }
     return $ret;
 }
开发者ID:ShakePeers,项目名称:mediawiki-skins-chameleon,代码行数:23,代码来源:NavMenu.php

示例5: getSelectorLabel

 /**
  * Returns the label of the selector for this view.
  * @return String the selector label
  */
 public function getSelectorLabel()
 {
     return Message::newFromKey('srf-filtered-selectorlabel-calendar')->inContentLanguage()->text();
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:8,代码来源:SRF_FV_Calendar.php

示例6: catch

    if (!defined('MW_NO_SESSION_HANDLER')) {
        MediaWiki\Session\PHPSessionHandler::install(MediaWiki\Session\SessionManager::singleton());
    }
    // Initialize the session
    try {
        $session = MediaWiki\Session\SessionManager::getGlobalSession();
    } catch (OverflowException $ex) {
        if (isset($ex->sessionInfos) && count($ex->sessionInfos) >= 2) {
            // The exception is because the request had multiple possible
            // sessions tied for top priority. Report this to the user.
            $list = [];
            foreach ($ex->sessionInfos as $info) {
                $list[] = $info->getProvider()->describe($wgContLang);
            }
            $list = $wgContLang->listToText($list);
            throw new HttpError(400, Message::newFromKey('sessionmanager-tie', $list)->inLanguage($wgContLang)->plain());
        }
        // Not the one we want, rethrow
        throw $ex;
    }
    if ($session->isPersistent()) {
        $wgInitialSessionId = $session->getSessionId();
    }
    $session->renew();
    if (MediaWiki\Session\PHPSessionHandler::isEnabled() && ($session->isPersistent() || $session->shouldRememberUser())) {
        // Start the PHP-session for backwards compatibility
        session_id($session->getId());
        MediaWiki\quietCall('session_start');
    }
    unset($session);
} else {
开发者ID:paladox,项目名称:mediawiki,代码行数:31,代码来源:Setup.php

示例7: provideTestForAccountCreation

 public static function provideTestForAccountCreation()
 {
     return ['No hook errors' => [null, null, \StatusValue::newGood()], 'AbortNewAccount, old style' => ['foobar', null, \StatusValue::newFatal(\Message::newFromKey('createaccount-hook-aborted')->rawParams('foobar'))], 'AbortNewAccount, new style' => ['foobar', \Status::newFatal('aborted!', 'param'), \StatusValue::newFatal('aborted!', 'param')]];
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:LegacyHookPreAuthenticationProviderTest.php

示例8: testNewFromKey

 /**
  * @covers Message::newFromKey
  */
 public function testNewFromKey()
 {
     $this->assertInstanceOf('Message', Message::newFromKey('mainpage'));
     $this->assertInstanceOf('Message', Message::newFromKey('i-dont-exist-evar'));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:MessageTest.php

示例9: preventPermissionLockout

 /**
  * Prevents that the wiki gets accidentally inaccessible for all users.
  * Some of the rights which are pre-set in the $bsgPermissionConfig have
  * a the flag "preventLockout" set to true. This makes it impossible to
  * save the permission settings if not at least one group has these rights enabled.
  *
  * @param array $aGroupPermissions
  * @return bool|String
  */
 protected static function preventPermissionLockout(&$aGroupPermissions)
 {
     global $bsgPermissionConfig;
     $aRights = User::getAllRights();
     if (!is_array($aRights)) {
         return false;
     }
     foreach ($aRights as $sRight) {
         if (isset($bsgPermissionConfig[$sRight]['preventLockout'])) {
             $bIsSet = false;
             if (is_array($aGroupPermissions)) {
                 foreach ($aGroupPermissions as $aDataset) {
                     if (isset($aDataset[$sRight]) && $aDataset[$sRight]) {
                         $bIsSet = true;
                         continue 2;
                     }
                 }
                 if (!$bIsSet) {
                     return Message::newFromKey('bs-permissionmanager-error-lockout')->params($sRight)->plain();
                 }
             }
         }
     }
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:34,代码来源:PermissionManager.class.php


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