コード例 #1
0
 /**
  * Returns TRUE if a request to a certain page should be redirected to the site root (i.e. if the page acts as the
  * home page).
  *
  * @param SiteTree $page
  * @return bool
  */
 public static function should_be_on_root(SiteTree $page)
 {
     if (!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/')) {
         return !(class_exists('Translatable') && $page->hasExtension('Translatable') && $page->Locale && $page->Locale != Translatable::default_locale());
     }
     return false;
 }
コード例 #2
0
 public function testLinkShortcodes()
 {
     $linkedPage = new SiteTree();
     $linkedPage->URLSegment = 'linked-page';
     $linkedPage->write();
     $linkedPage->publish('Stage', 'Live');
     $page = new SiteTree();
     $page->URLSegment = 'linking-page';
     $page->Content = sprintf('<a href="[sitetree_link,id=%s]">Testlink</a>', $linkedPage->ID);
     $page->write();
     $page->publish('Stage', 'Live');
     $this->assertContains(sprintf('<a href="%s">Testlink</a>', $linkedPage->Link()), $this->get($page->RelativeLink())->getBody(), '"sitetree_link" shortcodes get parsed properly');
 }
 /**
  * Returns TRUE if a request to a certain page should be redirected to the site root (i.e. if the page acts as the home page).
  * @param {SiteTree} $page
  * @return {bool}
  */
 public static function should_be_on_root(SiteTree $page)
 {
     if (!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/')) {
         return true;
     }
     return false;
 }