예제 #1
0
 /**
  * Setup initial
  * $this->aPageVars variables.
  * This variables are used by tplMain
  * - a main web page templates, regardless of
  * which controller is called - these vars are
  * always added to the page
  *
  *
  * @return object $this
  */
 protected function initPageVars()
 {
     if (!$this->bInitPageVars || Request::isAjax() || 'logout' === $this->action || 'login' === $this->action) {
         d('special case: ' . $this->action);
         return $this;
     }
     $Viewer = $this->Registry->Viewer;
     $this->aPageVars = \tplMain::getVars();
     $Ini = $this->Registry->Ini;
     $this->aPageVars['site_title'] = $Ini->SITE_TITLE;
     $this->aPageVars['site_url'] = $Ini->SITE_URL;
     $this->aPageVars['description'] = $this->aPageVars['site_description'] = $Ini->SITE_NAME;
     $this->aPageVars['show_comments'] = $Ini->SHOW_COMMENTS;
     $this->aPageVars['max_comments'] = $Ini->MAX_COMMENTS;
     $this->aPageVars['comments_timeout'] = $Ini->COMMENT_EDIT_TIME;
     $this->aPageVars['layoutID'] = $this->layoutID;
     $this->aPageVars['DISABLE_AUTOCOMPLETE'] = $Ini->DISABLE_AUTOCOMPLETE;
     $this->aPageVars['JS_MIN_ID'] = JS_MIN_ID;
     $this->aPageVars['home'] = $this->_('Home');
     /**
      * @todo later can change to something like
      * $this->oRegistrty->Viewer->getStyleID()
      *
      */
     $css = true === LAMPCMS_DEBUG ? '/_main.css' : '/main.css';
     $this->aPageVars['main_css'] = $Ini->CSS_SITE . '/style/' . STYLE_ID . '/' . VTEMPLATES_DIR . $css;
     if ('' !== ($gfcID = $Ini->GFC_ID)) {
         $this->addGFCCode($gfcID);
     }
     $aFacebookConf = $Ini->getSection('FACEBOOK');
     if (!empty($aFacebookConf)) {
         if (!empty($aFacebookConf['APP_ID'])) {
             $this->addMetaTag('fbappid', $aFacebookConf['APP_ID']);
             $this->addFacebookJs($aFacebookConf['APP_ID']);
             if (!empty($aFacebookConf['EXTENDED_PERMS'])) {
                 $this->addMetaTag('fbperms', $aFacebookConf['EXTENDED_PERMS']);
             }
         }
     }
     $this->aPageVars['session_uid'] = $Viewer->getUid();
     $this->aPageVars['role'] = $Viewer->getRoleId();
     $this->aPageVars['rep'] = $Viewer->getReputation();
     $this->aPageVars['version_id'] = Form::generateToken();
     /**
      * meta 'tw' will be set to string "1" if user has conneted Twitter
      */
     $this->addMetaTag('tw', '' !== (string) $Viewer->getTwitterSecret());
     /**
      * meta 'tw' will be set to string "1" if user has conneted Facebook
      */
     $this->addMetaTag('fb', '' !== (string) $Viewer->getFacebookToken());
     $js = true === LAMPCMS_DEBUG ? '/qa.js' : '/min/qa_' . JS_MIN_ID . '.js';
     //$js = (true === LAMPCMS_DEBUG) ? '/temp1.js' : '/min/qa_'.JS_MIN_ID.'.js';
     $src = $Ini->JS_SITE . '/js' . $js;
     $this->aPageVars['JS'] = $src;
     /**
      * @todo
      *  also add twitter id or username or just 'yes'
      *  of viewer so that we know viewer has twitter account
      *  and is capable of using twitter from our API
      *  Also we can ask use to add Twitter account
      *  if we know he does not have one connected yet
      */
     return $this;
 }
예제 #2
0
 /**
  * Setup initial
  * $this->aPageVars variables.
  * This variables are used by tplMain
  * - a main web page templates, regardless of
  * which controller is called - these vars are
  * always added to the page
  *
  *
  * @return object $this
  */
 protected function initPageVars()
 {
     if (!$this->bInitPageVars || Request::isAjax() || 'logout' === $this->action || 'login' === $this->action) {
         d('special case: ' . $this->action);
         return $this;
     }
     $Viewer = $this->Registry->Viewer;
     $this->aPageVars = \tplMain::getVars();
     $Ini = $this->Registry->Ini;
     $this->aPageVars['site_title'] = $Ini->SITE_TITLE;
     $this->aPageVars['site_url'] = $Ini->SITE_URL;
     $this->aPageVars['description'] = $this->aPageVars['site_description'] = $Ini->SITE_NAME;
     $this->aPageVars['show_comments'] = $Ini->SHOW_COMMENTS;
     $this->aPageVars['max_comments'] = $Ini->MAX_COMMENTS;
     $this->aPageVars['comments_timeout'] = $Ini->COMMENT_EDIT_TIME;
     $this->aPageVars['layoutID'] = $this->layoutID;
     $this->aPageVars['DISABLE_AUTOCOMPLETE'] = $Ini->DISABLE_AUTOCOMPLETE;
     $this->aPageVars['VERSION_ID'] = VERSION_ID;
     $this->aPageVars['home'] = $this->_('Home');
     /**
      * @todo later can change to something like
      * $this->Registrty->Viewer->getStyleID()
      *       To load style selected by user
      *
      */
     /**
      * If In debug mode OR running from github (not from build) then include non-minified version of css
      */
     $css = true === LAMPCMS_DEBUG || \strstr(VERSION_ID, 'package_version') ? '/_main.css?t=' . time() : '/main.css';
     $this->aPageVars['main_css'] = '{_CSS_SITE_}{_DIR_}/style/' . STYLE_ID . '/' . VTEMPLATES_DIR . $css;
     $aFacebookConf = $Ini->getSection('FACEBOOK');
     if (!empty($aFacebookConf)) {
         if (!empty($aFacebookConf['APP_ID'])) {
             $this->addMetaTag('fbappid', $aFacebookConf['APP_ID']);
             $this->addFacebookJs($aFacebookConf['APP_ID']);
             if (!empty($aFacebookConf['EXTENDED_PERMS'])) {
                 $this->addMetaTag('fbperms', $aFacebookConf['EXTENDED_PERMS']);
             }
         }
     }
     $this->aPageVars['session_uid'] = $Viewer->getUid();
     $this->aPageVars['role'] = $Viewer->getRoleId();
     $this->aPageVars['rep'] = $Viewer->getReputation();
     $this->aPageVars['version_id'] = Form::generateToken();
     /**
      * meta 'tw' will be set to string "1" if user has connected Twitter
      */
     $this->addMetaTag('tw', '' !== (string) $Viewer->getTwitterSecret());
     /**
      * meta 'tw' will be set to string "1" if user has connected Facebook
      */
     $this->addMetaTag('fb', '' !== (string) $Viewer->getFacebookToken());
     /**
      * If running in debug mode OR from github (not from build) then include non-minified version of qa.js
      */
     $js = true === LAMPCMS_DEBUG || \strstr(VERSION_ID, 'package_version') ? '/qa.js?t=' . time() : '/min/qa_' . VERSION_ID . '.js';
     $src = '{_JS_SITE_}{_DIR_}/js' . $js;
     $this->aPageVars['JS'] = $src;
     return $this;
 }