Exemplo n.º 1
0
 protected function parsePage($node)
 {
     $sanitizer = new PagePathSanitizer();
     $originalPath = $sanitizer->sanitize((string) $node['path']);
     $page = new \PortlandLabs\Concrete5\MigrationTool\Entity\Import\Page();
     $page->setName((string) html_entity_decode($node['name']));
     $page->setPublicDate((string) $node['public-date']);
     $page->setOriginalPath($originalPath);
     if (isset($node['package'])) {
         $page->setPackage((string) $node['package']);
     }
     $page->setTemplate((string) $node['template']);
     $page->setType((string) $node['pagetype']);
     $page->setUser((string) $node['user']);
     $page->setDescription((string) html_entity_decode($node['description']));
     // Parse attributes
     if ($node->attributes->attributekey) {
         $i = 0;
         foreach ($node->attributes->attributekey as $keyNode) {
             $attribute = $this->parseAttribute($keyNode);
             $pageAttribute = new PageAttribute();
             $pageAttribute->setAttribute($attribute);
             $pageAttribute->setPage($page);
             $page->attributes->add($pageAttribute);
             ++$i;
         }
     }
     // Parse areas
     if ($node->area) {
         foreach ($node->area as $areaNode) {
             $area = $this->parseArea($areaNode);
             $area->setPage($page);
             $page->areas->add($area);
         }
     }
     return $page;
 }
Exemplo n.º 2
0
 private function createParentPages()
 {
     $pages = array();
     $parentPages = array('posts' => 'Posts', 'pages' => 'Pages');
     foreach ($parentPages as $parentPagePath => $parentPageName) {
         $page = new \PortlandLabs\Concrete5\MigrationTool\Entity\Import\Page();
         $page->setName('Wordpress ' . $parentPageName . ' (Auto-generated)');
         $page->setDescription('Auto-generated parent page to hold Wordpress ' . $parentPageName);
         $page->setPublicDate(date('Y-m-d H:i:s'));
         $page->setType('page');
         $page->setOriginalPath('/' . $parentPagePath);
         $page->setBatchPath('/' . $parentPagePath);
         $page->setTemplate('blank');
         $page->setUser('admin');
         $pages[] = $page;
     }
     return $pages;
 }