本文整理汇总了PHP中Linker::tocLine方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::tocLine方法的具体用法?PHP Linker::tocLine怎么用?PHP Linker::tocLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::tocLine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNormalForm
/**
* Get the standard watchlist editing form
*
* @return HTMLForm
*/
protected function getNormalForm()
{
global $wgContLang;
$fields = array();
$count = 0;
foreach ($this->getWatchlistInfo() as $namespace => $pages) {
if ($namespace >= 0) {
$fields['TitlesNs' . $namespace] = array('class' => 'EditWatchlistCheckboxSeriesField', 'options' => array(), 'section' => "ns{$namespace}");
}
foreach (array_keys($pages) as $dbkey) {
$title = Title::makeTitleSafe($namespace, $dbkey);
if ($this->checkTitle($title, $namespace, $dbkey)) {
$text = $this->buildRemoveLine($title);
$fields['TitlesNs' . $namespace]['options'][$text] = $title->getEscapedText();
$count++;
}
}
}
$this->cleanupWatchlist();
if (count($fields) > 1 && $count > 30) {
$this->toc = Linker::tocIndent();
$tocLength = 0;
foreach ($fields as $key => $data) {
# strip out the 'ns' prefix from the section name:
$ns = substr($data['section'], 2);
$nsText = $ns == NS_MAIN ? $this->msg('blanknamespace')->escaped() : htmlspecialchars($wgContLang->getFormattedNsText($ns));
$this->toc .= Linker::tocLine("editwatchlist-{$data['section']}", $nsText, $this->getLanguage()->formatNum(++$tocLength), 1) . Linker::tocLineEnd();
}
$this->toc = Linker::tocList($this->toc);
} else {
$this->toc = false;
}
$form = new EditWatchlistNormalHTMLForm($fields, $this->getContext());
$form->setTitle($this->getTitle());
$form->setSubmitTextMsg('watchlistedit-normal-submit');
# Used message keys: 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit'
$form->setSubmitTooltip('watchlistedit-normal-submit');
$form->setWrapperLegendMsg('watchlistedit-normal-legend');
$form->addHeaderText($this->msg('watchlistedit-normal-explain')->parse());
$form->setSubmitCallback(array($this, 'submitNormal'));
return $form;
}
示例2: getNormalForm
/**
* Get the standard watchlist editing form
*
* @return HTMLForm
*/
protected function getNormalForm()
{
global $wgContLang;
$fields = array();
$count = 0;
// Allow subscribers to manipulate the list of watched pages (or use it
// to preload lots of details at once)
$watchlistInfo = $this->getWatchlistInfo();
Hooks::run('WatchlistEditorBeforeFormRender', array(&$watchlistInfo));
foreach ($watchlistInfo as $namespace => $pages) {
$options = array();
foreach (array_keys($pages) as $dbkey) {
$title = Title::makeTitleSafe($namespace, $dbkey);
if ($this->checkTitle($title, $namespace, $dbkey)) {
$text = $this->buildRemoveLine($title);
$options[$text] = $title->getPrefixedText();
$count++;
}
}
// checkTitle can filter some options out, avoid empty sections
if (count($options) > 0) {
$fields['TitlesNs' . $namespace] = array('class' => 'EditWatchlistCheckboxSeriesField', 'options' => $options, 'section' => "ns{$namespace}");
}
}
$this->cleanupWatchlist();
if (count($fields) > 1 && $count > 30) {
$this->toc = Linker::tocIndent();
$tocLength = 0;
foreach ($fields as $data) {
# strip out the 'ns' prefix from the section name:
$ns = substr($data['section'], 2);
$nsText = $ns == NS_MAIN ? $this->msg('blanknamespace')->escaped() : htmlspecialchars($wgContLang->getFormattedNsText($ns));
$this->toc .= Linker::tocLine("editwatchlist-{$data['section']}", $nsText, $this->getLanguage()->formatNum(++$tocLength), 1) . Linker::tocLineEnd();
}
$this->toc = Linker::tocList($this->toc);
} else {
$this->toc = false;
}
$context = new DerivativeContext($this->getContext());
$context->setTitle($this->getPageTitle());
// Remove subpage
$form = new EditWatchlistNormalHTMLForm($fields, $context);
$form->setSubmitTextMsg('watchlistedit-normal-submit');
$form->setSubmitDestructive();
# Used message keys:
# 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit'
$form->setSubmitTooltip('watchlistedit-normal-submit');
$form->setWrapperLegendMsg('watchlistedit-normal-legend');
$form->addHeaderText($this->msg('watchlistedit-normal-explain')->parse());
$form->setSubmitCallback(array($this, 'submitNormal'));
return $form;
}
示例3: formatHeadings
//.........这里部分代码省略.........
}
$level = $matches[1][$headlineCount];
if ($level > $prevlevel) {
# Increase TOC level
$toclevel++;
$sublevelCount[$toclevel] = 0;
if ($toclevel < $wgMaxTocLevel) {
$prevtoclevel = $toclevel;
$toc .= Linker::tocIndent();
$numVisible++;
}
} elseif ($level < $prevlevel && $toclevel > 1) {
# Decrease TOC level, find level to jump to
for ($i = $toclevel; $i > 0; $i--) {
if ($levelCount[$i] == $level) {
# Found last matching level
$toclevel = $i;
break;
} elseif ($levelCount[$i] < $level) {
# Found first matching level below current level
$toclevel = $i + 1;
break;
}
}
if ($i == 0) {
$toclevel = 1;
}
if ($toclevel < $wgMaxTocLevel) {
if ($prevtoclevel < $wgMaxTocLevel) {
# Unindent only if the previous toc level was shown :p
$toc .= Linker::tocUnindent($prevtoclevel - $toclevel);
$prevtoclevel = $toclevel;
} else {
$toc .= Linker::tocLineEnd();
}
}
} else {
# No change in level, end TOC line
if ($toclevel < $wgMaxTocLevel) {
$toc .= Linker::tocLineEnd();
}
}
$levelCount[$toclevel] = $level;
# count number of headlines for each level
$sublevelCount[$toclevel]++;
$dot = 0;
for ($i = 1; $i <= $toclevel; $i++) {
if (!empty($sublevelCount[$i])) {
if ($dot) {
$numbering .= '.';
}
$numbering .= $this->getTargetLanguage()->formatNum($sublevelCount[$i]);
$dot = 1;
}
}
# The safe header is a version of the header text safe to use for links
# Remove link placeholders by the link text.
# <!--LINK number-->
# turns into
# link text with suffix
# Do this before unstrip since link text can contain strip markers
$safeHeadline = $this->replaceLinkHoldersText($headline);
# Avoid insertion of weird stuff like <math> by expanding the relevant sections
$safeHeadline = $this->mStripState->unstripBoth($safeHeadline);
# Strip out HTML (first regex removes any tag not allowed)
# Allowed tags are:
示例4: tocLine
public function tocLine($anchor, $tocline, $tocnumber, $level, $sectionIndex = false)
{
return Linker::tocLine($anchor, $tocline, $tocnumber, $level, $sectionIndex);
}
示例5: InjectTOCitem
/**
* Hook
*
* @param Parser $parser -- instance of Parser class
* @param Skin $sk -- instance of Skin class
* @param string $toc -- HTML for TOC
* @param array $sublevelCount -- last used numbers for each indentation
*
* @static
* @access public
* @todo TODO: not working - check
*
* @return Bool true -- because it's a hook
*/
static function InjectTOCitem($parser, &$toc, &$sublevelCount)
{
if (self::ArticleCommentCheck() && !F::app()->checkSkin('wikiamobile')) {
$tocnumber = ++$sublevelCount[1];
$toc .= Linker::tocLine('WikiaArticleComments', wfMsg('article-comments-toc-item'), $tocnumber, 1);
}
return true;
}
示例6: getNormalForm
/**
* Get the standard watchlist editing form
*
* @return HTMLForm
*/
protected function getNormalForm()
{
global $wgContLang;
$fields = array();
$count = 0;
$haveInvalidNamespaces = false;
foreach ($this->getWatchlistInfo() as $namespace => $pages) {
if ($namespace < 0) {
$haveInvalidNamespaces = true;
continue;
}
$fields['TitlesNs' . $namespace] = array('class' => 'EditWatchlistCheckboxSeriesField', 'options' => array(), 'section' => "ns{$namespace}");
foreach ($pages as $dbkey => $redirect) {
$title = Title::makeTitleSafe($namespace, $dbkey);
$text = $this->buildRemoveLine($title, $redirect);
$fields['TitlesNs' . $namespace]['options'][$text] = $title->getEscapedText();
$count++;
}
}
if ($haveInvalidNamespaces) {
wfDebug("User {$this->getContext()->getUser()->getId()} has invalid watchlist entries, clening up...\n");
$this->getContext()->getUser()->cleanupWatchlist();
}
if (count($fields) > 1 && $count > 30) {
$this->toc = Linker::tocIndent();
$tocLength = 0;
foreach ($fields as $key => $data) {
$ns = substr($data['section'], 2);
$nsText = $ns == NS_MAIN ? wfMsgHtml('blanknamespace') : htmlspecialchars($wgContLang->getFormattedNsText($ns));
$this->toc .= Linker::tocLine("editwatchlist-{$data['section']}", $nsText, ++$tocLength, 1) . Linker::tocLineEnd();
}
$this->toc = Linker::tocList($this->toc);
} else {
$this->toc = false;
}
$form = new EditWatchlistNormalHTMLForm($fields, $this->getContext());
$form->setTitle($this->getTitle());
$form->setSubmitText(wfMessage('watchlistedit-normal-submit')->text());
$form->setWrapperLegend(wfMessage('watchlistedit-normal-legend')->text());
$form->addHeaderText(wfMessage('watchlistedit-normal-explain')->parse());
$form->setSubmitCallback(array($this, 'submitNormal'));
return $form;
}