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


PHP WT_Site::setting方法代码示例

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


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

示例1: getPreference

 /**
  * Get the site’s configuration settings
  *
  * @param string $setting_name
  *
  * @return string
  */
 public static function getPreference($setting_name)
 {
     // There are lots of settings, and we need to fetch lots of them on every page
     // so it is quicker to fetch them all in one go.
     if (self::$setting === null) {
         self::$setting = WT_DB::prepare("SELECT SQL_CACHE setting_name, setting_value FROM `##site_setting`")->fetchAssoc();
     }
     // A setting that hasn't yet been set?
     if (!array_key_exists($setting_name, self::$setting)) {
         self::$setting[$setting_name] = null;
     }
     return self::$setting[$setting_name];
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:20,代码来源:Site.php

示例2: preference

 public static function preference($setting_name, $setting_value = null)
 {
     // There are lots of settings, and we need to fetch lots of them on every page
     // so it is quicker to fetch them all in one go.
     if (self::$setting === null) {
         self::$setting = WT_DB::prepare("SELECT SQL_CACHE setting_name, setting_value FROM `##site_setting`")->fetchAssoc();
     }
     // If $setting_value is null, then GET the setting
     if ($setting_value === null) {
         // If parameter two is not specified, GET the setting
         if (!array_key_exists($setting_name, self::$setting)) {
             self::$setting[$setting_name] = null;
         }
         return self::$setting[$setting_name];
     } else {
         // If parameter two is specified, then SET the setting
         if (self::preference($setting_name) != $setting_value) {
             // Audit log of changes
             Log::addConfigurationLog('Site setting "' . $setting_name . '" set to "' . $setting_value . '"');
         }
         WT_DB::prepare("REPLACE INTO `##site_setting` (setting_name, setting_value) VALUES (?, LEFT(?, 255))")->execute(array($setting_name, $setting_value));
         self::$setting[$setting_name] = $setting_value;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:24,代码来源:Site.php


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