getInstance() public static méthode

Retrieves the singleton instance of this class.
public static getInstance ( ) : sfCoreAutoload
Résultat sfCoreAutoload A sfCoreAutoload implementation instance.
 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();
 }
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     if (file_exists('symfony')) {
         throw new sfCommandException(sprintf('A project named "%s" already exists in this directory.', $arguments['name']));
     }
     // create basic project structure
     $finder = sfFinder::type('any')->discard('.sf');
     $this->getFilesystem()->mirror(dirname(__FILE__) . '/skeleton/project', sfConfig::get('sf_root_dir'), $finder);
     // update project name and directory
     $finder = sfFinder::type('file')->name('properties.ini', 'apache.conf', 'propel.ini', 'databases.yml');
     $this->getFileSystem()->replaceTokens($finder->in(sfConfig::get('sf_config_dir')), '##', '##', array('PROJECT_NAME' => $arguments['name'], 'PROJECT_DIR' => sfConfig::get('sf_root_dir')));
     // update ProjectConfiguration class
     $this->getFileSystem()->replaceTokens(sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php', '##', '##', array('SYMFONY_LIB_DIR' => sfConfig::get('sf_symfony_lib_dir')));
     // update vhost sample file
     $this->getFileSystem()->replaceTokens(sfConfig::get('sf_config_dir') . '/vhost.sample', '##', '##', array('PROJECT_NAME' => $arguments['name'], 'SYMFONY_WEB_DIR' => sfConfig::get('sf_web_dir'), 'SYMFONY_SF_DIR' => realpath(sfCoreAutoload::getInstance()->getBaseDir() . '../data/web/sf')));
     // fix permission for common directories
     $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter);
     $fixPerms->setCommandApplication($this->commandApplication);
     $fixPerms->run();
     // publish assets for core plugins
     $publishAssets = new sfPluginPublishAssetsTask($this->dispatcher, $this->formatter);
     $publishAssets->setCommandApplication($this->commandApplication);
     $publishAssets->run(array(), array('--core-only'));
 }
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please component the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../bootstrap/unit.php';
$t = new lime_test(1);
$autoload = sfCoreAutoload::getInstance();
$t->is($autoload->getClassPath('sfaction'), $autoload->getBaseDir() . '/action/sfAction.class.php', '"sfCoreAutoload" is case-insensitive');
Exemple #4
0
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
chdir(dirname(__FILE__));
require_once dirname(__FILE__) . '/config/ProjectConfiguration.class.php';
include sfCoreAutoload::getInstance()->getBaseDir() . '/command/cli.php';