本文整理汇总了PHP中Import::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Import::getInstance方法的具体用法?PHP Import::getInstance怎么用?PHP Import::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Import
的用法示例。
在下文中一共展示了Import::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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();
}
示例2: __construct
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: __construct
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: __construct
public function __construct()
{
$this->import = Import::getInstance();
}