コード例 #1
0
ファイル: functions.php プロジェクト: jimrucinski/Vine
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'];
}
コード例 #2
0
ファイル: settings-tab.php プロジェクト: jimrucinski/Vine
        function _editor_main()
        {
            require_once dirname(__FILE__) . '/class.builder-import-export.php';
            $exporter = new BuilderImportExport();
            $this->_data_sources = $exporter->get_data_sources();
            if (!empty($_REQUEST['imported']) && isset($this->_exports['exports'][$_REQUEST['imported']])) {
                ITUtility::show_status_message(sprintf(__('Successfully imported "%s"', 'it-l10n-Builder-Cohen'), $this->_exports['exports'][$_REQUEST['imported']]['name']));
                if (!empty($_REQUEST['errors'])) {
                    foreach ((array) explode(',', $_REQUEST['errors']) as $error) {
                        list($var, $error) = explode(':', $error);
                        ITUtility::show_error_message(sprintf(__('Problem occurred when importing %1$s. Error code: %2$s', 'it-l10n-Builder-Cohen'), $this->_data_sources[$var], $error));
                    }
                }
            } else {
                if (!empty($this->_errors)) {
                    foreach ((array) $this->_errors as $error) {
                        ITUtility::show_error_message($error);
                    }
                }
            }
            ?>
	<div class="wrap">
		<?php 
            ITUtility::screen_icon();
            ?>
		<?php 
            $this->_print_editor_tabs();
            ?>
		
		<p><?php 
            _e('For information about this page, please click the "Help" button at the top right.', 'it-l10n-Builder-Cohen');
            ?>
</p>
		
		<?php 
            $this->_print_meta_boxes(null);
            ?>
		
		<form style="display:none" method="get" action="">
			<p>
				<?php 
            wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
            ?>
				<?php 
            wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
            ?>
			</p>
		</form>
	</div>
	
	<?php 
            $this->_init_meta_boxes();
        }