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


PHP OutputPage::getHeadScripts方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........
     } else {
         $langlinks = false;
     }
     if (isset($prop['langlinks'])) {
         $result_array['langlinks'] = $this->formatLangLinks($langlinks);
     }
     if (isset($prop['languageshtml'])) {
         $languagesHtml = $this->languagesHtml($langlinks);
         $result_array['languageshtml'] = array();
         ApiResult::setContent($result_array['languageshtml'], $languagesHtml);
     }
     if (isset($prop['categories'])) {
         $result_array['categories'] = $this->formatCategoryLinks($p_result->getCategories());
     }
     if (isset($prop['categorieshtml'])) {
         $categoriesHtml = $this->categoriesHtml($p_result->getCategories());
         $result_array['categorieshtml'] = array();
         ApiResult::setContent($result_array['categorieshtml'], $categoriesHtml);
     }
     if (isset($prop['links'])) {
         $result_array['links'] = $this->formatLinks($p_result->getLinks());
     }
     if (isset($prop['templates'])) {
         $result_array['templates'] = $this->formatLinks($p_result->getTemplates());
     }
     if (isset($prop['images'])) {
         $result_array['images'] = array_keys($p_result->getImages());
     }
     if (isset($prop['externallinks'])) {
         $result_array['externallinks'] = array_keys($p_result->getExternalLinks());
     }
     if (isset($prop['sections'])) {
         $result_array['sections'] = $p_result->getSections();
     }
     if (isset($prop['displaytitle'])) {
         $result_array['displaytitle'] = $p_result->getDisplayTitle() ? $p_result->getDisplayTitle() : $titleObj->getPrefixedText();
     }
     if (isset($prop['headitems']) || isset($prop['headhtml'])) {
         $context = new DerivativeContext($this->getContext());
         $context->setTitle($titleObj);
         $context->setWikiPage($pageObj);
         // We need an OutputPage tied to $context, not to the
         // RequestContext at the root of the stack.
         $output = new OutputPage($context);
         $output->addParserOutputNoText($p_result);
         if (isset($prop['headitems'])) {
             $headItems = $this->formatHeadItems($p_result->getHeadItems());
             $css = $this->formatCss($output->buildCssLinksArray());
             $scripts = array($output->getHeadScripts());
             $result_array['headitems'] = array_merge($headItems, $css, $scripts);
         }
         if (isset($prop['headhtml'])) {
             $result_array['headhtml'] = array();
             ApiResult::setContent($result_array['headhtml'], $output->headElement($context->getSkin()));
         }
     }
     if (isset($prop['iwlinks'])) {
         $result_array['iwlinks'] = $this->formatIWLinks($p_result->getInterwikiLinks());
     }
     if (isset($prop['wikitext'])) {
         $result_array['wikitext'] = array();
         ApiResult::setContent($result_array['wikitext'], $this->content->serialize($format));
         if (!is_null($this->pstContent)) {
             $result_array['psttext'] = array();
             ApiResult::setContent($result_array['psttext'], $this->pstContent->serialize($format));
         }
     }
     if (isset($prop['properties'])) {
         $result_array['properties'] = $this->formatProperties($p_result->getProperties());
     }
     if (isset($prop['limitreportdata'])) {
         $result_array['limitreportdata'] = $this->formatLimitReportData($p_result->getLimitReportData());
     }
     if (isset($prop['limitreporthtml'])) {
         $limitreportHtml = EditPage::getPreviewLimitReport($p_result);
         $result_array['limitreporthtml'] = array();
         ApiResult::setContent($result_array['limitreporthtml'], $limitreportHtml);
     }
     if ($params['generatexml']) {
         if ($this->content->getModel() != CONTENT_MODEL_WIKITEXT) {
             $this->dieUsage("generatexml is only supported for wikitext content", "notwikitext");
         }
         $wgParser->startExternalParse($titleObj, $popts, OT_PREPROCESS);
         $dom = $wgParser->preprocessToDom($this->content->getNativeData());
         if (is_callable(array($dom, 'saveXML'))) {
             $xml = $dom->saveXML();
         } else {
             $xml = $dom->__toString();
         }
         $result_array['parsetree'] = array();
         ApiResult::setContent($result_array['parsetree'], $xml);
     }
     $result_mapping = array('redirects' => 'r', 'langlinks' => 'll', 'categories' => 'cl', 'links' => 'pl', 'templates' => 'tl', 'images' => 'img', 'externallinks' => 'el', 'iwlinks' => 'iw', 'sections' => 's', 'headitems' => 'hi', 'properties' => 'pp', 'limitreportdata' => 'lr');
     $this->setIndexedTagNames($result_array, $result_mapping);
     $result->addValue(null, $this->getModuleName(), $result_array);
     if (!is_null($oldLang)) {
         $this->getContext()->setLanguage($oldLang);
         // Reset language to $oldLang
     }
 }
开发者ID:spring,项目名称:spring-website,代码行数:101,代码来源:ApiParse.php

示例2: outputPage

 function outputPage(OutputPage $out = null)
 {
     global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
     global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode;
     global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages;
     global $wgRequest, $wgUseNewInterlanguage;
     global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
     global $wgMaxCredits, $wgShowCreditsIfMax, $wgHideInterlanguageLinks;
     global $wgServer;
     global $wgSquidMaxage, $IP;
     $fname = __METHOD__;
     wfProfileIn($fname);
     wfRunHooks('BeforePageDisplay', array(&$wgOut, &$this));
     $this->mTitle = $wgTitle;
     extract($wgRequest->getValues('oldid', 'diff'));
     wfProfileIn("{$fname}-init");
     //$this->initPage( $out );
     $tpl = $this->setupTemplate('WikiHowTemplate', 'skins');
     $tpl->setTranslator(new MediaWiki_I18N());
     wfProfileOut("{$fname}-init");
     wfProfileIn("{$fname}-stuff");
     $this->thispage = $wgTitle->getPrefixedDbKey();
     $this->thisurl = $wgTitle->getPrefixedURL();
     $this->loggedin = $wgUser->getID() != 0;
     $this->iscontent = $wgTitle->getNamespace() != NS_SPECIAL;
     $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
     $this->username = $wgUser->getName();
     $this->userpage = $wgContLang->getNsText(NS_USER) . ":" . $wgUser->getName();
     $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage);
     $this->usercss = $this->userjs = $this->userjsprev = false;
     //$this->setupUserCss();
     //$this->setupUserJs(false);
     $this->titletxt = $wgTitle->getPrefixedText();
     wfProfileOut("{$fname}-stuff");
     // add utm
     wfProfileIn("{$fname}-stuff2");
     $tpl->set('title', $wgOut->getPageTitle());
     $tpl->setRef("thispage", $this->thispage);
     $undelete = $this->getUndeleteLink();
     $tpl->set("undelete", !empty($undelete) ? '<span class="subpages">' . $undelete . '</span>' : '');
     $tpl->set('headscripts', $out->getHeadScripts() . $out->getHeadItems());
     $description = ArticleMetaInfo::getCurrentTitleMetaDescription();
     if ($description) {
         $wgOut->addMeta('description', $description);
     }
     $keywords = ArticleMetaInfo::getCurrentTitleMetaKeywords();
     if ($keywords) {
         $wgOut->mKeywords = array();
         $wgOut->addMeta('keywords', $keywords);
     }
     ArticleMetaInfo::addFacebookMetaProperties($tpl->data['title']);
     ArticleMetaInfo::addTwitterMetaProperties();
     if ($wgOut->isSyndicated()) {
         $feeds = array();
         foreach ($wgFeedClasses as $format => $class) {
             $feeds[$format] = array('text' => $format, 'href' => $wgRequest->appendQuery("feed={$format}"), 'ttip' => wfMessage('tooltip-' . $format)->text());
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
     $tpl->setRef('mimetype', $wgMimeType);
     $tpl->setRef('charset', $wgOutputEncoding);
     $tpl->set('headlinks', $out->getHeadLinks());
     $tpl->setRef('wgScript', $wgScript);
     $tpl->setRef('skinname', $this->skinname);
     $tpl->setRef('stylename', $this->stylename);
     $tpl->setRef('loggedin', $this->loggedin);
     $tpl->set('nsclass', 'ns-' . $wgTitle->getNamespace());
     $tpl->set('notspecialpage', $wgTitle->getNamespace() != NS_SPECIAL);
     /* XXX currently unused, might get useful later
     		$tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
     		$tpl->set( "exists", $wgTitle->getArticleID() != 0 );
     		$tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
     		$tpl->set( "protect", count($wgTitle->isProtected()) ? "unprotect" : "protect" );
     		$tpl->set( "helppage", wfMessage('helppage')->text());
     		*/
     $tpl->set('searchaction', $this->escapeSearchLink());
     $tpl->set('search', trim($wgRequest->getVal('search')));
     $tpl->setRef('stylepath', $wgStylePath);
     $tpl->setRef('logopath', $wgLogo);
     $tpl->setRef("lang", $wgContLanguageCode);
     $tpl->set('dir', $wgContLang->isRTL() ? "rtl" : "ltr");
     $tpl->set('rtl', $wgContLang->isRTL());
     $tpl->set('langname', $wgContLang->getLanguageName($wgContLanguageCode));
     $tpl->setRef('username', $this->username);
     $tpl->setRef('userpage', $this->userpage);
     $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']);
     $tpl->setRef('usercss', $this->usercss);
     $tpl->setRef('userjs', $this->userjs);
     $tpl->setRef('userjsprev', $this->userjsprev);
     if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) {
         $tpl->set('body_onload', 'setupRightClickEdit()');
     } else {
         $tpl->set('body_onload', false);
     }
     global $wgUseSiteJs;
     if ($wgUseSiteJs) {
         if ($this->loggedin) {
             $tpl->set('jsvarurl', $this->makeUrl($this->userpage . '/-', 'action=raw&gen=js&maxage=' . $wgSquidMaxage));
//.........这里部分代码省略.........
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:WikiHowSkin.php


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