当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::find方法代码示例

本文整理汇总了PHP中humhub\models\Setting::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::find方法的具体用法?PHP Setting::find怎么用?PHP Setting::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在humhub\models\Setting的用法示例。


在下文中一共展示了Setting::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rewrite

 /**
  * Rewrites DynamicConfiguration based on Database Stored Settings
  */
 public static function rewrite()
 {
     // Get Current Configuration
     $config = self::load();
     // Add Application Name to Configuration
     $config['name'] = Setting::Get('name');
     // Add Default language
     $defaultLanguage = Setting::Get('defaultLanguage');
     if ($defaultLanguage !== null && $defaultLanguage != "") {
         $config['language'] = Setting::Get('defaultLanguage');
     } else {
         $config['language'] = Yii::$app->language;
     }
     $timeZone = Setting::Get('timeZone');
     if ($timeZone != "") {
         $config['timeZone'] = $timeZone;
         $config['components']['formatter']['defaultTimeZone'] = $timeZone;
         $config['components']['formatterApp']['defaultTimeZone'] = $timeZone;
         $config['components']['formatterApp']['timeZone'] = $timeZone;
     }
     // Add Caching
     $cacheClass = Setting::Get('type', 'cache');
     if (in_array($cacheClass, ['yii\\caching\\DummyCache', 'yii\\caching\\ApcCache', 'yii\\caching\\FileCache'])) {
         $config['components']['cache'] = ['class' => $cacheClass, 'keyPrefix' => Yii::$app->id];
         // Prefix APC Cache Keys
         //if ($cacheClass == 'yii\caching\ApcCache') {
         //    $config['components']['cache'] = [
         //        'keyPrefix' => Yii::$app->id
         //    ];
         //}
     }
     // Add User settings
     $config['components']['user'] = array();
     if (Setting::Get('defaultUserIdleTimeoutSec', 'authentication_internal')) {
         $config['components']['user']['authTimeout'] = Setting::Get('defaultUserIdleTimeoutSec', 'authentication_internal');
     }
     // Install Mail Component
     $mail = [];
     $mail['transport'] = array();
     if (Setting::Get('transportType', 'mailing') == 'smtp') {
         $mail['transport']['class'] = 'Swift_SmtpTransport';
         if (Setting::Get('hostname', 'mailing')) {
             $mail['transport']['host'] = Setting::Get('hostname', 'mailing');
         }
         if (Setting::Get('username', 'mailing')) {
             $mail['transport']['username'] = Setting::Get('username', 'mailing');
         }
         if (Setting::Get('password', 'mailing')) {
             $mail['transport']['password'] = Setting::Get('password', 'mailing');
         }
         if (Setting::Get('encryption', 'mailing')) {
             $mail['transport']['encryption'] = Setting::Get('encryption', 'mailing');
         }
         if (Setting::Get('port', 'mailing')) {
             $mail['transport']['port'] = Setting::Get('port', 'mailing');
         }
         /*
          if (Setting::Get('allowSelfSignedCerts', 'mailing')) {
          $mail['transport']['ssl']['allow_self_signed'] = true;
          $mail['transport']['ssl']['verify_peer'] = false;
          }
         */
     } elseif (Setting::Get('transportType', 'mailing') == 'php') {
         $mail['transport']['class'] = 'Swift_MailTransport';
     } else {
         $mail['useFileTransport'] = true;
     }
     $config['components']['mailer'] = $mail;
     $config = ArrayHelper::merge($config, Theme::getThemeConfig(Setting::Get('theme')));
     $config['params']['config_created_at'] = time();
     foreach (Setting::find()->all() as $setting) {
         self::setSettingValue($config['params'], $setting);
     }
     self::save($config);
 }
开发者ID:SimonBaeumer,项目名称:humhub,代码行数:78,代码来源:DynamicConfig.php


注:本文中的humhub\models\Setting::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。