Common\Core\Init::initialize PHP Method

initialize() public method

public initialize ( string $type )
$type string The type of init to load, possible values are: frontend, frontend_ajax, frontend_js.
    public function initialize($type)
    {
        $type = (string) $type;
        // check if this is a valid type
        if (!in_array($type, $this->allowedTypes)) {
            throw new InvalidInitTypeException($type, $this->allowedTypes);
        }
        $this->type = $type;
        // set a default timezone if no one was set by PHP.ini
        if (ini_get('date.timezone') == '') {
            date_default_timezone_set('Europe/Brussels');
        }
        // get last modified time for globals
        $lastModifiedTime = @filemtime(PATH_WWW . '/app/config/parameters.yml');
        // reset last modified time if needed when invalid or debug is active
        if ($lastModifiedTime === false || $this->getContainer()->getParameter('kernel.debug')) {
            $lastModifiedTime = time();
        }
        // define as a constant
        defined('LAST_MODIFIED_TIME') || define('LAST_MODIFIED_TIME', $lastModifiedTime);
    }

Usage Example

Example #1
0
 /**
  * @param string $type The type of init to load, possible values are: frontend, frontend_ajax, frontend_js.
  */
 public function initialize($type)
 {
     parent::initialize($type);
     \SpoonFilter::disableMagicQuotes();
 }
All Usage Examples Of Common\Core\Init::initialize