示例#1
0
文件: Page.php 项目: anpone/sitecake
 protected function adjustNavLinks()
 {
     foreach (phpQuery::pq('a', $this->doc) as $node) {
         $href = $node->getAttribute('href');
         if (!Utils::isExternalNavLink($href)) {
             $node->setAttribute('href', 'sitecake.php?page=' . $href);
         }
     }
 }
示例#2
0
 function test_isExternalNavLink()
 {
     $this->assertTrue(Utils::isExternalNavLink('/'));
     $this->assertTrue(Utils::isExternalNavLink('http://google.com'));
     $this->assertTrue(Utils::isExternalNavLink('/about.html'));
     $this->assertTrue(Utils::isExternalNavLink('/dir/about.html'));
     $this->assertTrue(Utils::isExternalNavLink('dir/about.html'));
     $this->assertFalse(Utils::isExternalNavLink('about.html'));
 }