Example #1
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     if (!empty($this->_config['events'])) {
         $this->setEvents($this->_config['events']);
     }
 }
Example #2
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // inflection dependency
     $this->_inflect = Solar::dependency('Solar_Inflect', 'inflect');
     // model stack
     $this->_setStack($this->_config['classes']);
 }
Example #3
0
 /**
  * 
  * Modifies $this->_config after it has been built.
  * 
  * @return void
  * 
  */
 protected function _postConfig()
 {
     parent::_postConfig();
     if (empty($this->_config['output'])) {
         $mode = PHP_SAPI == 'cli' ? 'text' : 'html';
         $this->_config['output'] = $mode;
     }
 }
Example #4
0
 /**
  * _postConstruct
  *
  * @param $model
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_model = $this->_config['model'];
     $this->_view_path = Solar_Class::dir($this, 'View');
     $this->_view_file = 'index.php';
     $this->_view = Solar::factory('Solar_View', array('template_path' => $this->_view_path));
 }
Example #5
0
 /**
  * _postConstruct
  *
  * @param $model
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_model = $this->_config['model'];
     $this->_view_path = Solar_Class::dir($this, 'View');
     $this->_view_file = 'index.php';
     $this->_view = Solar::factory('Solar_View', array('template_path' => $this->_view_path));
     $this->register = array('_preRender' => array('index' => array('main' => 'preRender')), '_postRender' => array('index' => array('main' => 'postRender')), '_preRun' => array('index' => array('main' => 'preRun')), '_postRun' => array('index' => array('main' => 'postRun')), '_postAction' => array('index' => array('main' => 'postAction')));
 }
Example #6
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     if (empty($this->_config['_view']) || !$this->_config['_view'] instanceof Solar_View) {
         // we need the parent view object
         throw Solar::exception(get_class($this), 'ERR_VIEW_NOT_SET', "Config key '_view' not set, or not Solar_View object");
     }
     $this->_view = $this->_config['_view'];
     unset($this->_config['_view']);
 }
Example #7
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // keep the cache active flag
     $this->_active = (bool) $this->_config['active'];
     // keep the cache lifetime value
     $this->_life = (int) $this->_config['life'];
     // keep the cache entry prefix
     $this->_prefix = (string) $this->_config['prefix'];
 }
Example #8
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     if ($this->_config['base']) {
         $this->setBase($base);
     } else {
         $base = $this->_findBaseByClass(__CLASS__);
         $this->setBase($base);
     }
 }
Example #9
0
 /**
  * _postConstruct
  *
  * @param $model
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_model = $this->_config['model'];
     if (isset($_SERVER['DOCUMENT_ROOT'])) {
         $web_root = $_SERVER['DOCUMENT_ROOT'];
     } else {
         $web_root = Solar::$system . '/docroot/';
     }
     $this->_view_path = $web_root . 'modules/' . $this->name . '/View';
     $this->_view_file = 'index.php';
     $this->_view = Solar::factory('Solar_View', array('template_path' => $this->_view_path));
 }
Example #10
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // stdout and stderr
     $this->_stdout = fopen('php://stdout', 'w');
     $this->_stderr = fopen('php://stderr', 'w');
     // set the recognized options
     $options = $this->_fetchGetoptOptions();
     $this->_getopt = Solar::factory('Solar_Getopt');
     $this->_getopt->setOptions($options);
     // follow-on setup
     $this->_setup();
 }
Example #11
0
 /**
  * _postConstruct
  *
  * @param $model
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_model = $this->_config['model'];
     $this->web_root = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : Solar::$system . DIRECTORY_SEPARATOR . 'docroot' . DIRECTORY_SEPARATOR;
     $this->web_root = Solar_Dir::fix($this->web_root);
     $class_arr = explode('_', get_class($this));
     $this->_module_name = end($class_arr);
     $this->_module_info = $this->_model->modules->fetchModuleInfoByName($this->_module_name);
     $this->_setViewPath();
     $this->_setViewFile();
     $this->_setView();
     $this->_view->addHelperClass('Foresmo_View_Helper');
 }
Example #12
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // get the current request environment
     $this->_request = Solar_Registry::get('request');
     // set convenience vars from config
     $this->_routing = $this->_config['routing'];
     $this->_default = $this->_config['default'];
     $this->_disable = (array) $this->_config['disable'];
     // set up a class stack for finding commands
     $this->_stack = Solar::factory('Solar_Class_Stack');
     $this->_stack->add($this->_config['classes']);
     // extended setup
     $this->_setup();
 }
Example #13
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // setup
     $this->_setup();
     // start up authentication
     $this->_authStart();
     // is this a valid authenticated user?
     if ($this->auth->isValid()) {
         $this->_loadRoles();
     } else {
         // no, user is not valid.
         // clear out any previous roles.
         $this->role->reset();
         $this->access->reset();
     }
     // load up the access list for the handle and roles
     $this->_loadAccess();
 }
Example #14
0
 /**
  * 
  * Uses the chain locale object to get translations before falling back
  * to this object for locale.
  * 
  * @param string $key The translation key, typically a validation method
  * name.
  * 
  * @return string
  * 
  */
 protected function _chainLocale($key)
 {
     // the translated message; default to the translation key.
     $msg = $key;
     // if we have a locale object, get a message from it
     if ($this->_chain_locale_object) {
         // try to translate
         $msg = $this->_chain_locale_object->locale($key);
         // if the key failed to translate, fall back to the
         // translations from $this, but only if $this wasn't
         // the source to begin with.
         $failed = $msg === null || $msg == $key;
         if ($failed && $this != $this->_chain_locale_object) {
             $msg = $this->locale($key);
         }
     }
     // done
     return $msg;
 }
Example #15
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // get the current request environment
     $this->_request = Solar_Registry::get('request');
 }
Example #16
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->reset();
 }
Example #17
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // only set up the handler if it doesn't exist yet.
     if (!self::$_handler) {
         self::$_handler = Solar::dependency('Solar_Session_Handler', $this->_config['handler']);
     }
     // only set up the request if it doesn't exist yet.
     if (!self::$_request) {
         self::$_request = Solar_Registry::get('request');
     }
     // determine the storage segment; use trim() and strict-equals to
     // allow for string zero segment names.
     $this->_class = trim($this->_config['class']);
     if ($this->_class === '') {
         $this->_class = 'Solar';
     }
     // set the class
     $this->setClass($this->_class);
     // lazy-start any existing session
     $this->lazyStart();
 }
Example #18
0
 /**
  * _postConstruct
  *
  * @param $model
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_model = $this->_config['model'];
 }
Example #19
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // PHPDoc parser
     $this->_phpdoc = Solar::dependency('Solar_Docs_Phpdoc', $this->_config['phpdoc']);
     // Logger
     $this->_log = Solar::dependency('Solar_Log', $this->_config['log']);
 }
Example #20
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->_filter = $this->_config['filter'];
     $this->_resetInvalid();
 }
Example #21
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // Establish the state of this object before _setup
     $this->_preSetup();
     // user-defined setup
     $this->_setup();
     // Complete the setup of this model
     $this->_postSetup();
 }
Example #22
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // custom boundary string
     if ($this->_config['boundary']) {
         $this->_boundary = $this->_config['boundary'];
     } else {
         $this->_boundary = '__' . hash('md5', uniqid());
     }
     // custom encoding
     if ($this->_config['encoding']) {
         $this->_encoding = $this->_config['encoding'];
     }
     // custom charset
     if ($this->_config['charset']) {
         $this->_charset = $this->_config['charset'];
     }
     // custom CRLF
     if ($this->_config['crlf']) {
         $this->_crlf = $this->_config['crlf'];
     }
     // custom headers
     if ($this->_config['headers']) {
         foreach ((array) $this->_config['headers'] as $label => $value) {
             $this->addHeader($label, $value);
         }
     }
     // do we have an injected transport?
     if ($this->_config['transport']) {
         $this->_transport = Solar::dependency('Solar_Mail_Transport', $this->_config['transport']);
     }
 }
Example #23
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // get the current request environment
     $this->_request = Solar_Registry::get('request');
     // set per config
     $this->allow = (bool) $this->_config['allow'];
     // cache dependency injection
     $this->_cache = Solar::dependency('Solar_Cache', $this->_config['cache']);
 }
Example #24
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->setCode($this->_config['code']);
 }
Example #25
0
 /**
  * 
  * Dumps the values of this object.
  * 
  * @param mixed $var If null, dump $this; if a string, dump $this->$var;
  * otherwise, dump $var.
  * 
  * @param string $label Label the dump output with this string.
  * 
  * @return void
  * 
  */
 public function dump($var = null, $label = null)
 {
     if ($var) {
         return parent::dump($var, $label);
     } else {
         $clone = clone $this;
         unset($clone->_config);
         return parent::dump($clone, $label);
     }
 }
Example #26
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // connect to the database with dependency injection
     $this->_sql = Solar::dependency('Solar_Sql', $this->_config['sql']);
     // set up defaults
     $this->setPaging($this->_config['paging']);
 }
Example #27
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // get the current request environment.  may already have been set by
     // extended classes.
     if (!$this->_request) {
         $this->_request = Solar_Registry::get('request');
     }
     // fix the base path by adding leading and trailing slashes
     if (trim($this->_config['path']) == '') {
         $this->_config['path'] = '/';
     }
     if ($this->_config['path'][0] != '/') {
         $this->_config['path'] = '/' . $this->_config['path'];
     }
     $this->_config['path'] = rtrim($this->_config['path'], '/') . '/';
     // set properties
     $this->set($this->_config['uri']);
 }
Example #28
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // set convenience vars from config
     $this->_default = (string) $this->_config['default'];
     $this->_disable = (array) $this->_config['disable'];
     $this->_routing = (array) $this->_config['routing'];
     // set up a class stack for finding apps
     $this->_stack = Solar::factory('Solar_Class_Stack');
     $this->_stack->add($this->_config['classes']);
     // extended setup
     $this->_setup();
 }
Example #29
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // @todo inherit initial $_data values
     if ($this->_data) {
         $this->_data_keylock = true;
     }
     // load data from config
     if ($this->_config['data']) {
         $this->load($this->_config['data']);
     }
 }
Example #30
0
 /**
  * 
  * Convenience method for getting a dump the whole object, or one of its
  * properties, or an external variable.
  * 
  * @param mixed $var If null, dump $this; if a string, dump $this->$var;
  * otherwise, dump $var.
  * 
  * @param string $label Label the dump output with this string.
  * 
  * @return void
  * 
  */
 public function dump($var = null, $label = null)
 {
     if ($var) {
         return parent::dump($var, $label);
     }
     $clone = clone $this;
     unset($clone->_config);
     unset($clone->_native_model);
     unset($clone->_foreign_model);
     unset($clone->_inflect);
     return parent::dump($clone, $label);
 }