Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * Initialization for propel and i18n propel integration.
13
 *
14
 * @package    sfPropelPlugin
15
 * @subpackage addon
16
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17
 * @version    SVN: $Id: sfPropel.class.php 23737 2009-11-09 23:23:25Z Kris.Wallsmith $
18
 */
19
class sfPropel
20
{
21
  static protected
22
    $defaultCulture = 'en';
23
 
24
  /**
25
   * Initialize symfony propel
26
   *
27
   * @param sfEventDispatcher $dispatcher
28
   * @param string $culture
29
   *
30
   * @deprecated Moved to {@link sfPropelPluginConfiguration}
31
   */
32
  static public function initialize(sfEventDispatcher $dispatcher, $culture = null)
33
  {
34
    $dispatcher->notify(new sfEvent(__CLASS__, 'application.log', array(__METHOD__.'() has been deprecated. Please call sfPropel::setDefaultCulture() to set the culture.', 'priority' => sfLogger::NOTICE)));
35
 
36
    if (null !== $culture)
37
    {
38
      self::setDefaultCulture($culture);
39
    }
40
    else if (class_exists('sfContext', false) && sfContext::hasInstance() && $user = sfContext::getInstance()->getUser())
41
    {
42
      self::setDefaultCulture($user->getCulture());
43
    }
44
  }
45
 
46
  /**
47
   * Sets the default culture
48
   *
49
   * @param string $culture
50
   */
51
  static public function setDefaultCulture($culture)
52
  {
53
    self::$defaultCulture = $culture;
54
  }
55
 
56
  /**
57
   * Return the default culture
58
   *
59
   * @return string the default culture
60
   */
61
  static public function getDefaultCulture()
62
  {
63
    return self::$defaultCulture;
64
  }
65
 
66
  /**
67
   * Listens to the user.change_culture event.
68
   *
69
   * @param sfEvent An sfEvent instance
70
   *
71
   */
72
  static public function listenToChangeCultureEvent(sfEvent $event)
73
  {
74
    self::setDefaultCulture($event['culture']);
75
  }
76
 
77
  /**
78
   * @deprecated Use Propel::importClass() instead
79
   */
80
  static public function import($path)
81
  {
82
    return Propel::importClass($path);
83
  }
84
 
85
  /**
86
   * @deprecated Use Propel::importClass() instead
87
   */
88
  static public function importClass($path)
89
  {
90
    return Propel::importClass($path);
91
  }
92
 
93
  /**
94
   * Clears all instance pools.
95
   *
96
   * @deprecated Moved to {@link sfPropelPluginConfiguration}
97
   */
98
  static public function clearAllInstancePools()
99
  {
100
    sfProjectConfiguration::getActive()->getPluginConfiguration('sfPropelPlugin')->clearAllInstancePools();
101
  }
102
}