本文整理汇总了PHP中SiteConfig::write方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteConfig::write方法的具体用法?PHP SiteConfig::write怎么用?PHP SiteConfig::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteConfig
的用法示例。
在下文中一共展示了SiteConfig::write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgradeConfig
protected function upgradeConfig(SiteConfig $config)
{
$this->log("Upgrading site config ID = " . $config->ID);
if ($config->GoogleAnalyticsUseUniversalAnalytics) {
$config->GoogleAnalyticsType = 'Universal Analytics';
} else {
$config->GoogleAnalyticsType = 'Old Asynchronous Analytics';
}
$config->GoogleAnalyticsUpgradedV2 = true;
$config->write();
}
示例2: alternateSiteConfig
public function alternateSiteConfig()
{
if (!$this->owner->SubsiteID) {
return false;
}
$sc = DataObject::get_one('SiteConfig', '"SubsiteID" = ' . $this->owner->SubsiteID);
if (!$sc) {
$sc = new SiteConfig();
$sc->SubsiteID = $this->owner->SubsiteID;
$sc->Title = _t('Subsite.SiteConfigTitle', 'Your Site Name');
$sc->Tagline = _t('Subsite.SiteConfigSubtitle', 'Your tagline here');
$sc->write();
}
return $sc;
}
示例3: array
<?php
if (isset($_POST["action"]) and $_POST["action"] == "save") {
$v = array();
$v["page"]["title"] = $_POST["page_title"];
$v["style"] = $_POST["style"];
$v["language"] = $_POST["language"];
$v["baseurl"] = $_POST["baseurl"];
$v["baseurlpath"] = $_POST["baseurlpath"];
$v["facebook"]["appid"] = trim($_POST["facebook_appid"]);
$v["facebook"]["secret"] = trim($_POST["facebook_secret"]);
$v["facebook"]["fanpage"]["url"] = trim($_POST["facebook_fanpage_url"]);
$v["google"]["analytics"]["account"] = $_POST["google_analytics_account"];
$v["google"]["adsense"]["clientid"] = trim($_POST["google_adsense_clientid"]);
$v["google"]["adsense"]["slot"]["widget"] = trim($_POST["google_adsense_slot_widget"]);
$v["google"]["cse"]["id"] = trim($_POST["google_cse_id"]);
$v["amazon"]["partnernet"]["id"] = $_POST["amazon_partnernet_id"];
$v["twitter"]["username"] = $_POST["twitter_username"];
$v["twitter"]["consumer"]["key"] = $_POST["twitter_consumer_key"];
$v["twitter"]["consumer"]["secret"] = $_POST["twitter_consumer_secret"];
$v["twitter"]["access"]["key"] = $_POST["twitter_access_key"];
$v["twitter"]["access"]["secret"] = $_POST["twitter_access_secret"];
$v["akismet"]["host"] = $_POST["akismet_host"];
$v["akismet"]["key"] = $_POST["akismet_key"];
$v["askbot"]["anonym"]["answers"] = isset($_POST["askbot_anonym_answers"]) && $_POST["askbot_anonym_answers"] == "1" ? 1 : 0;
SiteConfig::write(0, $v);
PageEngine::AddSuccessMessage("save", "Einstellungen gespeichert");
}
示例4: SiteConfig
/**
* Create SiteConfig with defaults from language file.
* if Translatable is enabled on SiteConfig, see if one already exist
* and use those values for the translated defaults.
*
* @param string $locale
* @return SiteConfig
*/
static function make_site_config($locale = null)
{
if (!$locale) {
$locale = Translatable::get_current_locale();
}
$siteConfig = new SiteConfig();
$siteConfig->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
$siteConfig->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here");
if ($siteConfig->hasExtension('Translatable')) {
$defaultConfig = DataObject::get_one('SiteConfig');
if ($defaultConfig) {
$siteConfig->Title = $defaultConfig->Title;
$siteConfig->Tagline = $defaultConfig->Tagline;
}
// TODO Copy view/edit group settings
// set the correct Locale
$siteConfig->Locale = $locale;
}
$siteConfig->write();
return $siteConfig;
}
示例5: getSiteConfig
/**
* Return a siteconfig for this subsite
*
* @return \SiteConfig
*/
public function getSiteConfig()
{
if (!$this->owner->ID) {
return;
}
if (isset(self::$_current_siteconfig_cache[$this->owner->ID])) {
return self::$_current_siteconfig_cache[$this->owner->ID];
}
Subsite::$disable_subsite_filter = true;
$sc = SiteConfig::get()->filter('SubsiteID', $this->owner->ID)->first();
Subsite::$disable_subsite_filter = false;
if (!$sc) {
$sc = new SiteConfig();
$sc->SubsiteID = $this->owner->ID;
$sc->Title = _t('Subsite.SiteConfigTitle', 'Your Site Name');
$sc->Tagline = _t('Subsite.SiteConfigSubtitle', 'Your tagline here');
$sc->write();
}
self::$_current_siteconfig_cache[$this->owner->ID] = $sc;
return $sc;
}
示例6: SiteConfig
/**
* Create SiteConfig with defaults from language file.
* if Translatable is enabled on SiteConfig, see if one already exist
* and use those values for the translated defaults.
*
* @param string $locale
* @return SiteConfig
*/
static function make_site_config($locale = null)
{
if (class_exists('Translatable') && !$locale) {
$locale = Translatable::get_current_locale();
}
$siteConfig = new SiteConfig();
$siteConfig->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
$siteConfig->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here");
if (class_exists('Translatable') && $siteConfig->hasExtension('Translatable')) {
Translatable::disable_locale_filter();
$defaultConfig = SiteConfig::get()->first();
Translatable::enable_locale_filter();
if ($defaultConfig) {
return $defaultConfig->createTranslation($locale);
}
// TODO Copy view/edit group settings
// set the correct Locale
$siteConfig->Locale = $locale;
}
$siteConfig->write();
return $siteConfig;
}