当前位置: 首页>>代码示例>>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;未经允许,请勿转载。