Ejemplo n.º 1
0
    /**
     * 
     * Generates the script block required by Facebook.
     * 
     * @return void
     * 
     */
    protected function _postConstruct()
    {
        parent::_postConstruct();
        // retain the facebook dependency
        $this->_facebook = Solar::dependency('Facebook', $this->_config['facebook']);
        // add the FB script to the foot helper
        $href = "http://connect.facebook.net/en_US/all.js";
        $this->_view->foot()->addScript($href);
        // initialize the application and set up login event subscription,
        // also done via the foot helper
        $appid = $this->_facebook->getAppId();
        $inline = <<<INLINE
FB.init({appId: '{$appid}', xfbml: true, cookie: true});
FB.Event.subscribe('auth.login', function(response) {
  window.location.reload();
});
INLINE;
        $this->_view->foot()->addScriptInline($inline);
    }
Ejemplo n.º 2
0
    /**
     * 
     * Generates the script block required by Google Analytics
     * 
     * @return void
     * 
     */
    protected function _postConstruct()
    {
        parent::_postConstruct();
        $setDomainName = '';
        if ($this->_config['domain_name']) {
            $setDomainName = "\n  _gaq.push(['_setDomainName', '{$this->_config['domain_name']}']);";
        }
        $setAllowLinker = '';
        if ($this->_config['allow_linker']) {
            $setAllowLinker = "\n  _gaq.push(['_setAllowLinker', true]);";
        }
        $inline = <<<INLINE
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '{$this->_config['google_ua']}']);{$setDomainName}{$setAllowLinker}
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
INLINE;
        $this->_view->foot()->addScriptInline($inline);
    }
Ejemplo n.º 3
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // set the origin timezone
     $this->_tz_origin = $this->_config['tz_origin'];
     if (!$this->_tz_origin) {
         $this->_tz_origin = date_default_timezone_get();
     }
     // set the output timezone
     $this->_tz_output = $this->_config['tz_output'];
     if (!$this->_tz_output) {
         $this->_tz_output = date_default_timezone_get();
     }
     // if different zones, determine the offset between them
     if ($this->_tz_origin != $this->_tz_output) {
         // origin timestamp
         $origin_tz = new DateTimeZone($this->_tz_origin);
         $origin_date = new DateTime('now', $origin_tz);
         $origin_offset = $origin_tz->getOffset($origin_date);
         if ($origin_offset < 0) {
             $origin_offset += 12 * 3600;
             // move forward 12 hours
         }
         // output timestamp
         $output_tz = new DateTimeZone($this->_tz_output);
         $output_date = new DateTime('now', $output_tz);
         $output_offset = $output_tz->getOffset($output_date);
         if ($output_offset < 0) {
             $output_offset += 12 * 3600;
             // move forward 12 hours
         }
         // retain the differential offset
         $this->_tz_offset = $output_offset - $origin_offset;
     }
 }
Ejemplo n.º 4
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_uri = Solar::factory('Solar_Uri_Action');
 }
Ejemplo n.º 5
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 public function _postConstruct()
 {
     parent::_postConstruct();
     // get the current request environment
     $this->_request = Solar::dependency('Solar_Request', $this->_config['request']);
     // make sure we have a default action
     $action = $this->_request->server('REQUEST_URI');
     $this->_default_attribs['action'] = $action;
     // reset the form propertes
     $this->reset();
 }
Ejemplo n.º 6
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_rewrite = Solar_Registry::get('rewrite');
 }
Ejemplo n.º 7
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_class = $this->_config['class'];
 }