Exemplo n.º 1
0
 protected function decorateDraft()
 {
     $draftPagePaths = $this->listDraftPagePaths();
     foreach ($draftPagePaths as $pagePath) {
         $page = new Page($this->fs->read($pagePath));
         $page->ensurePageId();
         $page->normalizeContainerNames();
         $page->prefixResourceUrls($this->draftBaseUrl());
         $this->fs->update($pagePath, (string) $page);
     }
 }
Exemplo n.º 2
0
 function test_normalizeContainerNames()
 {
     $html = '<html><head>' . '</head><body>' . '<div class="sc-content-cnt1"></div>' . '<div class="sc-content"></div>' . '<div class="sc-content-"></div>' . '</body></html>';
     $page = new Page($html);
     $page->normalizeContainerNames();
     $cnts = $page->containers();
     $this->assertTrue(is_array($cnts));
     $this->assertEquals(2, count($cnts));
     $this->assertTrue(in_array('cnt1', $cnts));
     $this->assertEquals(0, strpos($cnts[1], '_cnt_'));
 }