Ejemplo n.º 1
0
function builder_import_theme_default_layouts_and_views($method = 'add', $layouts_method = 'add', $views_method = 'skip')
{
    if (!in_array($method, array('add', 'replace'))) {
        $method = 'add';
    }
    $theme_defaults_file = locate_template('defaults/layouts-and-views.zip');
    if (!file_exists($theme_defaults_file)) {
        $layouts = builder_get_builder_core_default_layouts();
        $storage = new ITStorage('layout_settings');
        $storage->save($layouts);
        return $layouts;
    }
    require_once dirname(dirname(__FILE__)) . '/import-export/class.builder-import-export.php';
    $import = new BuilderImportExport($theme_defaults_file);
    $data_sources = $import->get_data_sources();
    if (!isset($data_sources['layouts-views'])) {
        $import->cleanup();
        return false;
    }
    $settings = array('data_sources' => array('layouts-views' => array('method' => $method, 'layouts_method' => $layouts_method, 'views_method' => $views_method)));
    $db_data = array('layouts-views' => array());
    $results = $import->run_import($settings, false, true, $db_data);
    $import->cleanup();
    if (!isset($results['layouts-views']) || empty($results['layouts-views'])) {
        return false;
    }
    return $results['layouts-views'];
}
Ejemplo n.º 2
0
function builder_import_export_cleanup($guid, $path)
{
    require_once dirname(__FILE__) . '/class.builder-import-export.php';
    BuilderImportExport::cleanup($guid, $path);
}