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


PHP OutputPage::addMetadataLink方法代码示例

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


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

示例1: addMetadataLinks

 function addMetadataLinks(OutputPage $out)
 {
     global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
     global $wgRightsPage, $wgRightsUrl;
     if ($out->isArticleRelated()) {
         # note: buggy CC software only reads first "meta" link
         if ($wgEnableCreativeCommonsRdf) {
             $out->addMetadataLink(array('title' => 'Creative Commons', 'type' => 'application/rdf+xml', 'href' => $wgTitle->getLocalURL('action=creativecommons')));
         }
         if ($wgEnableDublinCoreRdf) {
             $out->addMetadataLink(array('title' => 'Dublin Core', 'type' => 'application/rdf+xml', 'href' => $wgTitle->getLocalURL('action=dublincore')));
         }
     }
     $copyright = '';
     if ($wgRightsPage) {
         $copy = Title::newFromText($wgRightsPage);
         if ($copy) {
             $copyright = $copy->getLocalURL();
         }
     }
     if (!$copyright && $wgRightsUrl) {
         $copyright = $wgRightsUrl;
     }
     if ($copyright) {
         $out->addLink(array('rel' => 'copyright', 'href' => $copyright));
     }
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:27,代码来源:Skin.php

示例2: addMetadataLinks

 /**
  * Adds metadata links below to the HTML output.
  * <ol>
  *  <li>Creative Commons
  *   <br />See http://wiki.creativecommons.org/Extend_Metadata.
  *  </li>
  *  <li>Dublin Core</li>
  *  <li>Use hreflang to specify canonical and alternate links
  *   <br />See http://www.google.com/support/webmasters/bin/answer.py?answer=189077
  *  </li>
  *  <li>Copyright</li>
  * <ol>
  * 
  * @param $out Object: instance of OutputPage
  */
 function addMetadataLinks(OutputPage $out)
 {
     global $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
     global $wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang;
     global $wgRightsPage, $wgRightsUrl;
     if ($out->isArticleRelated()) {
         # note: buggy CC software only reads first "meta" link
         if ($wgEnableCreativeCommonsRdf) {
             $out->addMetadataLink(array('title' => 'Creative Commons', 'type' => 'application/rdf+xml', 'href' => $this->mTitle->getLocalURL('action=creativecommons')));
         }
         if ($wgEnableDublinCoreRdf) {
             $out->addMetadataLink(array('title' => 'Dublin Core', 'type' => 'application/rdf+xml', 'href' => $this->mTitle->getLocalURL('action=dublincore')));
         }
     }
     if (!$wgDisableLangConversion && $wgCanonicalLanguageLinks && $wgContLang->hasVariants()) {
         $urlvar = $wgContLang->getURLVariant();
         if (!$urlvar) {
             $variants = $wgContLang->getVariants();
             foreach ($variants as $_v) {
                 $out->addLink(array('rel' => 'alternate', 'hreflang' => $_v, 'href' => $this->mTitle->getLocalURL('', $_v)));
             }
         } else {
             $out->addLink(array('rel' => 'canonical', 'href' => $this->mTitle->getFullURL()));
         }
     }
     $copyright = '';
     if ($wgRightsPage) {
         $copy = Title::newFromText($wgRightsPage);
         if ($copy) {
             $copyright = $copy->getLocalURL();
         }
     }
     if (!$copyright && $wgRightsUrl) {
         $copyright = $wgRightsUrl;
     }
     if ($copyright) {
         $out->addLink(array('rel' => 'copyright', 'href' => $copyright));
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:54,代码来源:Skin.php


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