[ 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/dao/ -> blogsettings.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/config/properties.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
   5      
   6      /**
   7       * default time offset that is applied to new blogs
   8       */
   9      define( "DEFAULT_TIME_OFFSET", 0 );
  10  
  11      /**
  12       * \ingroup DAO
  13       *
  14       * Encapsulation of the settings for each blog
  15       *
  16       */
  17      class BlogSettings extends Properties 
  18      {
  19  
  20  		function BlogSettings()
  21          {
  22              $this->Properties();
  23  
  24              $this->_setDefaults();
  25          }
  26  
  27          /**
  28           * Sets some reasonable defaults for all the parameters, based on
  29           * the system-wide settings from config/config.properties.php
  30           */
  31  		function _setDefaults()
  32          {
  33              $config =& Config::getConfig();
  34  
  35              $this->setValue( "locale", $config->getValue("default_locale"));
  36              $this->setValue( "show_posts_max", $config->getValue( "show_posts_max" ));
  37              $this->setValue( "template", $config->getValue("default_template"));
  38              $this->setValue( "show_more_enabled", $config->getValue( "show_more_enabled"));
  39              $this->setValue( "recent_posts_max", $config->getValue( "recent_posts_max" ));
  40              $this->setValue( "show_comments_max", $config->getValue( "show_comments_max" ));
  41              $this->setValue( "xmlrpc_ping_hosts", $config->getValue( "xmlrpc_ping_hosts" ));
  42              $this->setValue( "htmlarea_enabled", $config->getValue( "htmlarea_enabled" ));
  43              $this->setValue( "pull_down_menu_enabled", $config->getValue("pull_down_menu_enabled"));
  44              $this->setValue( "comments_enabled", $config->getValue( "comments_enabled" ));
  45              $this->setValue( "categories_order", 0 );
  46              $this->setValue( "comments_order", $config->getValue( "comments_order" ));
  47              $this->setValue( "time_offset", $config->getValue( "default_time_offset", DEFAULT_TIME_OFFSET ));
  48              $this->setValue( "articles_order", 2 );  // :TODO: we should be using a constant here
  49          }
  50          
  51  		function getValue( $key, $defaultValue = null, $filterClass = null )
  52          {
  53              // is it a plugin key?
  54              if( substr( $key, 0, strlen( "plugin_" )) == "plugin_" ) {
  55                  lt_include( PLOG_CLASS_PATH."class/plugin/globalpluginconfig.class.php" );
  56                  // check if users can override the plugin setting. If so, return the blog plugin settings
  57                  // and if not return the global setting
  58                  if( GlobalPluginConfig::canOverride( $key ) == PLUGIN_SETTINGS_USER_CAN_OVERRIDE ) {
  59                      // load the value from our settings, but if it isn't available, then return whatever the global
  60                      // plugin settings say                    
  61                      $value = parent::getValue( $key, GlobalPluginConfig::getValue( $key ), $filterClass );
  62                  }
  63                  else {
  64                      $value = GlobalPluginConfig::getValue( $key );
  65                  }
  66                  // If there no values from user or site plugin config, then we get it from $defaultValue
  67                  if( empty( $value ) )
  68                      $value = $defaultValue;
  69              }
  70              else {
  71                  $value = parent::getValue( $key, $defaultValue );
  72              }
  73              
  74              return( $value );
  75          }
  76      }
  77  ?>


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