Example #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;
 }
Example #2
0
 private function createBatchPath($originalPath, $pageType)
 {
     $sanitizer = new PagePathSanitizer();
     $originalPath = $sanitizer->sanitize($originalPath);
     $URIParts = explode('/', $originalPath);
     $URIParts = array_filter($URIParts);
     if ($pageType == 'blog_entry') {
         $batchPath = '/posts/' . end($URIParts);
     } elseif ($pageType == 'page') {
         // TODO construct the page path looking at the <wp:post_parent> link + the current item's name
         $batchPath = '/pages' . $originalPath;
     }
     return $batchPath;
 }