本文整理汇总了PHP中SiteTree::AbsoluteLink方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteTree::AbsoluteLink方法的具体用法?PHP SiteTree::AbsoluteLink怎么用?PHP SiteTree::AbsoluteLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteTree
的用法示例。
在下文中一共展示了SiteTree::AbsoluteLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateMetadata
/**
* @name updateMetadata
*
* Updates metadata with icons.
*
* @param SiteConfig $config
* @param SiteTree $owner
* @param $metadata
* @return void
*/
public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
{
// decode into array
$data = json_decode($owner->OpenGraphData, true);
// check for data or throw an error
if ($data) {
// check if off
if ($data['og:type'] !== 'off') {
// Header
$metadata .= $owner->MarkupComment('Open Graph');
// Type
$metadata .= $owner->MarkupOpenGraph('og:type', $data['og:type']);
// URL
$metadata .= $owner->MarkupOpenGraph('og:url', $owner->AbsoluteLink());
// Site Name
$siteName = $data['og:site_name'] ? $data['og:site_name'] : $config->Title;
$metadata .= $owner->MarkupOpenGraph('og:site_name', $siteName, true);
// Title
$title = $data['og:title'] ? $data['og:title'] : $owner->Title;
$metadata .= $owner->MarkupOpenGraph('og:title', $title, true);
// Description
$description = $data['og:description'] ? $data['og:description'] : $owner->GenerateDescription();
$metadata .= $owner->MarkupOpenGraph('og:description', $description, true);
// Image
if ($owner->OpenGraphImage()->exists()) {
$metadata .= $owner->MarkupOpenGraph('og:image', $owner->OpenGraphImage()->getAbsoluteURL());
}
} else {
// OFF
$metadata .= $owner->MarkupComment('Open Graph [ off ]');
}
} else {
// ERROR
$metadata .= $owner->MarkupComment('Open Graph [ error ]');
}
}
开发者ID:graphiques-digitale,项目名称:silverstripe-seo-open-graph,代码行数:46,代码来源:SEO_OpenGraph_SiteTree_DataExtension.php
示例2: updateMetadata
/**
* Updates metadata fields.
*
* @param SiteConfig $config
* @param SiteTree $owner
* @param string $metadata
*
* @return void
*/
public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
{
// metadata
$metadata .= $owner->MarkupComment('Metadata');
// charset
if ($config->CharsetEnabled()) {
$metadata .= '<meta charset="' . $config->Charset() . '" />' . PHP_EOL;
}
// canonical
if ($config->CanonicalEnabled()) {
$metadata .= $owner->MarkupLink('canonical', $owner->AbsoluteLink());
}
// title
if ($config->TitleEnabled()) {
$metadata .= '<title>' . $owner->encodeContent($owner->GenerateTitle(), $config->Charset()) . '</title>' . PHP_EOL;
}
// description
if ($description = $owner->GenerateDescription()) {
$metadata .= $owner->MarkupMeta('description', $description, $config->Charset());
}
// extra metadata
if ($config->ExtraMetaEnabled()) {
$metadata .= $owner->MarkupComment('Extra Metadata');
$metadata .= $owner->GenerateExtraMeta();
}
}
开发者ID:graphiques-digitale,项目名称:silverstripe-seo-metadata,代码行数:35,代码来源:SEO_Metadata_SiteTree_DataExtension.php