本文整理汇总了PHP中sfApplicationConfiguration::loadHelpers方法的典型用法代码示例。如果您正苦于以下问题:PHP sfApplicationConfiguration::loadHelpers方法的具体用法?PHP sfApplicationConfiguration::loadHelpers怎么用?PHP sfApplicationConfiguration::loadHelpers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfApplicationConfiguration
的用法示例。
在下文中一共展示了sfApplicationConfiguration::loadHelpers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* {@inheritdoc}
*/
public function boot(ContainerInterface $container)
{
if (empty($this->options)) {
throw new \RuntimeException('You must provide options for the Symfony 1.4 kernel.');
}
if ($this->isBooted()) {
return;
}
if ($this->classLoader && !$this->classLoader->isAutoloaded()) {
$this->classLoader->autoload();
}
$dispatcher = $container->get('event_dispatcher');
$event = new LegacyKernelBootEvent($container->get('request'), $this->options);
$dispatcher->dispatch(LegacyKernelEvents::BOOT, $event);
$this->options = $event->getOptions();
require_once $this->rootDir . '/config/ProjectConfiguration.class.php';
$application = $this->options['application'];
$environment = $this->options['environment'];
$debug = $this->options['debug'];
$this->configuration = \ProjectConfiguration::getApplicationConfiguration($application, $environment, $debug, $this->getRootDir());
$this->configuration->loadHelpers(array('Url'));
// Create a context to use with some helpers like Url.
if (!\sfContext::hasInstance()) {
$session = $container->get('session');
if ($session->isStarted()) {
$session->save();
}
ob_start();
\sfContext::createInstance($this->configuration);
ob_end_flush();
$session->migrate();
}
$this->isBooted = true;
}
示例2: loadExtensions
/**
* Loads standard extensions for Symfony into the view.
*/
protected function loadExtensions()
{
// should be replaced with sf_twig_standard_extensions
$prefixes = array_merge(array('Helper', 'Url', 'Asset', 'Tag', 'Escaping', 'Partial', 'I18N'), sfConfig::get('sf_standard_helpers'));
foreach ($prefixes as $prefix) {
$class_name = $prefix . '_Twig_Extension';
if (class_exists($class_name)) {
$this->twig->addExtension(new $class_name());
}
}
// for now the extensions needs the original helpers so lets load thoose.
$this->configuration->loadHelpers($prefixes);
// makes it possible to load custom twig extensions.
foreach (sfConfig::get('sf_twig_extensions', array()) as $extension) {
if (!class_exists($extension)) {
throw new InvalidArgumentException(sprintf('Unable to load "%s" as an Twig_Extension into Twig_Environment', $extension));
}
$this->twig->addExtension(new $extension());
}
}