public static function instance() { if (self::$__instance == null) { self::$__instance = new PicnicBenchmark(); } return self::$__instance; }
public function render($data) { $type = $this->picnic()->router()->outputType(); if ($type == "xml") { PicnicBenchmark::instance()->mark("end"); header("Content-type: text/xml"); echo PicnicXMLParser::objects2XML($this->picnic()->controller()); exit; } else { if ($type == "json") { PicnicBenchmark::instance()->mark("end"); header("Content-type: text/x-javascript"); echo json_encode($this->picnic()->controller()); exit; } else { if ($this->_template == null) { throw new PicnicTemplateNotDefinedException("No template has been defined to use", 0, "PicnicView", "render"); } if (file_exists($this->templatePath())) { $contents = $this->getTemplateContents($this->templatePath()); if ($contents === false) { exit("TEMPLATE ERROR"); } PicnicBenchmark::instance()->mark("end"); if ($this->layoutTemplatePath() != "" && file_exists($this->layoutTemplatePath())) { // TODO: use getTemplateContents() include $this->layoutTemplatePath(); } else { echo $contents; } } else { throw new PicnicTemplateNotDefinedException("The template '{$this->_template}' does not exist in the template path '{$this->_templateFolder}'", 0, "PicnicView", "render"); } } } }
require_once PICNIC_DIR . "utils/class.networkrequest.php"; require_once PICNIC_DIR . "utils/class.xmlparser.php"; require_once PICNIC_DIR . "utils/class.version.php"; //require_once(PICNIC_DIR . "vendors/phpDataMapper/Model.php"); //require_once(PICNIC_DIR . "vendors/phpDataMapper/Model/Row.php"); //require_once(PICNIC_DIR . "vendors/phpDataMapper/Database/Adapter/Mysql.php"); require_once PICNIC_DIR . "class.base.php"; require_once PICNIC_DIR . "class.application.php"; require_once PICNIC_DIR . "class.benchmark.php"; require_once PICNIC_DIR . "class.configuration.php"; require_once PICNIC_DIR . "class.controller.php"; require_once PICNIC_DIR . "class.factory.php"; require_once PICNIC_DIR . "class.model.php"; require_once PICNIC_DIR . "class.router.php"; require_once PICNIC_DIR . "class.view.php"; PicnicBenchmark::instance()->mark("start"); class Picnic { private $_controller; private $_currentRoute; private $_currentRequestUrl = null; private $_router; private $_view; private $_databaseAdapter; private $_pdo; private $_applications; private static $__instance; const VERSION = "0.2.7"; //new PicnicVersion(0, 2, 5); public static function exceptionHandler($ex) {