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


PHP SiteTree::enable_nested_urls方法代码示例

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


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

示例1: testGetHomepageLink

	public function testGetHomepageLink() {
		$default = $this->objFromFixture('Page', 'home');
		
		SiteTree::disable_nested_urls();
		$this->assertEquals('home', RootURLController::get_homepage_link());
		SiteTree::enable_nested_urls();
		$this->assertEquals('home', RootURLController::get_homepage_link());
	}
开发者ID:redema,项目名称:silverstripe-cms,代码行数:8,代码来源:RootURLControllerTest.php

示例2: testDeepNestedURLs

 public function testDeepNestedURLs()
 {
     SiteTree::enable_nested_urls();
     $page = new Page();
     $page->URLSegment = 'base-page';
     $page->write();
     for ($i = 0; $i < 10; $i++) {
         $parentID = $page->ID;
         $page = new ContentControllerTest_Page();
         $page->ParentID = $parentID;
         $page->Title = "Page Level {$i}";
         $page->URLSegment = "level-{$i}";
         $page->write();
         $relativeLink = Director::makeRelative($page->Link());
         $this->assertEquals($page->Title, $this->get($relativeLink)->getBody());
     }
     SiteTree::disable_nested_urls();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:18,代码来源:ContentControllerTest.php

示例3: testGetHomepageLink

 public function testGetHomepageLink()
 {
     $default = $this->objFromFixture('Page', 'home');
     $nested = $this->objFromFixture('Page', 'nested');
     SiteTree::disable_nested_urls();
     $this->assertEquals('home', RootURLController::get_homepage_link());
     SiteTree::enable_nested_urls();
     $this->assertEquals('home', RootURLController::get_homepage_link());
     $nested->HomepageForDomain = str_replace('www.', null, $_SERVER['HTTP_HOST']);
     $nested->write();
     RootURLController::reset();
     SiteTree::disable_nested_urls();
     $this->assertEquals('nested-home', RootURLController::get_homepage_link());
     RootURLController::reset();
     SiteTree::enable_nested_urls();
     $this->assertEquals('home/nested-home', RootURLController::get_homepage_link());
     $nested->HomepageForDomain = null;
     $nested->write();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:19,代码来源:RootURLControllerTest.php

示例4: tearDown

 function tearDown()
 {
     // Preserve memory settings
     ini_set('memory_limit', $this->originalMemoryLimit ? $this->originalMemoryLimit : -1);
     // Restore email configuration
     Email::set_mailer($this->originalMailer);
     $this->originalMailer = null;
     $this->mailer = null;
     // Restore password validation
     Member::set_password_validator($this->originalMemberPasswordValidator);
     // Restore requirements
     Requirements::set_backend($this->originalRequirements);
     // Mark test as no longer being run - we use originalIsRunningTest to allow for nested SapphireTest calls
     self::$is_running_test = $this->originalIsRunningTest;
     $this->originalIsRunningTest = null;
     // Reset theme setting
     SSViewer::set_theme($this->originalTheme);
     // Reset mocked datetime
     SS_Datetime::clear_mock_now();
     // Restore nested_urls state
     if ($this->originalNestedURLsState) {
         SiteTree::enable_nested_urls();
     } else {
         SiteTree::disable_nested_urls();
     }
     // Stop the redirection that might have been requested in the test.
     // Note: Ideally a clean Controller should be created for each test.
     // Now all tests executed in a batch share the same controller.
     $controller = Controller::has_curr() ? Controller::curr() : null;
     if ($controller && $controller->response && $controller->response->getHeader('Location')) {
         $controller->response->setStatusCode(200);
         $controller->response->removeHeader('Location');
     }
 }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:34,代码来源:SapphireTest.php

示例5: array

<?php

global $project;
$project = 'mysite';
global $databaseConfig;
$databaseConfig = array("type" => 'MySQLDatabase', "server" => 'localhost', "username" => 'root', "password" => 'omega', "database" => 'vp', "path" => '');
MySQLDatabase::set_connection_charset('utf8');
// Set the current theme. More themes can be downloaded from
// http://www.silverstripe.org/themes/
SSViewer::set_theme('simple');
// Set the site locale
i18n::set_locale('en_US');
FulltextSearchable::enable();
// Enable nested URLs for this site (e.g. page/sub-page/)
if (class_exists('SiteTree')) {
    SiteTree::enable_nested_urls();
}
Director::set_environment_type("dev");
// add a button to remove formatting
HtmlEditorConfig::get('cms')->insertButtonsBefore('styleselect', 'removeformat');
// tell the button which tags it may remove
HtmlEditorConfig::get('cms')->setOption('removeformat_selector', 'b,strong,em,i,span,ins');
//remove font->span conversion
HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', 'false,');
HtmlEditorConfig::get('cms')->setOptions(array('valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class],small", 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],#iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]"));
// TinyMCE cleanup on paste
HtmlEditorConfig::get('cms')->setOption('paste_auto_cleanup_on_paste', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles_if_webkit', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_strip_class_attributes', 'true');
GD::set_default_quality(80);
开发者ID:javeriaaali,项目名称:student-org-kit,代码行数:31,代码来源:_config.php

示例6: testValidURLSegmentControllerConflicts

 /**
  * @covers SiteTree::validURLSegment
  */
 public function testValidURLSegmentControllerConflicts()
 {
     SiteTree::enable_nested_urls();
     $sitetree = new SiteTree();
     $sitetree->ParentID = $this->idFromFixture('SiteTreeTest_Conflicted', 'parent');
     $sitetree->URLSegment = 'index';
     $this->assertFalse($sitetree->validURLSegment(), 'index is not a valid URLSegment');
     $sitetree->URLSegment = 'conflicted-action';
     $this->assertFalse($sitetree->validURLSegment(), 'allowed_actions conflicts are recognised');
     $sitetree->URLSegment = 'conflicted-template';
     $this->assertFalse($sitetree->validURLSegment(), 'Action-specific template conflicts are recognised');
     $sitetree->URLSegment = 'valid';
     $this->assertTrue($sitetree->validURLSegment(), 'Valid URLSegment values are allowed');
 }
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:17,代码来源:SiteTreeTest.php

示例7: setUp

 /**
  * New tests require nested urls to be enabled, but the site might not 
  * support nested URLs. 
  * This setup will enable nested-urls for this test and resets the state
  * after the tests have been performed.
  */
 function setUp()
 {
     parent::setUp();
     $this->orig['nested_urls'] = SiteTree::nested_urls();
     SiteTree::enable_nested_urls();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:12,代码来源:ModelAsControllerTest.php

示例8: testChildOfDraft

 /**
  * go to a page that's been published but is child of an unpublished page
  *
  * NOTE: This test requires nested_urls
  */
 function testChildOfDraft()
 {
     RootURLController::reset();
     SiteTree::enable_nested_urls();
     $draft = new Page();
     $draft->Title = 'Root Leve Draft Page';
     $draft->URLSegment = 'root';
     $draft->write();
     $published = new Page();
     $published->Title = 'Published Page Under Draft Page';
     $published->URLSegment = 'sub-root';
     $published->write();
     $published->publish('Stage', 'Live');
     $response = $this->get('root/sub-root');
     $this->assertEquals($response->getStatusCode(), 404, 'The page should not be found since its parent has not been published, in this case http://<yousitename>/root/sub-root or http://<yousitename>/sub-root');
 }
开发者ID:roed,项目名称:silverstripe-cms,代码行数:21,代码来源:ModelAsControllerTest.php

示例9: testAlternateGetByLink

 public function testAlternateGetByLink()
 {
     $parent = $this->objFromFixture('Page', 'parent');
     $child = $this->objFromFixture('Page', 'child1');
     $grandchild = $this->objFromFixture('Page', 'grandchild1');
     $parentTranslation = $parent->createTranslation('en_AU');
     $parentTranslation->write();
     $childTranslation = $child->createTranslation('en_AU');
     $childTranslation->write();
     $grandchildTranslation = $grandchild->createTranslation('en_AU');
     $grandchildTranslation->write();
     SiteTree::enable_nested_urls();
     Translatable::set_current_locale('en_AU');
     $this->assertEquals($parentTranslation->ID, Sitetree::get_by_link($parentTranslation->Link())->ID, 'Top level pages can be found.');
     $this->assertEquals($childTranslation->ID, SiteTree::get_by_link($childTranslation->Link())->ID, 'Child pages can be found.');
     $this->assertEquals($grandchildTranslation->ID, SiteTree::get_by_link($grandchildTranslation->Link())->ID, 'Grandchild pages can be found.');
     // TODO Re-enable test after clarifying with ajshort (see r88503).
     // Its unclear if this is valid behaviour, and/or necessary for translated nested URLs
     // to work properly
     //
     // $this->assertEquals (
     // 	$child->ID,
     // 	SiteTree::get_by_link($parentTranslation->Link($child->URLSegment))->ID,
     // 	'Links can be made up of multiple languages'
     // );
 }
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:26,代码来源:TranslatableTest.php

示例10: testAlternateGetByLink

 public function testAlternateGetByLink()
 {
     $parent = $this->objFromFixture('Page', 'parent');
     $child = $this->objFromFixture('Page', 'child1');
     $grandchild = $this->objFromFixture('Page', 'grandchild1');
     $parentTranslation = $parent->createTranslation('en_AU');
     $parentTranslation->write();
     $childTranslation = $child->createTranslation('en_AU');
     $childTranslation->write();
     $grandchildTranslation = $grandchild->createTranslation('en_AU');
     $grandchildTranslation->write();
     SiteTree::enable_nested_urls();
     Translatable::set_current_locale('en_AU');
     $this->assertEquals($parentTranslation->ID, Sitetree::get_by_link($parentTranslation->Link(true))->ID, 'Top level pages can be found.');
     $this->assertEquals($childTranslation->ID, SiteTree::get_by_link($childTranslation->Link())->ID, 'Child pages can be found.');
     $this->assertEquals($grandchildTranslation->ID, SiteTree::get_by_link($grandchildTranslation->Link())->ID, 'Grandchild pages can be found.');
 }
开发者ID:helpfulrobot,项目名称:martimiz-silverstripe-languageprefix,代码行数:17,代码来源:LanguagePrefixTest.php


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