예제 #1
0
 /**
  *
  */
 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;
 }
예제 #2
0
 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;
     });
 }