本文整理汇总了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));
}
}
示例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));
}
}