function op_include_application_setting($view, $hasApp)
{
    static $isFirst = true;
    if ($isFirst) {
        $opOpenSocialContainerConfig = new opOpenSocialContainerConfig();
        $opOpenSocialContainerConfig->generateAndSave();
        $response = sfContext::getInstance()->getResponse();
        $response->addJavascript('/sfProtoculousPlugin/js/prototype');
        $response->addJavascript('/opOpenSocialPlugin/js/tabs-min');
        $response->addJavascript('/opOpenSocialPlugin/js/container');
        $response->addJavascript('/gadgets/js/rpc.js?c=1');
        $response->addJavascript('/opOpenSocialPlugin/js/opensocial-util');
        $request = sfContext::getInstance()->getRequest();
        $isDev = sfConfig::get('sf_environment') == 'dev';
        $snsUrl = $request->getUriPrefix() . $request->getRelativeUrlRoot();
        $snsUrl .= $isDev ? '/pc_frontend_dev.php' : '';
        $apiUrl = $request->getUriPrefix() . $request->getRelativeUrlRoot() . '/api';
        $apiUrl .= $isDev ? '_dev' : '';
        $apiUrl .= '.php';
        echo javascript_tag(sprintf(<<<EOF
gadgets.container = new Container("%s", "%s", "%s", %s);
EOF
, $snsUrl, $apiUrl, $view, $hasApp ? 'true' : 'false'));
        echo make_app_setting_modal_box('opensocial_modal_box');
        $isFirst = false;
    }
}
 protected function api($class)
 {
     sfConfig::set('sf_web_debug', false);
     $opOpenSocialContainerConfig = new opOpenSocialContainerConfig();
     $opOpenSocialContainerConfig->generateAndSave();
     ob_start();
     try {
         $this->servletExecute($class);
     } catch (SocialSpiException $e) {
     }
     $socialData = ob_get_contents();
     ob_end_clean();
     return $this->renderText($socialData);
 }
 /**
  * Executes gadget component
  *
  * @param sfWebRequest $request
  */
 public function executeGadget(sfWebRequest $request)
 {
     $this->isTitleLink = true;
     if (!$this->titleLinkTo) {
         $this->isTitleLink = false;
         $this->titleLinkTo = '@homepage';
     }
     $culture = $this->getUser()->getCulture();
     $culture = split("_", $culture);
     $this->application = $this->memberApplication->getApplication();
     $this->height = $this->application->getHeight() ? $this->application->getHeight() : 200;
     $viewerId = $this->getUser()->getMemberId();
     $this->isOwner = false;
     if ($this->memberApplication->getMemberId() == $viewerId) {
         $this->isOwner = true;
     }
     $isUseOuterShindig = Doctrine::getTable('SnsConfig')->get('is_use_outer_shindig', false);
     $opOpenSocialContainerConfig = new opOpenSocialContainerConfig();
     $containerName = $opOpenSocialContainerConfig->getContainerName();
     $securityToken = opShindigSecurityToken::createFromValues($this->memberApplication->getMemberId(), $viewerId, $this->application->getId(), $containerName, urlencode($this->application->getUrl()), $this->memberApplication->getId(), Shindig_Config::get('container_id'));
     $getParams = array('synd' => $containerName, 'container' => $containerName, 'owner' => $this->memberApplication->getMemberId(), 'viewer' => $viewerId, 'aid' => $this->application->getId(), 'mid' => $this->memberApplication->getId(), 'country' => isset($culture[1]) ? $culture[1] : 'ALL', 'lang' => $culture[0], 'view' => $this->view, 'parent' => $this->getRequest()->getUri(), 'st' => base64_encode($securityToken->toSerialForm()), 'url' => $this->application->getUrl());
     $this->hasApp = $this->application->isHadByMember($this->getUser()->getMemberId());
     $this->rpcToken = rand(0, getrandmax());
     $userprefParamPrefix = Shindig_Config::get('userpref_param_prefix', 'up_');
     foreach ($this->memberApplication->getUserSettings() as $name => $value) {
         $getParams[$userprefParamPrefix . $name] = $value;
     }
     if ($isUseOuterShindig) {
         $shindigUrl = Doctrine::getTable('SnsConfig')->get('shindig_url');
         if (substr($shindigUrl, -1) !== '/') {
             $shindigUrl .= '/';
         }
         $this->iframeUrl = $shindigUrl . 'gadgets/ifr?' . http_build_query($getParams) . '#rpctoken=' . $this->rpcToken;
     } else {
         $this->iframeUrl = sfContext::getInstance()->getController()->genUrl('gadgets/ifr') . '?' . http_build_query($getParams) . '#rpctoken=' . $this->rpcToken;
     }
 }
 /**
  * Executes generate container config
  *
  * @param sfWebRequest $request A request object
  */
 public function executeGenerateContainerConfig(sfWebRequest $request)
 {
     sfConfig::set('sf_web_debug', false);
     $response = $this->getResponse();
     $response->setContentType('text/javascript');
     $response->setHttpHeader('Content-Disposition', 'attachment; filename="openpne.js');
     $opOpenSocialContainerConfig = new opOpenSocialContainerConfig(false);
     $this->json = $opOpenSocialContainerConfig->generate();
 }