當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SiteConfig::config方法代碼示例

本文整理匯總了PHP中SiteConfig::config方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteConfig::config方法的具體用法?PHP SiteConfig::config怎麽用?PHP SiteConfig::config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SiteConfig的用法示例。


在下文中一共展示了SiteConfig::config方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCanEditPages

 public function testCanEditPages()
 {
     $config = $this->objFromFixture('SiteConfig', 'default');
     // Log in without pages admin access
     $this->logInWithPermission('CMS_ACCESS_AssetAdmin');
     $this->assertFalse($config->canEditPages());
     // Login with necessary edit permission
     $perms = SiteConfig::config()->required_permission;
     $this->logInWithPermission(reset($perms));
     $this->assertTrue($config->canEditPages());
 }
開發者ID:miamollie,項目名稱:echoAerial,代碼行數:11,代碼來源:SiteConfigTest.php

示例2: testAvailableThemes

 public function testAvailableThemes()
 {
     $config = SiteConfig::current_site_config();
     $ds = DIRECTORY_SEPARATOR;
     $testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes';
     if (file_exists($testThemeBaseDir)) {
         Filesystem::removeFolder($testThemeBaseDir);
     }
     mkdir($testThemeBaseDir);
     mkdir($testThemeBaseDir . $ds . 'blackcandy');
     mkdir($testThemeBaseDir . $ds . 'blackcandy_blog');
     mkdir($testThemeBaseDir . $ds . 'darkshades');
     mkdir($testThemeBaseDir . $ds . 'darkshades_blog');
     $themes = $config->getAvailableThemes($testThemeBaseDir);
     $this->assertContains('blackcandy', $themes, 'Test themes contain blackcandy theme');
     $this->assertContains('darkshades', $themes, 'Test themes contain darkshades theme');
     SiteConfig::config()->disabled_themes = array('darkshades');
     $themes = $config->getAvailableThemes($testThemeBaseDir);
     $this->assertFalse(in_array('darkshades', $themes), 'Darkshades was disabled - it is no longer available');
     Filesystem::removeFolder($testThemeBaseDir);
 }
開發者ID:fanggu,項目名稱:loveyourwater_ss_v3.1.6,代碼行數:21,代碼來源:SiteConfigTest.php

示例3: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $services = SiteConfig::config()->available_services;
     if (!$services) {
         $services = array_keys(self::listAvailableMediaServices());
     }
     if (in_array('twitter', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('TwitterUsername', _t('Socialstream.TwitterUsername', 'Twitter Username')));
     }
     if (in_array('twitter_hashtag', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('TwitterHashtag', _t('Socialstream.TwitterHashtag', 'Twitter Hashtag')));
     }
     if (in_array('facebook_page', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('Socialstream.FacebookPage', 'Facebook Page')));
     }
     if (in_array('vimeo', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('VimeoUsername', _t('Socialstream.VimeoUsername', 'Vimeo Username')));
     }
     if (in_array('youtube', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('YoutubeUsername', _t('Socialstream.YoutubeUsername', 'Youtube Username')));
     }
     if (in_array('dailymotion', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('DailymotionUsername', _t('Socialstream.DailymotionUsername', 'Dailymotion Username')));
     }
     if (in_array('rss', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('RssFeed', _t('Socialstream.RssFeed', 'Rss Feed')));
     }
     if (in_array('flickr', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('FlickrUsername', _t('Socialstream.FlickrUsername', 'Flickr Username')));
     }
     if (in_array('github', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('GithubUsername', _t('Socialstream.GithubUsername', 'Github Username')));
     }
     $fields->addFieldToTab('Root.Social', $wl = new ListboxField('LifestreamWhitelist', _t('Socialstream.LifestreamWhitelist', 'Lifestream Whitelist'), array_combine($services, $services)));
     $wl->setMultiple(true);
     $wl->setDescription('A list of services to display on the Lifestream. If left blank, all configured streams will be used.');
     $fields->addFieldToTab('Root.Social', new NumericField('LifestreamItems', _t('Socialstream.LifestreamItems', 'Lifestream Items')));
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:lekoala-silverstripe-socialstream,代碼行數:39,代碼來源:SocialstreamSiteConfig.php

示例4: testCreatePermissions

 public function testCreatePermissions()
 {
     // Test logged out users cannot create
     $this->logOut();
     $this->assertFalse(singleton('SiteTree')->canCreate());
     // Login with another permission
     $this->logInWithPermission('DUMMY');
     $this->assertFalse(singleton('SiteTree')->canCreate());
     // Login with basic CMS permission
     $perms = SiteConfig::config()->required_permission;
     $this->logInWithPermission(reset($perms));
     $this->assertTrue(singleton('SiteTree')->canCreate());
     // Test creation underneath a parent which this user doesn't have access to
     $parent = $this->objFromFixture('Page', 'about');
     $this->assertFalse(singleton('SiteTree')->canCreate(null, array('Parent' => $parent)));
     // Test creation underneath a parent which doesn't allow a certain child
     $parentB = new SiteTreeTest_ClassB();
     $parentB->Title = 'Only Allows SiteTreeTest_ClassC';
     $parentB->write();
     $this->assertTrue(singleton('SiteTreeTest_ClassA')->canCreate(null));
     $this->assertFalse(singleton('SiteTreeTest_ClassA')->canCreate(null, array('Parent' => $parentB)));
     $this->assertTrue(singleton('SiteTreeTest_ClassC')->canCreate(null, array('Parent' => $parentB)));
 }
開發者ID:Neumes,項目名稱:silverstripe-cms,代碼行數:23,代碼來源:SiteTreeTest.php


注:本文中的SiteConfig::config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。