コード例 #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
ファイル: style-generator.php プロジェクト: jimrucinski/Vine
 function update_layout_storage()
 {
     if (empty($this->layout_settings)) {
         return;
     }
     $storage = new ITStorage('layout_settings');
     $storage->save($this->layout_settings);
 }
コード例 #3
0
ファイル: it-error.php プロジェクト: jimrucinski/Vine
 public static function _upgrade_storage_1_0_0($data)
 {
     $store = new ITStorage('ITError', true);
     $data = $store->load(false);
     $store->remove();
     $data['storage_version'] = '1.0.0';
     return $data;
 }
コード例 #4
0
 function run_import($info, $data, $post_data, $attachments, $return_data, $layout_settings)
 {
     $meta = $data['meta'];
     $data = $data['data'];
     if (!is_array($layout_settings)) {
         $layout_settings = $this->get_layout_settings();
     } else {
         if (!is_array($layout_settings)) {
             $layout_settings = array();
         }
         if (!isset($layout_settings['layouts'])) {
             $layout_settings['layouts'] = array();
         }
         if (!isset($layout_settings['views'])) {
             $layout_settings['views'] = array();
         }
     }
     $updated_layout_settings = $this->_get_updated_layout_settings($layout_settings, $data, $post_data, $meta, $attachments);
     $storage = new ITStorage('layout_settings');
     $storage->save($updated_layout_settings['data']);
     if ($return_data) {
         return $updated_layout_settings['data'];
     }
     return true;
 }
コード例 #5
0
ファイル: sidebars.php プロジェクト: jimrucinski/Vine
 function filter_widgets_editor_title($translated, $text, $domain)
 {
     if ('Widgets' != $text || 'default' != $domain) {
         return $translated;
     }
     remove_filter('gettext', array($this, 'filter_widgets_editor_title'), 100);
     $storage = new ITStorage('layout_settings');
     $layout_settings = $storage->load();
     if (!isset($layout_settings['layouts'][$_REQUEST['builder_layout_id']])) {
         return $translated;
     }
     return "{$translated} - {$layout_settings['layouts'][$_REQUEST['builder_layout_id']]['description']}";
 }