PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/sample/core/classes/Core.php

https://github.com/caferrari/vortice_book
PHP | 80 lines | 33 code | 14 blank | 33 comment | 5 complexity | 47b91d73b235834506ca20e7c2d8dffb MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /*
  3. * Copyright (c) 2008, Carlos André Ferrari <[carlos@]ferrari.eti.br>; Luan Almeida <[luan@]luan.eti.br>
  4. * All rights reserved.
  5. */
  6. /**
  7. * Framework core class
  8. *
  9. * @version 1
  10. * @package Framework
  11. * @author Carlos André Ferrari <carlos@ferrari.eti.br>
  12. */
  13. class Core{
  14. /**
  15. * Return content
  16. *
  17. * @var string
  18. * @access private
  19. */
  20. private $content;
  21. /**
  22. * Start Execution Time
  23. *
  24. * @var float
  25. * @access private
  26. */
  27. public $start;
  28. /**
  29. * Constructor. make all happens
  30. *
  31. * @return void
  32. */
  33. public function __construct(){
  34. $this->start = microtime_float();
  35. header('Content-type: text/html; charset=UTF-8');
  36. header('X-Powered-By: VorticePHP');
  37. require_once 'Env.php';
  38. Env::setup();
  39. require_once 'Crypt.php';
  40. require_once 'Session.php';
  41. require_once 'Vortice.php';
  42. require_once 'I18n.php';
  43. require_once 'Link.php';
  44. require_once 'Route.php';
  45. require_once 'Post.php';
  46. if (file_exists(root . 'app/functions.php')) include root . 'app/functions.php';
  47. Link::translateUri();
  48. if (file_exists(root . 'app/route.php')) include root . 'app/route.php';
  49. I18n::start();
  50. if (!defined('controller')) Link::parseQuery();
  51. Post::start();
  52. Vortice::start();
  53. if (file_exists(root . 'app/app.php')) include root . 'app/app.php';
  54. $this->content = Vortice::render();
  55. header ('Vortice-LoadTime:' . (microtime_float() - $this->start));
  56. }
  57. /**
  58. * Return loaded contents
  59. *
  60. * @return string
  61. */
  62. public function &__toString(){
  63. if (!is_string($this->content)) $this->content = '';
  64. return $this->content;
  65. }
  66. }