本文整理汇总了PHP中TranslateUtils::fieldset方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslateUtils::fieldset方法的具体用法?PHP TranslateUtils::fieldset怎么用?PHP TranslateUtils::fieldset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslateUtils
的用法示例。
在下文中一共展示了TranslateUtils::fieldset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doBox
/**
* @param $msg string
* @param $code string
* @param $title Title
* @param $makelink
* @return string
*/
protected function doBox($msg, $code, $title = false, $makelink = false)
{
global $wgUser, $wgLang;
$name = TranslateUtils::getLanguageName($code, false, $wgLang->getCode());
$code = wfBCP47($code);
$skin = $wgUser->getSkin();
$attributes = array();
if (!$title) {
$attributes['class'] = 'mw-sp-translate-in-other-big';
} elseif ($code === 'en') {
$attributes['class'] = 'mw-sp-translate-edit-definition';
} else {
$attributes['class'] = 'mw-sp-translate-edit-committed';
}
if (mb_strlen($msg) < 100 && !$title) {
$attributes['class'] = 'mw-sp-translate-in-other-small';
}
$msg = TranslateUtils::convertWhiteSpaceToHTML($msg);
if (!$title) {
$title = "{$name} ({$code})";
}
if ($makelink) {
$linkTitle = Title::newFromText($makelink);
$title = $skin->link($linkTitle, htmlspecialchars($title), array(), array('action' => 'edit'));
}
return TranslateUtils::fieldset($title, Html::element('span', null, $msg), $attributes);
}
示例2: getDocumentationBox
public function getDocumentationBox()
{
global $wgTranslateDocumentationLanguageCode;
if (!$wgTranslateDocumentationLanguageCode) {
throw new TranslationHelperException('Message documentation language code is not defined');
}
$context = RequestContext::getMain();
$page = $this->handle->getKey();
$ns = $this->handle->getTitle()->getNamespace();
$title = Title::makeTitle($ns, $page . '/' . $wgTranslateDocumentationLanguageCode);
$edit = self::ajaxEditLink($title, $context->msg('translate-edit-contribute')->escaped());
$info = TranslateUtils::getMessageContent($page, $wgTranslateDocumentationLanguageCode, $ns);
$class = 'mw-sp-translate-edit-info';
// The information is most likely in English
$divAttribs = array('dir' => 'ltr', 'lang' => 'en', 'class' => 'mw-content-ltr');
if (strval($info) === '') {
$info = $context->msg('translate-edit-no-information')->text();
$class = 'mw-sp-translate-edit-noinfo';
$lang = $context->getLanguage();
// The message saying that there's no info, should be translated
$divAttribs = array('dir' => $lang->getDir(), 'lang' => $lang->getCode());
}
$class .= ' mw-sp-translate-message-documentation';
$contents = $context->getOutput()->parse($info);
// Remove whatever block element wrapup the parser likes to add
$contents = preg_replace('~^<([a-z]+)>(.*)</\\1>$~us', '\\2', $contents);
return TranslateUtils::fieldset($context->msg('translate-edit-information')->rawParams($edit)->escaped(), Html::rawElement('div', $divAttribs, $contents), array('class' => $class));
}