当前位置: 首页>>代码示例>>PHP>>正文


PHP Wikia::getFacebookDomainId方法代码示例

本文整理汇总了PHP中Wikia::getFacebookDomainId方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::getFacebookDomainId方法的具体用法?PHP Wikia::getFacebookDomainId怎么用?PHP Wikia::getFacebookDomainId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wikia的用法示例。


在下文中一共展示了Wikia::getFacebookDomainId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: egOgmcParserOutputApplyValues

function egOgmcParserOutputApplyValues($out, $parserOutput, $data)
{
    global $wgTitle;
    $articleId = $wgTitle->getArticleID();
    $titleImage = $titleDescription = null;
    wfRunHooks('OpenGraphMeta:beforeCustomFields', array($articleId, &$titleImage, &$titleDescription));
    // Only use ImageServing if no main image is already specified.  This lets people override the image with the parser function: [[File:{{#setmainimage:Whatever.png}}]].
    if (!isset($out->mMainImage)) {
        if (is_null($titleImage)) {
            // Get image from ImageServing
            // TODO: Make sure we automatically respect these restrictions from Facebook:
            // 		"An image URL which should represent your object within the graph.
            //		The image must be at least 50px by 50px and have a maximum aspect ratio of 3:1.
            //		We support PNG, JPEG and GIF formats."
            $imageServing = F::build('ImageServing', array($articleId));
            foreach ($imageServing->getImages(1) as $key => $value) {
                $titleImage = Title::newFromText($value[0]['name'], NS_FILE);
            }
        }
        // If ImageServing was not able to deliver a good match, fall back to the wiki's wordmark.
        if (empty($titleImage) && !is_object($titleImage) && F::app()->checkSkin('oasis')) {
            $themeSettings = new ThemeSettings();
            $settings = $themeSettings->getSettings();
            if ($settings["wordmark-type"] == "graphic") {
                $titleImage = Title::newFromText($settings['wordmark-image-name'], NS_FILE);
            }
        }
        // If we have a Title object for an image, convert it to an Image object and store it in mMainImage.
        if (!empty($titleImage) && is_object($titleImage)) {
            $mainImage = wfFindFile($titleImage);
            if ($mainImage !== false) {
                $parserOutput->setProperty('mainImage', $mainImage);
                $out->mMainImage = $parserOutput->getProperty('mainImage');
            }
        } else {
            // Fall back to using a Wikia logo.  There aren't any as "File:" pages, so we use a new config var for one that
            // is being added to skins/common.
            global $wgBigWikiaLogo;
            $logoUrl = wfReplaceImageServer($wgBigWikiaLogo);
            $parserOutput->setProperty('mainImage', $logoUrl);
            $out->mMainImage = $parserOutput->getProperty('mainImage');
        }
    }
    // Get description from ArticleService
    if (is_null($titleDescription)) {
        $DESC_LENGTH = 100;
        $articleService = new ArticleService($articleId);
        $titleDescription = $articleService->getTextSnippet($DESC_LENGTH);
    }
    if (!empty($titleDescription)) {
        $parserOutput->setProperty('description', $titleDescription);
        $out->mDescription = $parserOutput->getProperty('description');
    }
    if ($page_id = Wikia::getFacebookDomainId()) {
        $out->addMeta('property:fb:page_id', $page_id);
    }
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:57,代码来源:OpenGraphMetaCustomizations.setup.php

示例2: getDailyLikes

 protected function getDailyLikes(array &$stats)
 {
     global $fbAccessToken;
     $result = FALSE;
     $domain_id = Wikia::getFacebookDomainId();
     if (!$domain_id) {
         return $result;
     }
     $this->wf->ProfileIn(__METHOD__);
     $since = strtotime("-7 day 00:00:00");
     $until = strtotime("-0 day 00:00:00");
     $url = 'https://graph.facebook.com/' . $domain_id . '/insights/domain_widget_likes/day?access_token=' . $fbAccessToken . '&since=' . $since . '&until=' . $until;
     $response = json_decode(Http::get($url));
     if ($response) {
         $data = array_pop($response->data);
         if (isset($data->values)) {
             $stats['totals']['likes'] = 0;
             foreach ($data->values as $value) {
                 if (preg_match('/([\\d\\-]*)/', $value->end_time, $matches)) {
                     $day = $matches[1];
                     $stats[$day]['likes'] = $value->value;
                     $stats['totals']['likes'] += $value->value;
                 }
             }
             $result = TRUE;
         }
     }
     $this->wf->ProfileOut(__METHOD__);
     return $result;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:QuickStatsController.class.php


注:本文中的Wikia::getFacebookDomainId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。