예제 #1
0
 public function __construct()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->import = Import::getInstance();
     $this->resolver = Resolver::getInstance();
     $dir = BASEPATH . '/bootstrap/sidebars';
     foreach ($this->bootstrap->getFiles($dir) as $sidebar) {
         $subdir = BASEPATH . "/bootstrap/sidebars/{$sidebar}";
         $newSidebar = new \stdClass();
         $newSidebar->slug = $sidebar;
         $newSidebar->items = array();
         $newSidebar->meta = unserialize(file_get_contents($subdir . '/meta'));
         foreach ($newSidebar->meta as $key => $widgetRef) {
             $widget = new \stdClass();
             $parts = explode('-', $widgetRef);
             $ord = end($parts);
             $type = substr($widgetRef, 0, -1 * strlen('-' . $ord));
             $widget->type = $type;
             $widget->ord = $ord;
             $widget->meta = unserialize(file_get_contents($subdir . '/' . $widgetRef));
             $newSidebar->items[] = $widget;
         }
         $this->sidebars[] = $newSidebar;
     }
     $baseUrl = get_option('siteurl');
     $neutralUrl = Bootstrap::NETURALURL;
     $this->resolver->fieldSearchReplace($this->sidebars, Bootstrap::NETURALURL, $this->import->baseUrl);
     $this->process();
 }
예제 #2
0
 public function __construct()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->import = Import::getInstance();
     $this->resolver = Resolver::getInstance();
     foreach ($this->bootstrap->appSettings->wpbootstrap->menus as $menu => $locations) {
         $dir = BASEPATH . "/bootstrap/menus/{$menu}";
         $newMenu = new \stdClass();
         $newMenu->slug = $menu;
         $newMenu->locations = $locations;
         $newMenu->items = array();
         foreach ($this->getFiles($dir) as $file) {
             $menuItem = new \stdClass();
             $menuItem->done = false;
             $menuItem->id = 0;
             $menuItem->parentId = 0;
             $menuItem->slug = $file;
             $menuItem->menu = unserialize(file_get_contents($dir . '/' . $file));
             $newMenu->items[] = $menuItem;
         }
         usort($newMenu->items, function ($a, $b) {
             return (int) $a->menu->menu_order - (int) $b->menu->menu_order;
         });
         $this->menus[] = $newMenu;
     }
     $baseUrl = get_option('siteurl');
     $neutralUrl = Bootstrap::NETURALURL;
     $this->resolver->fieldSearchReplace($this->menus, Bootstrap::NETURALURL, $this->import->baseUrl);
     $this->process();
 }
예제 #3
0
 public function export()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->resolver = Resolver::getInstance();
     $this->extractMedia = new Extractmedia();
     $this->bootstrap->init();
     $this->bootstrap->includeWordPress();
     $this->mediaIds = array();
     $this->baseUrl = get_option('siteurl');
     $this->exportSettings();
     $this->exportContent();
 }
예제 #4
0
 public function import()
 {
     error_reporting(-1);
     $this->bootstrap = Bootstrap::getInstance();
     $this->resolver = Resolver::getInstance();
     $this->bootstrap->init();
     $this->bootstrap->includeWordPress();
     require_once $this->bootstrap->localSettings->wppath . '/wp-admin/includes/image.php';
     $this->baseUrl = get_option('siteurl');
     $this->uploadDir = wp_upload_dir();
     $this->importSettings();
     $this->importContent();
     // references
     $this->resolveMetaReferences();
     $this->resolvePostReferences();
     $this->resolveOptionReferences();
 }
예제 #5
0
 public function __construct()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->import = Import::getInstance();
     $this->resolver = Resolver::getInstance();
     $dir = BASEPATH . '/bootstrap/posts';
     foreach ($this->bootstrap->getFiles($dir) as $postType) {
         foreach ($this->bootstrap->getFiles($dir . '/' . $postType) as $slug) {
             $newPost = new \stdClass();
             $newPost->done = false;
             $newPost->id = 0;
             $newPost->parentId = 0;
             $newPost->slug = $slug;
             $file = BASEPATH . "/bootstrap/posts/{$postType}/{$slug}";
             $newPost->post = unserialize(file_get_contents($file));
             $this->posts[] = $newPost;
         }
     }
     $this->resolver->fieldSearchReplace($this->posts, Bootstrap::NETURALURL, $this->import->baseUrl);
     $this->process();
 }