示例#1
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();
 }
 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();
 }
示例#3
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();
 }
示例#4
0
 public function __construct()
 {
     $this->import = Import::getInstance();
 }