Index: trunk/extensions/OpenGraphMeta/OpenGraphMeta.php |
— | — | @@ -63,23 +63,27 @@ |
64 | 64 | global $wgLogo, $wgSitename, $wgXhtmlNamespaces, $egFacebookAppId, $egFacebookAdmins; |
65 | 65 | $wgXhtmlNamespaces["og"] = "http://opengraphprotocol.org/schema/"; |
66 | 66 | $title = $out->getTitle(); |
67 | | - $isMainpage = $title->equals(Title::newMainPage()); |
| 67 | + $isMainpage = $title->isMainPage(); |
68 | 68 | |
69 | 69 | $meta = array(); |
70 | 70 | |
71 | | - $meta["og:type"] = $isMainpage ? "website" : "article"; |
72 | | - $meta["og:site_name"] = $wgSitename; |
73 | | - |
74 | | - // Try to chose the most appropriate title for showing in news feeds. |
75 | | - if ((defined('NS_BLOG_ARTICLE') && $title->getNamespace() == NS_BLOG_ARTICLE) || |
76 | | - (defined('NS_BLOG_ARTICLE_TALK') && $title->getNamespace() == NS_BLOG_ARTICLE_TALK)){ |
77 | | - $meta["og:title"] = $title->getSubpageText(); |
| 71 | + if ( $isMainpage ) { |
| 72 | + $meta["og:type"] = "website"; |
| 73 | + $meta["og:title"] = $wgSitename; |
78 | 74 | } else { |
79 | | - $meta["og:title"] = $title->getText(); |
| 75 | + $meta["og:type"] = "article"; |
| 76 | + $meta["og:site_name"] = $wgSitename; |
| 77 | + // Try to chose the most appropriate title for showing in news feeds. |
| 78 | + if ( ( defined('NS_BLOG_ARTICLE') && $title->getNamespace() == NS_BLOG_ARTICLE ) || |
| 79 | + ( defined('NS_BLOG_ARTICLE_TALK') && $title->getNamespace() == NS_BLOG_ARTICLE_TALK ) ){ |
| 80 | + $meta["og:title"] = $title->getSubpageText(); |
| 81 | + } else { |
| 82 | + $meta["og:title"] = $title->getText(); |
| 83 | + } |
80 | 84 | } |
81 | 85 | |
82 | | - if ( isset($out->mMainImage) && ($out->mMainImage !== false) ) { |
83 | | - if( is_object($out->mMainImage) ){ |
| 86 | + if ( isset( $out->mMainImage ) && ( $out->mMainImage !== false ) ) { |
| 87 | + if( is_object( $out->mMainImage ) ){ |
84 | 88 | $meta["og:image"] = wfExpandUrl($out->mMainImage->createThumb(100*3, 100)); |
85 | 89 | } else { |
86 | 90 | // In some edge-cases we won't have defined an object but rather a full URL. |