/**
  * @param SiteConfig $config
  * @param SiteTree $owner
  * @param string $metadata
  *
  * @return void
  *
  */
 public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
 {
     // Facebook App ID
     if ($config->FacebookAppID) {
         $metadata .= $owner->MarkupComment('Facebook Insights');
         $metadata .= $owner->MarkupFacebook('fb:app_id', $config->FacebookAppID, false);
         // Admins (if App ID)
         foreach ($config->FacebookAdmins() as $admin) {
             if ($admin->FacebookProfileID) {
                 $metadata .= $owner->MarkupFacebook('fb:admins', $admin->FacebookProfileID, false);
             }
         }
     }
 }
 /**
  * @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 ]');
     }
 }
 /**
  * Generates markup for the Windows pinicon
  *
  * @param SiteConfig $config
  * @param SiteTree $owner
  * @param $metadata
  * @param Image $WindowsPinicon
  *
  * @return void
  */
 protected function GenerateWindowsPinicon(SiteConfig $config, SiteTree $owner, &$metadata, Image $WindowsPinicon)
 {
     // header
     $metadata .= $owner->MarkupComment('Windows Pinned Icon');
     // application name
     $appName = $config->fetchPiniconTitle();
     if (!$appName) {
         $appName = $config->Title;
     }
     $metadata .= $owner->MarkupMeta('application-name', $appName);
     // tile background color
     if ($config->fetchWindowsPiniconBackgroundColor()) {
         $metadata .= $owner->MarkupMeta('msapplication-TileColor', $config->fetchWindowsPiniconBackgroundColor());
     }
     // small tile
     $metadata .= $owner->MarkupMeta('msapplication-square70x70logo', $WindowsPinicon->Fill(70, 70)->getAbsoluteURL());
     // medium tile
     $metadata .= $owner->MarkupMeta('msapplication-square150x150logo', $WindowsPinicon->Fill(150, 150)->getAbsoluteURL());
     // @todo: Implement wide & tall tiles
     // wide tile
     //			$metadata .= $owner->MarkupMeta('msapplication-square310x150logo', $WindowsPinicon->Fill(310,150)->getAbsoluteURL());
     // large tile
     //			$metadata .= $owner->MarkupMeta('msapplication-square310x310logo', $WindowsPinicon->Fill(310,310)->getAbsoluteURL());
 }
 /**
  * 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();
     }
 }