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


PHP SkinTemplate::outputPage方法代码示例

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


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

示例1: outputPage

 /**
  * initialize various variables and generate the template
  * @param OutputPage $out optional parameter: The OutputPage Obj.
  */
 public function outputPage(OutputPage $out = null)
 {
     // This might seem weird but now the meaning of 'mobile' is morphing to mean 'minerva skin'
     // FIXME: Explore disabling this via a user preference and see what explodes
     // Important: This must run before outputPage which generates script and style tags
     // If run later incompatible desktop code will leak into Minerva.
     $out = $this->getOutput();
     $out->setTarget('mobile');
     if ($this->isMobileMode) {
         // FIXME: Merge these hooks?
         // EnableMobileModules is deprecated; Use ResourceLoader instead,
         // see https://www.mediawiki.org/wiki/ResourceLoader#Mobile
         Hooks::run('EnableMobileModules', array($out, $this->getMode()));
         Hooks::run('BeforePageDisplayMobile', array(&$out));
     }
     parent::outputPage();
 }
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:21,代码来源:SkinMinerva.php

示例2: outputPage

 function outputPage(OutputPage $out)
 {
     $content = $out->mBodytext;
     //<div class="rellink relarticle mainarticle">Main article: Geography of Chicago</div>
     // remove links to disemb. and other (if no link inside)
     preg_match_all('/<div class="(rellink|detail|homonymie|dablink|detail principal)[^"]*?">.*?<\\/div>/s', $content, $matches);
     foreach ($matches[0] as $match) {
         // remove only html code without links or latex generated mathematics images
         if (!preg_match("/.*?<a.*?/s", $match) && !preg_match("/.*?<img class=\"tex\".*?/s", $match) && !preg_match("/.*?texhtml.*?/s", $match)) {
             $content = str_replace($match, "", $content);
         }
     }
     // remove return cariage after (sub-)title
     $content = str_replace("<p><br />", "<p>", $content);
     // remove empty paragraph
     $content = str_replace("<p><br /></p>", "", $content);
     $content = str_replace("<p></p>", "", $content);
     // other type of useless html
     $content = str_replace('<p><font class="metadata"><br /></font></p>', "", $content);
     // remove empty chapter/paragraph/...
     // <p><a name="Monotonicity" id="Monotonicity"></a></p>
     // <h3><span class="mw-headline">Monotonicity</span></h3>
     // <p><a name="Conservativity" id="Conservativity"></a></p>
     // <h3><span class="mw-headline">Conservativity</span></h3>
     // <h2 id="Altri_progetti"> <span class="mw-headline">Altri progetti</span></h2>
     // <h2 id="Collegamenti_esterni"> <span class="mw-headline">Collegamenti esterni</span></h2>
     $offset = 0;
     while (preg_match('/(<p><a name=\\"[^\\"]*\\" id=\\"[^\\"]*\\"><\\/a><\\/p>[\\n\\r\\t]<h|<h)([\\d])([^>]*>[ ]*<span[^>]+?>.*?<\\/span><\\/h[\\d]>[\\n\\r\\t]*)(<p><a name=\\"[^\\"]*\\" id=\\"[^\\"]*\\"><\\/a><\\/p>[\\n\\r\\t]<h|<h)([\\d])([^>]*>[ ]*<span class=\\"[^\\"]*\\">.*?<\\/span><\\/h[\\d]>)/', $content, $matches, PREG_OFFSET_CAPTURE, $offset) && count($matches)) {
         // set the offset for the future
         $offset = $matches[0][1] + 1;
         // exlude the case of under chapter
         if ($matches[2][0] >= $matches[5][0]) {
             // remove the empty paragraph
             $toRemove = $matches[1][0] . $matches[2][0] . $matches[3][0];
             $content = str_replace($toRemove, "", $content);
             // remove the index entry
             preg_match('/<p><a name=\\"([^\\"]*)\\"/', $toRemove, $match);
             $anchorName = $match[1];
             // new by it.mirror.kiwix.org
             if ($anchorName == "") {
                 preg_match('/id=\\"([^\\"]*)\\"/', $toRemove, $match);
                 $anchorName = $match[1];
             }
             // get sumary index number
             preg_match("/<li.*?#{$anchorName}.*?<span class=\"tocnumber\">([\\d\\.]*)<\\/span>.*?<\\/li>/", $content, $match);
             $indexNumber = $match[1];
             // remove index line
             $content = str_replace($match[0], "", $content);
             // update following summary indexes
             $indexNumbers = explode('.', $indexNumber);
             $last = $indexNumbers[count($indexNumbers) - 1];
             $prefix = substr($indexNumber, 0, strlen($indexNumber) - strlen($last));
             $last++;
             while (preg_match("/(<span class=\"tocnumber\">{$prefix})({$last})(<\\/span>)/", $content, $match)) {
                 $content = str_replace($match[0], $match[1] . ($last - 1) . $match[3], $content);
                 $last++;
             }
         }
     }
     // remove last empty chapter/paragraph/...
     // <h2> <span class="mw-headline">Enlaces externos</span></h2>
     //  <!-- end content -->
     $offset = 0;
     if (preg_match('/(<p><a name=\\"[^\\"]*\\" id=\\"[^\\"]*\\"><\\/a><\\/p>[\\n\\r\\t]<h|<h)([\\d])(>[ ]*<span[^>]+?>.*?<\\/span><\\/h[\\d]>[\\n\\r\\t]*)(\\<\\!\\-\\-\\ |\\<br\\/\\>\\<div\\ class\\=\\"kf\\"|\\<div\\ class\\=\\"kf\\")/', $content, $matches, PREG_OFFSET_CAPTURE, $offset) && count($matches)) {
         // set the offset for the future
         $offset = $matches[0][2] + 1;
         // remove the empty paragraph
         $toRemove = $matches[1][0] . $matches[2][0] . $matches[3][0];
         $content = str_replace($toRemove, "", $content);
         // remove the index entry
         preg_match('/id=\\"([^\\"]*)\\"/', $toRemove, $match);
         $anchorName = $match[1];
         // get sumary index number
         preg_match("/<li.*?#{$anchorName}.*?<span class=\"tocnumber\">([\\d\\.]*)<\\/span>.*?<\\/li>/", $content, $match);
         $indexNumber = $match[1];
         // remove index line
         $content = str_replace($match[0], "", $content);
         // update following summary indexes
         $indexNumbers = explode('.', $indexNumber);
         $last = $indexNumbers[count($indexNumbers) - 1];
         $prefix = substr($indexNumber, 0, strlen($indexNumber) - strlen($last));
         $last++;
         while (preg_match("/(<span class=\"tocnumber\">{$prefix})({$last})(<\\/span>)/", $content, $match)) {
             $content = str_replace($match[0], $match[1] . ($last - 1) . $match[3], $content);
             $last++;
         }
     }
     // remove timeline image map <img usemap="#1e85951432e89de2bc508a5b1c7eb174" src="/images/timeline/1e85951432e89de2bc508a5b1c7eb174.png">
     while (preg_match("/(<img )(usemap=\"\\#)([^\"]+)(\" )(src=\".*timeline.*\")/", $content, $match)) {
         // remove map call in img tag
         $content = str_replace($match[0], "<br/>" . $match[1] . $match[5], $content);
         $mapId = $match[3];
         // remove map itself
         if (preg_match("/<map name=\"{$mapId}\">.*?<\\/map>/s", $content, $match2)) {
             $content = str_replace($match2[0], "", $content);
         }
     }
     // remove <strong class="selflink">*</strong>
     while (preg_match("/(<strong class=\"selflink\">)(.*?)(<\\/strong>)/", $content, $match)) {
         $content = str_replace($match[0], $match[2], $content);
//.........这里部分代码省略.........
开发者ID:kiwix,项目名称:tools,代码行数:101,代码来源:KiwixBaseSkin.php


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