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


PHP Linker::tocList方法代码示例

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


在下文中一共展示了Linker::tocList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:47,代码来源:SpecialEditWatchlist.php

示例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;
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:57,代码来源:SpecialEditWatchlist.php

示例3: tocList

 public function tocList($toc, $lang = false)
 {
     return Linker::tocList($toc, $lang);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:DummyLinker.php

示例4: formatHeadings


//.........这里部分代码省略.........
         if ($enoughToc && (!isset($wgMaxTocLevel) || $toclevel < $wgMaxTocLevel)) {
             $toc .= Linker::tocLine($anchor, $tocline, $numbering, $toclevel, $isTemplate ? false : $sectionIndex);
         }
         # Add the section to the section tree
         # Find the DOM node for this header
         $noOffset = $isTemplate || $sectionIndex === false;
         while ($node && !$noOffset) {
             if ($node->getName() === 'h') {
                 $bits = $node->splitHeading();
                 if ($bits['i'] == $sectionIndex) {
                     break;
                 }
             }
             $byteOffset += mb_strlen($this->mStripState->unstripBoth($frame->expand($node, PPFrame::RECOVER_ORIG)));
             $node = $node->getNextSibling();
         }
         $tocraw[] = array('toclevel' => $toclevel, 'level' => $level, 'line' => $tocline, 'number' => $numbering, 'index' => ($isTemplate ? 'T-' : '') . $sectionIndex, 'fromtitle' => $titleText, 'byteoffset' => $noOffset ? null : $byteOffset, 'anchor' => $anchor);
         # give headline the correct <h#> tag
         if ($maybeShowEditLink && $sectionIndex !== false) {
             // Output edit section links as markers with styles that can be customized by skins
             if ($isTemplate) {
                 # Put a T flag in the section identifier, to indicate to extractSections()
                 # that sections inside <includeonly> should be counted.
                 $editlinkArgs = array($titleText, "T-{$sectionIndex}");
             } else {
                 $editlinkArgs = array($this->mTitle->getPrefixedText(), $sectionIndex, $headlineHint);
             }
             // We use a bit of pesudo-xml for editsection markers. The language converter is run later on
             // Using a UNIQ style marker leads to the converter screwing up the tokens when it converts stuff
             // And trying to insert strip tags fails too. At this point all real inputted tags have already been escaped
             // so we don't have to worry about a user trying to input one of these markers directly.
             // We use a page and section attribute to stop the language converter from converting these important bits
             // of data, but put the headline hint inside a content block because the language converter is supposed to
             // be able to convert that piece of data.
             $editlink = '<mw:editsection page="' . htmlspecialchars($editlinkArgs[0]);
             $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) . '"';
             if (isset($editlinkArgs[2])) {
                 $editlink .= '>' . $editlinkArgs[2] . '</mw:editsection>';
             } else {
                 $editlink .= '/>';
             }
         } else {
             $editlink = '';
         }
         $head[$headlineCount] = Linker::makeHeadline($level, $matches['attrib'][$headlineCount], $anchor, $headline, $editlink, $legacyAnchor);
         $headlineCount++;
     }
     $this->setOutputType($oldType);
     # Never ever show TOC if no headers
     if ($numVisible < 1) {
         $enoughToc = false;
     }
     if ($enoughToc) {
         if ($prevtoclevel > 0 && $prevtoclevel < $wgMaxTocLevel) {
             $toc .= Linker::tocUnindent($prevtoclevel - 1);
         }
         $toc = Linker::tocList($toc, $this->mOptions->getUserLangObj());
         $this->mOutput->setTOCHTML($toc);
         $toc = self::TOC_START . $toc . self::TOC_END;
     }
     if ($isMain) {
         $this->mOutput->setSections($tocraw);
     }
     # split up and insert constructed headlines
     $blocks = preg_split('/<H[1-6].*?' . '>[\\s\\S]*?<\\/H[1-6]>/i', $text);
     $i = 0;
     // build an array of document sections
     $sections = array();
     foreach ($blocks as $block) {
         // $head is zero-based, sections aren't.
         if (empty($head[$i - 1])) {
             $sections[$i] = $block;
         } else {
             $sections[$i] = $head[$i - 1] . $block;
         }
         /**
          * Send a hook, one per section.
          * The idea here is to be able to make section-level DIVs, but to do so in a
          * lower-impact, more correct way than r50769
          *
          * $this : caller
          * $section : the section number
          * &$sectionContent : ref to the content of the section
          * $showEditLinks : boolean describing whether this section has an edit link
          */
         wfRunHooks('ParserSectionCreate', array($this, $i, &$sections[$i], $showEditLink));
         $i++;
     }
     if ($enoughToc && $isMain && !$this->mForceTocPosition) {
         // append the TOC at the beginning
         // Top anchor now in skin
         $sections[0] = $sections[0] . $toc . "\n";
     }
     $full .= join('', $sections);
     if ($this->mForceTocPosition) {
         return str_replace('<!--MWTOC-->', $toc, $full);
     } else {
         return $full;
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:Parser.php

示例5: 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;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:48,代码来源:SpecialEditWatchlist.php


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