/**
  *
  * @return sfView
  */
 protected function getView(sfController $controller, $module, $name, array $params, $layout) {
     $view = $controller->getView($module, $name, '');
     if (!$view->getDirectory()) {
         $view->setDirectory(sfConfig::get('app_ggEmail_templateDir', sfConfig::get('sf_lib_dir') . '/email/modules') . '/' . $module . '/templates');
     }
     $view->execute();
     if (isset($layout)) {
         $view->setDecoratorTemplate($layout);
         if (!is_readable($view->getDecoratorDirectory() . '/' . $view->getDecoratorTemplate())) {
             $view->setDecoratorTemplate(sfConfig::get('app_ggEmail_layoutDir', sfConfig::get('sf_lib_dir') . '/email/templates') . '/' . $layout);
         }
         if (!is_readable($view->getDecoratorDirectory() . '/' . $view->getDecoratorTemplate())) {
             throw new Exception("No usable layout found for email '$module'/'$name': layout '$layout'");
         }
     } elseif (!is_readable($view->getDecoratorDirectory() . '/' . $view->getDecoratorTemplate())) {
         $view->setDecoratorDirectory(sfConfig::get('app_ggEmail_layoutDir', sfConfig::get('sf_lib_dir') . '/email/templates'));
     }
     $view->getAttributeHolder()->add($params);
     return $view;
 }
Esempio n. 2
0
 protected function initialize()
 {
     $this->logger = sfLogger::getInstance();
     if (sfConfig::get('sf_logging_enabled')) {
         $this->logger->info('{sfContext} initialization');
     }
     if (sfConfig::get('sf_use_database')) {
         $this->databaseManager = new sfDatabaseManager();
         $this->databaseManager->initialize();
     }
     $this->actionStack = new sfActionStack();
     // 'config/factories.yml' config file
     // auto-generated by sfFactoryConfigHandler
     // date: 2015/09/01 13:56:04
     $this->controller = sfController::newInstance(sfConfig::get('sf_factory_controller', 'sfFrontWebController'));
     $this->request = sfRequest::newInstance(sfConfig::get('sf_factory_request', 'sfWebRequest'));
     $this->response = sfResponse::newInstance(sfConfig::get('sf_factory_response', 'sfWebResponse'));
     $this->storage = sfStorage::newInstance(sfConfig::get('sf_factory_storage', 'sfSessionStorage'));
     $this->user = sfUser::newInstance(sfConfig::get('sf_factory_user', 'myUser'));
     $this->controller->initialize($this);
     $this->request->initialize($this, sfConfig::get('sf_factory_request_parameters', NULL), sfConfig::get('sf_factory_request_attributes', array()));
     $this->response->initialize($this, sfConfig::get('sf_factory_response_parameters', NULL));
     $this->storage->initialize($this, sfConfig::get('sf_factory_storage_parameters', array('session_name' => 'symfony')));
     $this->user->initialize($this, sfConfig::get('sf_factory_user_parameters', NULL));
     if (sfConfig::get('sf_cache')) {
         $this->viewCacheManager = new sfViewCacheManager();
         $this->viewCacheManager->initialize($this, sfConfig::get('sf_factory_view_cache', 'sfFileCache'), sfConfig::get('sf_factory_view_cache_parameters', array('automaticCleaningFactor' => 0, 'cacheDir' => '/Applications/MAMP/trademark/cache/backend/prod/template')));
     }
     register_shutdown_function(array($this, 'shutdown'));
 }
Esempio n. 3
0
 protected function initialize()
 {
     $this->logger = sfLogger::getInstance();
     if (sfConfig::get('sf_logging_enabled')) {
         $this->logger->info('{sfContext} initialization');
     }
     if (sfConfig::get('sf_use_database')) {
         $this->databaseManager = new sfDatabaseManager();
         $this->databaseManager->initialize();
     }
     $this->actionStack = new sfActionStack();
     $this->controller = sfController::newInstance(sfConfig::get('sf_factory_controller', 'sfFrontWebController'));
     $this->request = sfRequest::newInstance(sfConfig::get('sf_factory_request', 'sfWebRequest'));
     $this->response = sfResponse::newInstance(sfConfig::get('sf_factory_response', 'sfWebResponse'));
     $this->storage = sfStorage::newInstance(sfConfig::get('sf_factory_storage', 'sfSessionStorage'));
     $this->user = sfUser::newInstance(sfConfig::get('sf_factory_user', 'myUser'));
     $this->controller->initialize($this);
     $this->request->initialize($this, sfConfig::get('sf_factory_request_parameters', NULL), sfConfig::get('sf_factory_request_attributes', array()));
     $this->response->initialize($this, sfConfig::get('sf_factory_response_parameters', NULL));
     $this->storage->initialize($this, sfConfig::get('sf_factory_storage_parameters', array('session_name' => 'symfony')));
     $this->user->initialize($this, sfConfig::get('sf_factory_user_parameters', NULL));
     if (sfConfig::get('sf_cache')) {
         $this->viewCacheManager = new sfViewCacheManager();
         $this->viewCacheManager->initialize($this, sfConfig::get('sf_factory_view_cache', 'sfFileCache'), sfConfig::get('sf_factory_view_cache_parameters', array('automaticCleaningFactor' => 0, 'cacheDir' => 'C:\\xampp\\htdocs\\bm400\\cache\\pmbonline\\dev\\template')));
     }
     register_shutdown_function(array($this, 'shutdown'));
 }
<?php

// auto-generated by sfFactoryConfigHandler
// date: 2009/08/15 10:45:03
$this->controller = sfController::newInstance(sfConfig::get('sf_factory_controller', 'sfFrontWebController'));
$this->request = sfRequest::newInstance(sfConfig::get('sf_factory_request', 'sfWebRequest'));
$this->response = sfResponse::newInstance(sfConfig::get('sf_factory_response', 'sfWebResponse'));
$this->storage = sfStorage::newInstance(sfConfig::get('sf_factory_storage', 'sfSessionStorage'));
$this->user = sfUser::newInstance(sfConfig::get('sf_factory_user', 'myUser'));
$this->controller->initialize($this);
$this->request->initialize($this, sfConfig::get('sf_factory_request_parameters', NULL), sfConfig::get('sf_factory_request_attributes', array()));
$this->response->initialize($this, sfConfig::get('sf_factory_response_parameters', NULL));
$this->storage->initialize($this, sfConfig::get('sf_factory_storage_parameters', array('session_name' => 'symfony')));
$this->user->initialize($this, sfConfig::get('sf_factory_user_parameters', NULL));
if (sfConfig::get('sf_cache')) {
    $this->viewCacheManager = new sfViewCacheManager();
    $this->viewCacheManager->initialize($this, sfConfig::get('sf_factory_view_cache', 'sfFileCache'), sfConfig::get('sf_factory_view_cache_parameters', array('automaticCleaningFactor' => 0, 'cacheDir' => '/Users/takizo/Sites/coscupdemo/cache/frontend/dev/template')));
}
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once $_test_dir . '/unit/sfContextMock.class.php';
$t = new lime_test(18, new lime_output_color());
sfConfig::set('sf_max_forwards', 10);
$context = new sfContext();
$controller = sfController::newInstance('sfFrontWebController');
$controller->initialize($context, null);
$tests = array('module/action' => array('', array('module' => 'module', 'action' => 'action')), 'module/action?id=12' => array('', array('module' => 'module', 'action' => 'action', 'id' => 12)), 'module/action?id=12&' => array('', array('module' => 'module', 'action' => 'action', 'id' => '12&')), 'module/action?id=12&test=4&toto=9' => array('', array('module' => 'module', 'action' => 'action', 'id' => 12, 'test' => 4, 'toto' => 9)), 'module/action?id=12&test=4&5&6&7&&toto=9' => array('', array('module' => 'module', 'action' => 'action', 'id' => 12, 'test' => '4&5&6&7&', 'toto' => 9)), 'module/action?test=value1&value2&toto=9' => array('', array('module' => 'module', 'action' => 'action', 'test' => 'value1&value2', 'toto' => 9)), 'module/action?test=value1&value2' => array('', array('module' => 'module', 'action' => 'action', 'test' => 'value1&value2')), 'module/action?test=value1=value2&toto=9' => array('', array('module' => 'module', 'action' => 'action', 'test' => 'value1=value2', 'toto' => 9)), 'module/action?test=value1=value2' => array('', array('module' => 'module', 'action' => 'action', 'test' => 'value1=value2')), 'module/action?test=4&5&6&7&&toto=9&id=' => array('', array('module' => 'module', 'action' => 'action', 'test' => '4&5&6&7&', 'toto' => 9, 'id' => '')), '@test?test=4' => array('test', array('test' => 4)), '@test' => array('test', array()), '@test?id=12&foo=bar' => array('test', array('id' => 12, 'foo' => 'bar')), '@test?id=foo%26bar&foo=bar%3Dfoo' => array('test', array('id' => 'foo&bar', 'foo' => 'bar=foo')));
// ->convertUrlStringToParameters()
$t->diag('->convertUrlStringToParameters()');
foreach ($tests as $url => $result) {
    $t->is($controller->convertUrlStringToParameters($url), $result, sprintf('->convertUrlStringToParameters() converts a symfony internal URI to an array of parameters (%s)', $url));
}
try {
    $controller->convertUrlStringToParameters('@test?foobar');
    $t->fail('->convertUrlStringToParameters() throw a sfParseException if it cannot parse the query string');
} catch (sfParseException $e) {
    $t->pass('->convertUrlStringToParameters() throw a sfParseException if it cannot parse the query string');
}
// ->redirect()
$t->diag('->redirect()');
sfConfig::set('sf_test', true);
Esempio n. 6
0
 /**
  *
  * @return sfView
  */
 protected function getView(sfController $controller, $module, $name, array $params, $layout)
 {
     //--------------------------------------------------------------------------
     // look for a template in the specified module
     // sf_root_dir/apps/<current application>/modules/<$module>/templates/<$name>.php
     //--------------------------------------------------------------------------
     $view = $controller->getView($module, $name, '');
     //--------------------------------------------------------------------------
     // if the template cannot be found, look in the directory specified in
     // [app_esEmailPlugin_templateDir]/<$module>/templates or
     // [sf_lib_dir]/email/modules/<$module>/templates
     //--------------------------------------------------------------------------
     if (!$view->getDirectory()) {
         $view->setDirectory(sfConfig::get('app_esEmailPlugin_templateDir', sfConfig::get('sf_lib_dir') . '/email/modules') . '/' . $module . '/templates');
     }
     $view->execute();
     //--------------------------------------------------------------------------
     // look for specific layout (if specified)
     //--------------------------------------------------------------------------
     if (isset($layout)) {
         $view->setDecoratorTemplate($layout);
         //------------------------------------------------------------------------
         // look in sf_root_dir/apps/<current application>/templates
         //------------------------------------------------------------------------
         if (!is_readable($view->getDecoratorDirectory() . '/' . $view->getDecoratorTemplate())) {
             //----------------------------------------------------------------------
             // if the layout cannot be found, look in the directory specified in
             // [app_esEmailPlugin_layoutDir]/email/templates or
             // [sf_lib_dir]/email/templates
             //----------------------------------------------------------------------
             $view->setDecoratorTemplate(sfConfig::get('app_esEmailPlugin_layoutDir', sfConfig::get('sf_lib_dir') . '/email/templates') . '/' . $layout);
         }
         if (!is_readable($view->getDecoratorDirectory() . '/' . $view->getDecoratorTemplate())) {
             throw new Exception("No usable layout found for email '{$module}'/'{$name}': layout '{$layout}'");
         }
     } elseif (!is_readable($view->getDecoratorDirectory() . '/' . $view->getDecoratorTemplate())) {
         //------------------------------------------------------------------------
         // no default layout found in default layout directory, so look for
         // default layout in [app_esEmailPlugin_layoutDir]/email/templates
         //------------------------------------------------------------------------
         $view->setDecoratorDirectory(sfConfig::get('app_esEmailPlugin_layoutDir', sfConfig::get('sf_lib_dir') . '/email/templates'));
     }
     $view->getAttributeHolder()->add($params);
     return $view;
 }