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


PHP TranslateUtils::messageKeyToGroups方法代码示例

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


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

示例1: invalidateCache

 public static function invalidateCache(&$article, &$user, $text, $summary, $minoredit, &$watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
 {
     $ids = array();
     $name = $article->mTitle->getText();
     list($key, $lang) = explode($name, 2);
     // check if this is a valid language variant
     if (Language::getLanguageName($lang) == '') {
         return true;
     }
     // match message to group here
     $groups = TranslateUtils::messageKeyToGroups($article->mTitle->getNamespace(), $key);
     if (empty($groups)) {
         // message does not belong to any recognized group
         return true;
     }
     foreach ($groups as $group) {
         /* @var $group MessageGroup */
         $ids[] = $group->getId();
     }
     $conds = array('gs_group' => $ids, 'gs_lang' => $lang);
     $dbw = wfGetDB(DB_MASTER);
     // @TODO maybe update instaed of delete
     $dbw->delete('groupstats', $conds, __METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:MessageGroupStatistics.php

示例2: getGroupIds

	public function getGroupIds() {
		if ( $this->groupIds === null ) {
			$this->groupIds = TranslateUtils::messageKeyToGroups( $this->getTitle()->getNamespace(), $this->getKey() );
		}
		return $this->groupIds;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:6,代码来源:MessageHandle.php

示例3: indexOf

	public function indexOf( $row ) {
		// We need to check that there is only one user per day.
		if ( $this->opts['count'] === 'users' ) {
			$date = $this->formatTimestamp( $row->rc_timestamp );

			if ( isset( $this->usercache[$date][$row->rc_user_text] ) ) {
				return -1;
			} else {
				$this->usercache[$date][$row->rc_user_text] = 1;
			}
		}

		// Do not consider language-less pages.
		if ( strpos( $row->rc_title, '/' ) === false ) {
			return false;
		}

		// No filters, just one key to track.
		if ( !$this->groups && !$this->codes ) {
			return 'all';
		}

		// The key-building needs to be in sync with ::labels().
		list( $key, $code ) = TranslateUtils::figureMessage( $row->rc_title );

		$groups = array();
		$codes = array();

		if ( $this->groups ) {
			/*
			 * Get list of keys that the message belongs to, and filter
			 * out those which are not requested.
			 */
			$groups = TranslateUtils::messageKeyToGroups( $row->rc_namespace, $key );
			$groups = array_intersect( $this->groups, $groups );
		}

		if ( $this->codes ) {
			$codes = array( $code );
		}

		return $this->combineTwoArrays( $groups, $codes );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:43,代码来源:SpecialTranslationStats.php


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