[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/locale/ -> pluginlocale.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/locale/locale.class.php" );
   4      
   5      /**
   6       * \ingroup Locale
   7       *
   8       * Allows plugins to provide their custom locale files, in addition to the blog-wide
   9       * ones located under the locale/ folder.
  10       * The only thing this class does is extend the _loadLocaleFile private method, so that
  11       * we can load the file from a different folder. The constructor also takes one additional
  12       * parameter that represents the plugin identifier, so that we know where the plugin files
  13       * are stored.
  14       *
  15       * @see Locales
  16       * @see Locale
  17       */
  18      class PluginLocale extends Locale
  19      {
  20      
  21          var $_pluginId;
  22      
  23          /**
  24           * New constructor. Works exactly as Locale::Locale() but takes an additional parameter
  25           * the plugin identifier
  26           *
  27           * @param pluginId The plugin identifier
  28           * @param code The locale code
  29           * @see Locale
  30           */
  31  		function PluginLocale( $pluginId, $code )
  32          {
  33              // save the plugin identifier
  34              $this->_pluginId = $pluginId;
  35              
  36              // and initialize the parent class
  37              $this->Locale( $code );
  38          }
  39      
  40          /**
  41           * Loads a plugin locale file from disk
  42           *
  43           * @private
  44           */
  45  		function _loadLocaleFile()
  46          {
  47              $fileName = PLOG_CLASS_PATH."plugins/".$this->_pluginId."/locale/locale_".$this->_code.".php";
  48  
  49              if( File::isReadable( $fileName ))
  50              {
  51                      // TODO: this function is only called once, right?
  52                  include( $fileName );
  53              }
  54      
  55              // The following is just to handle the case where a plugin doesn't
  56              // have a valid local file.
  57              if ( !isset($messages) || !is_array( $messages ) )
  58              {
  59                  $messages = array();
  60              }
  61              
  62              $this->_messages = $messages;
  63          }        
  64      }
  65  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics