當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。