<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));


error_reporting(E_ALL  & ~E_NOTICE & ~E_STRICT & ~E_WARNING );

set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));

require_once 'Zend/Application.php';
		
date_default_timezone_set('Europe/Moscow');

$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);




try {

    
    
    // Эта функция избавляется от переносов, пробелов и т.д.
    function compress_html($compress)
    { 
      
      $str = str_replace("\t",'', $compress);
      $str = preg_replace('/\x20{1,}/su', ' ', $str);
      
      if(PHP_EOL === "\r\n") {
        $str = preg_replace('/(\r\n|\x20){2,}/',"\r\n", $str);
      } elseif(PHP_EOL === "\r") {
        $str = preg_replace('/(\r|\x20){2,}/',"\r", $str);
      } elseif(PHP_EOL === "\n") {
        $str = preg_replace('/(\n|\x20){2,}/',"\n", $str);
      }
      
      $i = array("\r\n ", "\r ", "\n ");
      $ii = '';
      //$str = str_replace($i,$ii,$str);
      return  str_replace('> <','><', $str);
      
    }
    
    $application->bootstrap()->run();
    

    
    // конец буферизации и вывод сжатого html кода
    //ob_end_flush();  
      
    
} catch (Zend_Db_Adapter_Exception $e){
    echo "Zend_Db_Adapter_Exception [".APPLICATION_ENV."]";
}
