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


PHP Linker::tocIndent方法代码示例

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


在下文中一共展示了Linker::tocIndent方法的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: tocIndent

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

示例4: formatHeadings

 /**
  * This function accomplishes several tasks:
  * 1) Auto-number headings if that option is enabled
  * 2) Add an [edit] link to sections for users who have enabled the option and can edit the page
  * 3) Add a Table of contents on the top for users who have enabled the option
  * 4) Auto-anchor headings
  *
  * It loops through all headlines, collects the necessary data, then splits up the
  * string and re-inserts the newly formatted headlines.
  *
  * @param $text String
  * @param string $origText original, untouched wikitext
  * @param $isMain Boolean
  * @return mixed|string
  * @private
  */
 function formatHeadings($text, $origText, $isMain = true)
 {
     global $wgMaxTocLevel, $wgExperimentalHtmlIds;
     # Inhibit editsection links if requested in the page
     if (isset($this->mDoubleUnderscores['noeditsection'])) {
         $maybeShowEditLink = $showEditLink = false;
     } else {
         $maybeShowEditLink = true;
         /* Actual presence will depend on ParserOptions option */
         $showEditLink = $this->mOptions->getEditSection();
     }
     if ($showEditLink) {
         $this->mOutput->setEditSectionTokens(true);
     }
     # Get all headlines for numbering them and adding funky stuff like [edit]
     # links - this is for later, but we need the number of headlines right now
     $matches = array();
     $numMatches = preg_match_all('/<H(?P<level>[1-6])(?P<attrib>.*?' . '>)\\s*(?P<header>[\\s\\S]*?)\\s*<\\/H[1-6] *>/i', $text, $matches);
     # if there are fewer than 4 headlines in the article, do not show TOC
     # unless it's been explicitly enabled.
     $enoughToc = $this->mShowToc && ($numMatches >= 4 || $this->mForceTocPosition);
     # Allow user to stipulate that a page should have a "new section"
     # link added via __NEWSECTIONLINK__
     if (isset($this->mDoubleUnderscores['newsectionlink'])) {
         $this->mOutput->setNewSection(true);
     }
     # Allow user to remove the "new section"
     # link via __NONEWSECTIONLINK__
     if (isset($this->mDoubleUnderscores['nonewsectionlink'])) {
         $this->mOutput->hideNewSection(true);
     }
     # if the string __FORCETOC__ (not case-sensitive) occurs in the HTML,
     # override above conditions and always show TOC above first header
     if (isset($this->mDoubleUnderscores['forcetoc'])) {
         $this->mShowToc = true;
         $enoughToc = true;
     }
     # headline counter
     $headlineCount = 0;
     $numVisible = 0;
     # Ugh .. the TOC should have neat indentation levels which can be
     # passed to the skin functions. These are determined here
     $toc = '';
     $full = '';
     $head = array();
     $sublevelCount = array();
     $levelCount = array();
     $level = 0;
     $prevlevel = 0;
     $toclevel = 0;
     $prevtoclevel = 0;
     $markerRegex = "{$this->mUniqPrefix}-h-(\\d+)-" . self::MARKER_SUFFIX;
     $baseTitleText = $this->mTitle->getPrefixedDBkey();
     $oldType = $this->mOutputType;
     $this->setOutputType(self::OT_WIKI);
     $frame = $this->getPreprocessor()->newFrame();
     $root = $this->preprocessToDom($origText);
     $node = $root->getFirstChild();
     $byteOffset = 0;
     $tocraw = array();
     $refers = array();
     foreach ($matches[3] as $headline) {
         $isTemplate = false;
         $titleText = false;
         $sectionIndex = false;
         $numbering = '';
         $markerMatches = array();
         if (preg_match("/^{$markerRegex}/", $headline, $markerMatches)) {
             $serial = $markerMatches[1];
             list($titleText, $sectionIndex) = $this->mHeadings[$serial];
             $isTemplate = $titleText != $baseTitleText;
             $headline = preg_replace("/^{$markerRegex}\\s*/", "", $headline);
         }
         if ($toclevel) {
             $prevlevel = $level;
         }
         $level = $matches[1][$headlineCount];
         if ($level > $prevlevel) {
             # Increase TOC level
             $toclevel++;
             $sublevelCount[$toclevel] = 0;
             if ($toclevel < $wgMaxTocLevel) {
                 $prevtoclevel = $toclevel;
                 $toc .= Linker::tocIndent();
//.........这里部分代码省略.........
开发者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::tocIndent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。