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


PHP SiteConfig::has_extension方法代码示例

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


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

示例1: updateEditForm

 function updateEditForm(&$form)
 {
     if ($form->getName() == 'RootForm' && SiteConfig::has_extension("Translatable")) {
         $siteConfig = SiteConfig::current_site_config();
         $form->Fields()->push(new HiddenField('Locale', '', $siteConfig->Locale));
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-translatable,代码行数:7,代码来源:TranslatableCMSMainExtension.php

示例2: get_google_config

 /**
  * Return various configuration values
  *
  * @param $key
  * @return bool
  */
 public static function get_google_config($key)
 {
     if (class_exists('SiteConfig') && SiteConfig::has_extension('GoogleAnalyticsLiteConfig')) {
         $config = SiteConfig::current_site_config();
         switch ($key) {
             case 'code':
                 return $config->GoogleAnalyticsLiteCode ? $config->GoogleAnalyticsLiteCode : false;
             case 'placement':
                 return $config->SnippetPlacement ? $config->SnippetPlacement : false;
         }
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:patjnr-googleanalytics-lite,代码行数:19,代码来源:GoogleAnalyticsLiteConfig.php

示例3: preRequest

 public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
 {
     // Skip if database isn't ready
     if (!DB::isActive() || !DB::getConn()->hasField('SiteConfig', 'AkismetKey')) {
         return;
     }
     // Skip if SiteConfig doesn't have this extension
     if (!SiteConfig::has_extension('AkismetConfig')) {
         return;
     }
     // Check if key exists
     $akismetKey = SiteConfig::current_site_config()->AkismetKey;
     if ($akismetKey) {
         AkismetSpamProtector::set_api_key($akismetKey);
     }
 }
开发者ID:helpfulrobot,项目名称:tractorcow-silverstripe-akismet,代码行数:16,代码来源:AkismetProcessor.php

示例4: get_google_config

 /**
  *	Return various configuration values
  *
  *	@param $key String:
  *		'profile' the Google Analytics profile id or
  *		'email' the Google Analytics account's email address or
  *		'password' the password for the above Google Analytics account
  *	@return String the config value
  **/
 public static function get_google_config($key)
 {
     if (class_exists('SiteConfig') && SiteConfig::has_extension('GoogleConfig')) {
         $config = SiteConfig::current_site_config();
     }
     switch ($key) {
         case 'code':
             return !empty($config) && $config->GoogleAnalyticsCode ? $config->GoogleAnalyticsCode : GoogleLogger::$google_analytics_code;
         case 'profile':
             return !empty($config) && $config->GoogleAnalyticsProfileId ? $config->GoogleAnalyticsProfileId : GoogleAnalyzer::$profile_id;
         case 'email':
             return !empty($config) && $config->GoogleAnalyticsEmail ? $config->GoogleAnalyticsEmail : GoogleAnalyzer::$email;
         case 'password':
             return !empty($config) && $config->GoogleAnalyticsPassword ? $config->GoogleAnalyticsPassword : GoogleAnalyzer::$password;
         case 'universal':
             return !empty($config) && $config->UseGoogleUniversalSnippet ? $config->UseGoogleUniversalSnippet : GoogleAnalyzer::$use_universal_snippet;
     }
 }
开发者ID:helpfulrobot,项目名称:jelicanin-silverstripe-googleanalytics,代码行数:27,代码来源:GoogleConfig.php

示例5: getPrices

 /**
  * Grabs all prices into one place.
  * @return ArrayList
  */
 public function getPrices()
 {
     if (!isset($this->_prices)) {
         $this->_prices = new ArrayList();
         // Create a base tier
         $base = new PriceTier();
         $base->Label = $this->owner->BasePriceLabel;
         $base->Price = $this->owner->sellingPrice();
         $base->Percentage = 1;
         $base->MinQty = 1;
         $this->_prices->push($base);
         // Integrate with promo pricing
         if ($this->owner->hasExtension('HasPromotionalPricing') && $base->Price != $this->owner->BasePrice) {
             $base->OriginalPrice = $this->owner->BasePrice;
         }
         // If this product has tiers, use those
         $tiers = $this->owner->PriceTiers();
         // If not, see if the parent has tiers
         if ((!$tiers || !$tiers->exists()) && $this->owner->hasMethod('Parent')) {
             $parent = $this->owner->Parent();
             if ($parent && $parent->exists() && $parent->hasExtension('HasPriceTiers')) {
                 $tiers = $parent->PriceTiers();
                 if ($tiers && empty($base->Label) && !empty($parent->BasePriceLabel)) {
                     $base->Label = $parent->BasePriceLabel;
                 }
             }
         }
         // If not, see if there are global tiers
         if ((!$tiers || !$tiers->exists()) && SiteConfig::has_extension('HasPriceTiers')) {
             $global = SiteConfig::current_site_config();
             $tiers = $global->PriceTiers();
             if ($tiers && empty($base->Label) && !empty($global->BasePriceLabel)) {
                 $base->Label = $global->BasePriceLabel;
             }
         }
         // Fill in the additional tiers
         foreach ($tiers as $tier) {
             /** @var PriceTier $tier */
             // calculate a price if needed
             if ($tier->Price == 0 && $tier->Percentage > 0) {
                 $tier->Price = $tier->calcPrice($base->Price);
             } elseif ($tier->Price > 0 && $tier->Percentage == 0 && $base->Price > 0) {
                 $price = $tier->Price;
                 $this->owner->extend('updateSellingPrice', $price);
                 // make sure discounts still apply
                 $price = $price < 0 ? 0 : $price;
                 $tier->Price = $price;
                 $tier->Percentage = $price / $base->Price;
             }
             // integrate with promo pricing
             if ($this->owner->hasExtension('HasPromotionalPricing') && !empty($base->OriginalPrice)) {
                 $tier->OriginalPrice = $tier->calcPrice($base->OriginalPrice);
             }
             // add it to the stack
             $this->_prices->push($tier);
         }
         // now make one more pass through and generate missing labels
         $num = $this->_prices->count();
         if ($num > 1) {
             for ($i = 0; $i < $num; $i++) {
                 if (empty($this->_prices[$i]->Label)) {
                     $this->_prices[$i]->Label = (string) $this->_prices[$i]->MinQty;
                     if ($i == $num - 1) {
                         $this->_prices[$i]->Label .= '+';
                     } else {
                         $this->_prices[$i]->Label .= '-' . ($this->_prices[$i + 1]->MinQty - 1);
                     }
                 }
             }
         }
     }
     return $this->_prices;
 }
开发者ID:markguinn,项目名称:silverstripe-shop-extendedpricing,代码行数:77,代码来源:HasPriceTiers.php

示例6: getUsersBlogs

 /**
  * Gets the site config or subsites for the current site
  * @return {array} Nested array of sites
  */
 protected function getUsersBlogs($app_id)
 {
     if (SiteConfig::has_extension('SiteConfigSubsites')) {
         $response = array();
         //Disable subsite filter
         Subsite::disable_subsite_filter();
         $subsites = Subsite::get();
         foreach ($subsites as $subsite) {
             $response[] = array('blogid' => $subsite->ID, 'blogname' => $subsite->Title);
         }
         //Re-enable subsite filter
         Subsite::disable_subsite_filter(false);
         return $response;
     }
     $siteConfig = SiteConfig::current_site_config();
     return array(array('blogid' => $siteConfig->ID, 'blogname' => $siteConfig->Title));
 }
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge,代码行数:21,代码来源:KapostService.php


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