Esempio n. 1
0
 /**
  * checks if env is develop, and if so:<br>
  * - adds Event Listerner to 'mvc.view.render.before'<br>
  * - starts collecting Infos and save it to Registry
  * 
  * @access public
  * @param \Smarty $oView
  * @return void
  */
 public function __construct(\Smarty $oView)
 {
     if ('develop' === \MVC\Registry::get('MVC_ENV')) {
         // add toolbar at the right time
         \MVC\Event::BIND('mvc.view.render.before', function ($oView) {
             \InfoTool\Model\Index::injectToolbar($oView);
         });
         // get toolbar values and save them to registry
         \MVC\Registry::set('aToolbar', $this->collectInfo($oView));
     }
 }
Esempio n. 2
0
File: IDS.php Progetto: gueff/mymvc
 /**
  * Starts IDS with the Config 
  * defined in /application/config/staging/{MVC_ENV}/ids.ini
  * 
  * @return \IDS\Init $oIdsInit
  */
 public static function init()
 {
     // By Binding to this Event you
     // could e.g. load a different config and save to Registry::set ('MVC_IDS_CONFIG', array([..]))
     Event::RUN('mvc.ids.init.before');
     $oIdsInit = Init::init(Registry::get('MVC_IDS_CONFIG'));
     // By Binding to this Event you
     // could modify the loaded config;
     // The Config you could access by $oIdsInit->config
     Event::RUN('mvc.ids.init.after', $oIdsInit);
     return $oIdsInit;
 }
Esempio n. 3
0
 /**
  * gets the policy rules; if one matches to the current request, it will be executed
  *
  * @access public
  * @return void
  */
 public function __construct()
 {
     Event::RUN('mvc.policy.before');
     Event::BIND('mvc.error', function ($mPackage) {
         \MVC\Error::addERROR($mPackage);
     });
     $aPolicy = $this->getPolicyRuleOnCurrentRequest();
     if (!empty($aPolicy)) {
         foreach ($aPolicy as $sPolicy) {
             if ('' !== $sPolicy) {
                 // execute policy
                 if (call_user_func($sPolicy) === FALSE) {
                     \MVC\Event::RUN('mvc.error', "Policy could not be executed: " . $sPolicy);
                 }
             }
         }
     }
     Event::RUN('mvc.policy.after');
 }
Esempio n. 4
0
File: View.php Progetto: gueff/mymvc
 /**
  * renders the template $this->sTemplate
  * 
  * @access public
  * @static
  * @return void
  */
 public function render()
 {
     \MVC\Event::RUN('mvc.view.render.before', $this);
     // Load Template and render
     $sTemplate = file_get_contents($this->sTemplate, true);
     $this->renderString($sTemplate);
     \MVC\Event::RUN('mvc.view.render.after', $this);
 }
Esempio n. 5
0
 /**
  * gets the uri protocol
  *
  * @access public
  * @static
  * @param mixed $mSsl
  * @return string http:// | https://
  */
 public static function GETURIPROTOCOL($mSsl = NULL)
 {
     // detect on ssl or not
     if (isset($mSsl)) {
         // http
         if ((int) $mSsl === 0 || $mSsl == FALSE) {
             return 'http://';
         } elseif ((int) $mSsl === 1 || $mSsl == true) {
             return 'https://';
         }
     } else {
         // http
         if (self::DETECTSSL() === FALSE) {
             return 'http://';
         } elseif (self::DETECTSSL() === true) {
             return 'https://';
         }
     }
     \MVC\Event::RUN('mvc.error', 'could not detect protocol of requested page.');
     return NULL;
 }