Skip to content

Commit

Permalink
Move code block placed in the wrong condition in previous commit - Fi…
Browse files Browse the repository at this point in the history
…x twitter:site meta not appearing in badges page - refs BT#11048
  • Loading branch information
ywarnier committed Apr 20, 2016
1 parent befebd9 commit 658fb16
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions main/inc/lib/template.lib.php
Expand Up @@ -976,26 +976,31 @@ private function set_header_parameters($sendHeaders)
$metaTitle = api_get_setting('meta_title');
if (!empty($metaTitle)) {
$socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
$metaSite = api_get_setting('meta_twitter_site');
if (!empty($metaSite)) {
$socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
$metaCreator = api_get_setting('meta_twitter_creator');
if (!empty($metaCreator)) {
$socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
}
}

// The following code is for user badge page if the twitter:card is enable
// The user badge page emits its own meta tags, so if this is
// enabled, ignore the global ones
$userId = isset($_GET['user']) ? intval($_GET['user']) : 0;
$skillId = isset($_GET['skill']) ? intval($_GET['skill']) : 0;

if (!$userId && !$skillId) {
// no combination of user and skill ID has been defined,
// so print the normal OpenGraph meta tags
$socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
$socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";

$metaDescription = api_get_setting('meta_description');
if (!empty($metaDescription)) {
$socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
}
$metaSite = api_get_setting('meta_twitter_site');
if (!empty($metaSite)) {
$socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
$metaCreator = api_get_setting('meta_twitter_creator');
if (!empty($metaCreator)) {
$socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
}
}

$metaImage = api_get_setting('meta_image_path');
if (!empty($metaImage)) {
if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
Expand Down

0 comments on commit 658fb16

Please sign in to comment.