protected function fbRedirect() { if ($url = SFacebook::getRedirectUrl()) { App::$inst->render('redirect.php', array('redirectUrl' => $url, 'openGraphTags' => H::ogTags())); } else { $this->renderLayout('layout'); } }
protected static function render($file) { static $rendered = array(); if (in_array($file, $rendered)) { return ''; } else { $rendered[] = $file; } $file = Cdn::getUrl($file); if (self::getFileExtension($file) == 'js') { return H::js($file); } elseif (self::getFileExtension($file) == 'css') { return H::css($file); } }
angular.extend(window.appConfig.fb, { isTab: !!(/^app_runner/).test(window.name), isCanvas: !!(/^iframe_canvas/).test(window.name), isMobile: !!(/^fbforiphone/).test(window.navigator.userAgent), useMobile: false, detectFan: false, onInit: function(angular){angular.bootstrap(document.documentElement, ['app']);} }); (window.app || (window.app = angular.module('app', window.appModules()))).constant('config', window.appConfig); </script> <?php //H::copyData(); ?> <!-- build:js /js/bin/app.min.js --> <script type="text/javascript" src="/js/lib/analytics.js"></script> <script type="text/javascript" src="/js/lib/application.js"></script> <script type="text/javascript" src="/js/lib/video.js"></script> <script type="text/javascript" src="/js/lib/facebook.js"></script> <script type="text/javascript" src="/js/controllers.js"></script> <script type="text/javascript" src="/js/instance.js"></script> <script type="text/javascript" src="/js/metrics.js"></script> <script type="text/javascript" src="/js/services.js"></script> <!-- endbuild --> <?php H::vars()->fb->debug && H::debug(); ?> <script>typeof(window['fbAsyncInit'])=='undefined'&&window.appConfig.fb.onInit(angular);</script> </html>
/** * */ public static function getRedirectUrl() { if (!static::isTab() && !Device::device()->isMobile) { $page = App::$inst->appPageUrl; $appData = H::appData(); if (!empty($appData)) { $page .= "&app_data=" . $appData; } return $page; } elseif (Device::device()->isMobile) { $appData = H::appData(); $page = ''; if (!empty($appData)) { $page .= "?app_data=" . $appData; } return H::u('index/tab/' . $page); } return false; }
<?php use Application\H; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head> <?php echo H::og($openGraphTags); ?> <meta property="fb:app_id" content="<?php echo H::vars()->fb->appId; ?> " /> <meta property="og:url" content="<?php echo H::vars()->fb->canvasUrl; ?> " /> <meta property="og:type" content="website" /> <meta property="og:title" content="Tide+ ValenTide: Give a free bottle of Tide+ to someone special." /> <meta property="og:description" content="Give that special someone more of what they love: the gift of clean. Just guess your friend's favorite Tide+, and if they match it, they could get a free 10 oz bottle, while supplies last." /> <meta property="og:image" content="<?php echo H::u('img/ValenTide_Post_1200x627_itsBack.jpg'); ?> "> <script> top.location.href = '<?php echo $redirectUrl; ?> '; </script> </head></html>
private static function initAppVars() { App::$inst->container->singleton('vars', function () { $config = App::$inst->config; $fb = $config['facebook']; $sr = App::$inst->fb->getSignedRequest(); $cfg = new \ArrayObject(array('fb' => new \ArrayObject(array('appId' => $fb['appId'], 'appNamespace' => $fb['namespace'], 'tabUrl' => App::$inst->appPageUrl, 'canvasUrl' => H::cu(), 'channelUrl' => H::u('channel.php') . '/?locale=' . App::$inst->locale, 'pageUrl' => App::$inst->pageUrl, 'pageId' => $fb['pageId'], 'currentPageId' => App::$inst->currentPageId ?: 0, 'permissions' => isset($fb['permissions']) ? $fb['permissions'] : '', 'userId' => App::$inst->fb->getSignedRequest() ?: 0, 'isFan' => (bool) @$sr['page']['liked'], 'isAdmin' => (bool) @$sr->sr['page']['admin'], 'appData' => H::appData(), 'locale' => App::$inst->locale, 'debug' => isset(App::$inst->config['debugBar']) ? (int) App::$inst->config['debugBar'] : ''), \ArrayObject::ARRAY_AS_PROPS), 'ig' => new \ArrayObject(array('appId' => isset($config['instagram']['appId']) ? $config['instagram']['appId'] : null, 'channelUrl' => H::u('igChannel.html'), 'permissions' => isset($config['instagram']['permissions']) ? $config['instagram']['permissions'] : null), \ArrayObject::ARRAY_AS_PROPS), 'app' => new \ArrayObject(array('url' => H::u(App::$inst->request->getResourceUri()), 'version' => H::version() ?: 1, 'phase' => App::$inst->phase ?: 1, 'environment' => APPLICATION_ENV, 'isMobile' => Device::device()->isMobile, 'gaAccount' => @$config['metrics']['options']['code'], 'gaNamespace' => '', 'videoUrl' => H::videoURL()), \ArrayObject::ARRAY_AS_PROPS)), \ArrayObject::ARRAY_AS_PROPS); return $cfg; }); }
public static function copyData($locale = 'en_US') { require_once APPLICATION_PATH . '/models/CopyExportImport.php'; $url = \Application\models\CopyGenerator::factory()->getCopyUrl($locale); echo H::js($url); }