public function renderPdf($data, $pageSize = 'a4', $pageOrientation = 'portrait') { $previous_error_reporting = ini_get('error_reporting'); // to avoid the complaining for fixing DOMPDF_FONT_DIR at // siwappConfiguration.class.php ini_set('error_reporting', E_ALL ^ E_NOTICE); $input_data = $this->render($data, true); sfCoreAutoload::getInstance()->unregister(); sfAutoload::getInstance()->unregister(); if (class_exists('sfAutoloadAgain')) { sfAutoloadAgain::getInstance()->unregister(); } require_once sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'sfDomPDFPlugin' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'sfDomPDFPlugin.class.php'; $q = new sfDomPDFPlugin($input_data); sfCoreAutoload::getInstance()->register(); sfAutoload::getInstance()->register(); if (class_exists('sfAutoloadAgain')) { sfAutoloadAgain::getInstance()->register(); } $q->setProtocol('http://'); $q->setHost($_SERVER['HTTP_HOST']); $q->setPaper($pageSize, $pageOrientation); $q->render(); ini_set('error_reporting', $previous_error_reporting); return $q->getPdf(); }
public function __construct(ProjectConfiguration $projectConfiguration) { /* * We disable Symfony autoload again feature because it is too slow in dev mode * If you introduce a new class when using sympal you just must clear your * cache manually */ sfAutoloadAgain::getInstance()->unregister(); $this->_projectConfiguration = $projectConfiguration; $this->_dispatcher = $projectConfiguration->getEventDispatcher(); $this->_configureDoctrine(); // Listen to the sympal.load event to perform some context-dependent tasks $this->_dispatcher->connect('sympal.load', array($this, 'bootstrapFromContext')); $this->_dispatcher->connect('sympal.cache.prime', array($this, 'listenSympalCachePrime')); }
public function __construct(ProjectConfiguration $projectConfiguration) { // We disable Symfony autoload again feature because it is too slow in dev mode // If you introduce a new class when using sympal you just must clear your // cache manually sfAutoloadAgain::getInstance()->unregister(); $this->_projectConfiguration = $projectConfiguration; $this->_dispatcher = $projectConfiguration->getEventDispatcher(); $this->_doctrineManager = Doctrine_Manager::getInstance(); $this->_initializeSymfonyConfig(); $this->_markClassesAsSafe(); $this->_configureSuperCache(); $this->_configureDoctrine(); new sfSympalContextLoadFactoriesListener($this->_dispatcher, $this); new sfSympalTaskClearCacheListener($this->_dispatcher, $this); }
/** * @see sfProjectConfiguration */ public function initConfiguration() { parent::initConfiguration(); include $this->getConfigCache()->checkConfig('config/dm/config.yml'); /* * Replace sf default culture by first culture in dm cultures configuration */ sfConfig::set('sf_default_culture', dmArray::first(sfConfig::get('dm_i18n_cultures'))); /* * Symfony 1.3 registers sfAutoloadAgain on dev env. This causes huge performance issues. */ if ($this->isDebug()) { sfAutoloadAgain::getInstance()->unregister(); } /* * Now that we have the project config, we can configure the doctrine cache */ $this->configureDoctrineCache(Doctrine_Manager::getInstance()); }
/** * Various initializations. */ public function initConfiguration() { $configCache = $this->getConfigCache(); // in debug mode, start global timer if ($this->isDebug() && !sfConfig::get('sf_cli') && !sfWebDebugPanelTimer::isStarted()) { sfWebDebugPanelTimer::startTime(); } // required core classes for the framework if (!$this->isDebug() && !sfConfig::get('sf_test') && !sfConfig::get('sf_cli') && !self::$coreLoaded) { $configCache->import('config/core_compile.yml', false); } // autoloader(s) $this->dispatcher->connect('autoload.filter_config', array($this, 'filterAutoloadConfig')); sfAutoload::getInstance()->register(); if ($this->isDebug()) { sfAutoloadAgain::getInstance()->register(); } // load base settings include $configCache->checkConfig('config/settings.yml'); if ($file = $configCache->checkConfig('config/app.yml', true)) { include $file; } if (!sfConfig::get('sf_cli') && false !== sfConfig::get('sf_csrf_secret')) { sfForm::enableCSRFProtection(sfConfig::get('sf_csrf_secret')); } sfWidget::setCharset(sfConfig::get('sf_charset')); sfValidatorBase::setCharset(sfConfig::get('sf_charset')); // force setting default timezone if not set if ($default_timezone = sfConfig::get('sf_default_timezone')) { date_default_timezone_set($default_timezone); } else { if (sfConfig::get('sf_force_default_timezone', true)) { date_default_timezone_set(@date_default_timezone_get()); } } // error settings ini_set('display_errors', $this->isDebug() ? 'on' : 'off'); error_reporting(sfConfig::get('sf_error_reporting')); // initialize plugin configuration objects $this->initializePlugins(); // compress output if (!self::$coreLoaded && sfConfig::get('sf_compressed')) { ob_start('ob_gzhandler'); } self::$coreLoaded = true; }