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


PHP OutputPage::getHeadLinks方法代码示例

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


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

示例1: 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

示例2: displayHtml

 public function displayHtml()
 {
     global $IP, $wgTitle, $wgOut, $wgUser, $wgRequest, $wgContLanguageCode;
     global $wgLang, $wgContLang, $wgXhtmlDefaultNamespace;
     $sk = new SkinWikihowskin();
     $articleName = $wgTitle->getText();
     $partialUrl = $wgTitle->getPartialURL();
     $isMainPage = $articleName == wfMsg('mainpage');
     $action = $wgRequest->getVal('action', 'view');
     //$lang = $this->getSiteLanguage();
     //$deviceOpts = $this->getDevice();
     $pageExists = $wgTitle->exists();
     $randomUrl = '/' . wfMsg('special-randomizer');
     $titleBar = wfMsg('pagetitle', $articleName);
     $canonicalUrl = 'http://' . $IP . '/' . $wgTitle->getPartialURL();
     $rtl = $wgContLang->isRTL() ? " dir='RTL'" : '';
     $head_element = "<html xmlns:fb=\"https://www.facebook.com/2008/fbml\" xmlns=\"{$wgXhtmlDefaultNamespace}\" xml:lang=\"{$wgContLanguageCode}\" lang=\"{$wgContLanguageCode}\" {$rtl}>\n";
     $css = '/extensions/min/f/skins/WikiHow/new.css,extensions/wikihow/common/jquery-ui-themes/jquery-ui.css,extensions/wikihow/gallery/prettyPhoto-3.12/src/prettyPhoto.css,extensions/wikihow/NewLayout/Layout_03.css';
     if ($wgUser->getID() > 0) {
         $css .= ',/skins/WikiHow/loggedin.css';
     }
     $css .= '?' . WH_SITEREV;
     $css = wfGetPad($css);
     if ($wgIsDomainTest) {
         $base_href = '<base href="http://www.wikihow.com/" />';
     } else {
         $base_href = '';
     }
     $out = new OutputPage();
     $headlinks = $out->getHeadLinks();
     if (!$wgIsDomainTest) {
         $canonicalUrl = '<link rel="canonical" href="' . $wgTitle->getFullURL() . '" />';
     }
     //get login/sign up stuff
     $login = "";
     $li = $wgLang->specialPage("Userlogin");
     $lo = $wgLang->specialPage("Userlogout");
     $rt = $wgTitle->getPrefixedURL();
     if (0 == strcasecmp(urlencode($lo), $rt)) {
         $q = "";
     } else {
         $q = "returnto={$rt}";
     }
     if ($wgUser->getID()) {
         $uname = $wgUser->getName();
         if (strlen($uname) > 16) {
             $uname = substr($uname, 0, 16) . "...";
         }
         $login = wfMsg('welcome_back', $wgUser->getUserPage()->getFullURL(), $uname);
         if ($wgLanguageCode == 'en' && $wgUser->isFacebookUser()) {
             $login = wfMsg('welcome_back_fb', $wgUser->getUserPage()->getFullURL(), $wgUser->getName());
         }
     } else {
         $login = wfMsg('signup_or_login', $q) . " " . wfMsg('facebook_connect_header', wfGetPad("/skins/WikiHow/images/facebook_share_icon.gif"));
     }
     if ($wgUser->getID() > 0) {
         $helplink = $sk->makeLinkObj(Title::makeTitle(NS_CATEGORY, wfMsg('help')), wfMsg('help'));
         $logoutlink = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMsg('logout'));
         $login .= " | " . $helplink . " | " . $logoutlink;
     }
     $headerVars = array('title' => $titleBar, 'head_element' => $head_element, 'base_href' => $base_href, 'globalvar_script' => Skin::makeGlobalVariablesScript($this->data), 'css' => $css, 'headlinks' => $headlinks, 'canon' => $canonicalUrl, 'headitems' => $wgOut->getHeadItems(), 'login' => $login);
     if ($wgUser->getID() > 0) {
         $footer_links = wfMsgExt('site_footer_new', 'parse');
     } else {
         $footer_links = wfMsgExt('site_footer_new_anon', 'parse');
     }
     if ($wgUser->getID() > 0 || $isMainPage) {
         $sub_foot = wfMsg('sub_footer_new', wfGetPad(), wfGetPad());
     } else {
         $sub_foot = wfMsg('sub_footer_new_anon', wfGetPad(), wfGetPad());
     }
     $footerVars = array('footer_links' => $footer_links, 'search' => GoogSearch::getSearchBox("cse-search-box-footer") . '<br />', 'cat_list' => $sk->getCategoryList(), 'sub_foot' => $sub_foot, 'footertail' => $this->getFooterTail());
     $article = $wgOut->getHTML();
     $wgOut->clearHTML();
     //parse that article text
     $article = call_user_func('self::parseArticle_' . self::ARTICLE_LAYOUT, $article);
     $wgOut->addHTML(EasyTemplate::html('header_' . self::ARTICLE_LAYOUT . '.tmpl.php', $headerVars));
     $wgOut->addHTML($article);
     $wgOut->addHTML(EasyTemplate::html('footer_' . self::ARTICLE_LAYOUT . '.tmpl.php', $footerVars));
     print $wgOut->getHTML();
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:81,代码来源:NewLayout.body.php


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