summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/includes
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/includes')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/admin.inc278
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/ajax.inc16
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/analyze.inc1
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/base.inc46
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/cache.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/form.inc7
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/handlers.inc74
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/plugins.inc23
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/includes/view.inc202
9 files changed, 514 insertions, 153 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/admin.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/admin.inc
index 80aa592..ff4a99f 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/admin.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/admin.inc
@@ -1,6 +1,7 @@
<?php
+
/**
- * @file admin.inc
+ * @file
* Provides the Views' administrative interface.
*/
@@ -399,11 +400,11 @@ function views_ui_add_form($form, &$form_state) {
/**
* Helper form element validator: integer.
*
- * @see _element_validate_integer_positive
- *
* The problem with this is that the function is private so it's not guaranteed
* that it might not be renamed/changed. In the future field.module or something else
* should provide a public validate function.
+ *
+ * @see _element_validate_integer_positive()
*/
function views_element_validate_integer($element, &$form_state) {
$value = $element['#value'];
@@ -713,9 +714,7 @@ function views_ui_add_form_save_submit($form, &$form_state) {
$form_state['redirect'] = 'admin/structure/views';
}
$view->save();
- menu_rebuild();
- cache_clear_all('*', 'cache_views', TRUE);
- cache_clear_all();
+
$form_state['redirect'] = 'admin/structure/views';
if (!empty($view->display['page'])) {
$display = $view->display['page'];
@@ -851,7 +850,7 @@ function views_ui_break_lock_confirm($form, &$form_state, $view) {
$form = array();
if (empty($view->locked)) {
- $form['#markup'] = t('There is no lock on view %view to break.', array('%name' => $view->name));
+ $form['message']['#markup'] = t('There is no lock on view %name to break.', array('%name' => $view->name));
return $form;
}
@@ -966,11 +965,13 @@ function views_ui_build_preview($view, $display_id, $render = TRUE) {
*
* @todo Rename to views_ui_edit_view_form(). See that function for the "old"
* version.
+ *
+ * @see views_ui_ajax_get_form()
*/
function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) {
// Do not allow the form to be cached, because $form_state['view'] can become
// stale between page requests.
- // @see views_ui_ajax_get_form() for how this affects #ajax.
+ // See views_ui_ajax_get_form() for how this affects #ajax.
// @todo To remove this and allow the form to be cacheable:
// - Change $form_state['view'] to $form_state['temporary']['view'].
// - Add a #process function to initialize $form_state['temporary']['view']
@@ -1459,7 +1460,7 @@ function views_ui_edit_form_submit_delay_destination($form, &$form_state) {
* having them as secondary local tasks isn't desired. The caller is responsible
* for setting the active tab's #active property to TRUE.
*
- * @param $view
+ * @param view $view
* The view which will be edited.
* @param $display_id
* The display_id which is edited on the current request.
@@ -1480,7 +1481,7 @@ function views_ui_edit_page_display_tabs($view, $display_id = NULL) {
if (!empty($display->deleted)) {
$tabs[$id]['#link']['localized_options']['attributes']['class'][] = 'views-display-deleted-link';
}
- if (empty($display->options['enabled'])) {
+ if (isset($display->display_options['enabled']) && !$display->display_options['enabled']) {
$tabs[$id]['#link']['localized_options']['attributes']['class'][] = 'views-display-disabled-link';
}
}
@@ -1490,6 +1491,18 @@ function views_ui_edit_page_display_tabs($view, $display_id = NULL) {
$tabs['default']['#access'] = FALSE;
}
+ // Mark the display tab as red to show validation errors.
+ $view->validate();
+ foreach ($view->display as $id => $display) {
+ if (!empty($view->display_errors[$id])) {
+ // Always show the tab.
+ $tabs[$id]['#access'] = TRUE;
+ // Add a class to mark the error and a title to make a hover tip.
+ $tabs[$id]['#link']['localized_options']['attributes']['class'][] = 'error';
+ $tabs[$id]['#link']['localized_options']['attributes']['title'] = t('This display has one or more validation errors; please review it.');
+ }
+ }
+
return $tabs;
}
@@ -1914,7 +1927,7 @@ function views_ui_pre_render_move_argument_options($form) {
* While doing that, create a container element underneath each option, which
* contains the settings related to that option.
*
- * @see form_process_radios
+ * @see form_process_radios()
*/
function views_ui_process_container_radios($element) {
if (count($element['#options']) > 0) {
@@ -1945,7 +1958,7 @@ function views_ui_process_container_radios($element) {
return $element;
}
-/*
+/**
* Import a view from cut & paste.
*/
function views_ui_import_page($form, &$form_state) {
@@ -1960,6 +1973,12 @@ function views_ui_import_page($form, &$form_state) {
'#title' => t('Replace an existing view if one exists with the same name'),
);
+ $form['bypass_validation'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Bypass view validation'),
+ '#description' => t('Bypass the validation of plugins and handlers when importing this view.'),
+ );
+
$form['view'] = array(
'#type' => 'textarea',
'#title' => t('Paste view code here'),
@@ -2030,38 +2049,42 @@ function views_ui_import_validate($form, &$form_state) {
$view->init_display();
$broken = FALSE;
- // Make sure that all plugins and handlers needed by this view actually exist.
- foreach ($view->display as $id => $display) {
- if (empty($display->handler) || !empty($display->handler->broken)) {
- drupal_set_message(t('Display plugin @plugin is not available.', array('@plugin' => $display->display_plugin)), 'error');
- $broken = TRUE;
- continue;
- }
- $plugin = views_get_plugin('style', $display->handler->get_option('style_plugin'));
- if (!$plugin) {
- drupal_set_message(t('Style plugin @plugin is not available.', array('@plugin' => $display->handler->get_option('style_plugin'))), 'error');
- $broken = TRUE;
- }
- elseif ($plugin->uses_row_plugin()) {
- $plugin = views_get_plugin('row', $display->handler->get_option('row_plugin'));
+ // Bypass the validation of view pluigns/handlers if option is checked.
+ if (!$form_state['values']['bypass_validation']) {
+ // Make sure that all plugins and handlers needed by this view actually exist.
+ foreach ($view->display as $id => $display) {
+ if (empty($display->handler) || !empty($display->handler->broken)) {
+ drupal_set_message(t('Display plugin @plugin is not available.', array('@plugin' => $display->display_plugin)), 'error');
+ $broken = TRUE;
+ continue;
+ }
+
+ $plugin = views_get_plugin('style', $display->handler->get_option('style_plugin'));
if (!$plugin) {
- drupal_set_message(t('Row plugin @plugin is not available.', array('@plugin' => $display->handler->get_option('row_plugin'))), 'error');
+ drupal_set_message(t('Style plugin @plugin is not available.', array('@plugin' => $display->handler->get_option('style_plugin'))), 'error');
$broken = TRUE;
}
- }
+ elseif ($plugin->uses_row_plugin()) {
+ $plugin = views_get_plugin('row', $display->handler->get_option('row_plugin'));
+ if (!$plugin) {
+ drupal_set_message(t('Row plugin @plugin is not available.', array('@plugin' => $display->handler->get_option('row_plugin'))), 'error');
+ $broken = TRUE;
+ }
+ }
- foreach (views_object_types() as $type => $info) {
- $handlers = $display->handler->get_handlers($type);
- if ($handlers) {
- foreach ($handlers as $id => $handler) {
- if ($handler->broken()) {
- drupal_set_message(t('@type handler @table.@field is not available.', array(
- '@type' => $info['stitle'],
- '@table' => $handler->table,
- '@field' => $handler->field,
- )), 'error');
- $broken = TRUE;
+ foreach (views_object_types() as $type => $info) {
+ $handlers = $display->handler->get_handlers($type);
+ if ($handlers) {
+ foreach ($handlers as $id => $handler) {
+ if ($handler->broken()) {
+ drupal_set_message(t('@type handler @table.@field is not available.', array(
+ '@type' => $info['stitle'],
+ '@table' => $handler->table,
+ '@field' => $handler->field,
+ )), 'error');
+ $broken = TRUE;
+ }
}
}
}
@@ -2142,15 +2165,6 @@ function views_ui_edit_view_form_submit($form, &$form_state) {
$form_state['view']->save();
drupal_set_message(t('The view %name has been saved.', array('%name' => $form_state['view']->get_human_name())));
- // Make sure menu items get rebuilt as neces
- menu_rebuild();
-
- // Clear the views cache.
- cache_clear_all('*', 'cache_views');
-
- // Clear the page cache.
- cache_clear_all();
-
// Remove this view from cache so we can edit it properly.
ctools_object_cache_clear('view', $form_state['view']->name);
}
@@ -2309,14 +2323,18 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
continue;
}
- $field_name = $handler->ui_name(TRUE);
+ $field_name = check_plain($handler->ui_name(TRUE));
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$field_name = '(' . $relationships[$field['relationship']] . ') ' . $field_name;
}
- $description = $handler->admin_summary();
+ $description = filter_xss_admin($handler->admin_summary());
$link_text = $field_name . (empty($description) ? '' : " ($description)");
- $build['fields'][$id]['#link'] = l($link_text, "admin/structure/views/nojs/config-item/$view->name/$display->id/$type/$id", array('attributes' => array('class' => array('views-ajax-link')), 'html' => TRUE));
+ $link_attributes = array('class' => array('views-ajax-link'));
+ if (!empty($field['exclude'])) {
+ $link_attributes['class'][] = 'views-field-excluded';
+ }
+ $build['fields'][$id]['#link'] = l($link_text, "admin/structure/views/nojs/config-item/$view->name/$display->id/$type/$id", array('attributes' => $link_attributes, 'html' => TRUE));
$build['fields'][$id]['#class'][] = drupal_clean_css_identifier($display->id . '-' . $type . '-' . $id);
if (!empty($view->changed_sections[$display->id . '-' . $type . '-' . $id])) {
// @TODO: #changed is no longer being used?
@@ -2830,7 +2848,7 @@ function views_ui_build_form_url($form_state) {
* Add another form to the stack; clicking 'apply' will go to this form
* rather than closing the ajax popup.
*/
-function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FALSE) {
+function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FALSE, $rebuild_keys = FALSE) {
if (empty($view->stack)) {
$view->stack = array();
}
@@ -2860,6 +2878,11 @@ function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FAL
// Now that the previously $first slot is free, move the new form into it.
$view->stack[$first] = $stack;
ksort($view->stack);
+
+ // Start the keys from 0 again, if requested.
+ if ($rebuild_keys) {
+ $view->stack = array_values($view->stack);
+ }
}
}
@@ -3165,11 +3188,13 @@ function theme_views_ui_reorder_displays_form($vars) {
drupal_add_tabledrag('reorder-displays', 'order', 'sibling', 'weight');
$output = drupal_render($form['override']);
+ $output .= '<div class="scroll">';
$output .= theme('table',
array('header' => $header,
'rows' => $rows,
'attributes' => array('id' => 'reorder-displays'),
));
+ $output .= '</div>';
$output .= drupal_render_children($form);
return $output;
@@ -3486,10 +3511,12 @@ function theme_views_ui_expose_filter_form($variables) {
$output = drupal_render($form['form_description']);
$output .= drupal_render($form['expose_button']);
+ $output .= drupal_render($form['group_button']);
if (isset($form['required'])) {
$output .= drupal_render($form['required']);
}
$output .= drupal_render($form['label']);
+ $output .= drupal_render($form['description']);
$output .= drupal_render($form['operator']);
$output .= drupal_render($form['value']);
@@ -3515,6 +3542,78 @@ function theme_views_ui_expose_filter_form($variables) {
return $output;
}
+ /**
+ * Theme the build group filter form.
+ */
+function theme_views_ui_build_group_filter_form($variables) {
+ $form = $variables['form'];
+ $more = drupal_render($form['more']);
+
+ $output = drupal_render($form['form_description']);
+ $output .= drupal_render($form['expose_button']);
+ $output .= drupal_render($form['group_button']);
+ if (isset($form['required'])) {
+ $output .= drupal_render($form['required']);
+ }
+
+ $output .= drupal_render($form['operator']);
+ $output .= drupal_render($form['value']);
+
+ $output .= '<div class="views-left-40">';
+ $output .= drupal_render($form['optional']);
+ $output .= drupal_render($form['remember']);
+ $output .= '</div>';
+
+ $output .= '<div class="views-right-60">';
+ $output .= drupal_render($form['widget']);
+ $output .= drupal_render($form['label']);
+ $output .= drupal_render($form['description']);
+ $output .= '</div>';
+
+
+ $header = array(
+ t('Default'),
+ t('Weight'),
+ t('Label'),
+ t('Operator'),
+ t('Value'),
+ t('Operations'),
+ );
+
+ $form['default_group'] = form_process_radios($form['default_group']);
+ $form['default_group_multiple'] = form_process_checkboxes($form['default_group_multiple']);
+ $form['default_group']['All']['#title'] = '';
+
+ drupal_render($form['default_group_multiple']['All']); // Don't render
+ $rows[] = array(
+ drupal_render($form['default_group']['All']),
+ '',
+ array(
+ 'data' => variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? t('&lt;Any&gt;') : t('- Any -'),
+ 'colspan' => 4,
+ 'class' => array('class' => 'any-default-radios-row'),
+ ),
+ );
+
+ foreach (element_children($form['group_items']) as $group_id) {
+ $form['group_items'][$group_id]['value']['#title'] = '';
+ $data = array(
+ 'default' => drupal_render($form['default_group'][$group_id]) . drupal_render($form['default_group_multiple'][$group_id]),
+ 'weight' => drupal_render($form['group_items'][$group_id]['weight']),
+ 'title' => drupal_render($form['group_items'][$group_id]['title']),
+ 'operator' => drupal_render($form['group_items'][$group_id]['operator']),
+ 'value' => drupal_render($form['group_items'][$group_id]['value']),
+ 'remove' => drupal_render($form['group_items'][$group_id]['remove']) . l('<span>' . t('Remove') . '</span>', 'javascript:void()', array('attributes' => array('id' => 'views-remove-link-' . $group_id, 'class' => array('views-hidden', 'views-button-remove', 'views-groups-remove-link', 'views-remove-link'), 'alt' => t('Remove this item'), 'title' => t('Remove this item')), 'html' => true)),
+ );
+ $rows[] = array('data' => $data, 'id' => 'views-row-' . $group_id, 'class' => array('draggable'));
+ }
+ $table = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('views-filter-groups'), 'id' => 'views-filter-groups'))) . drupal_render($form['add_group']);
+ drupal_add_tabledrag('views-filter-groups', 'order', 'sibling', 'weight');
+ $render_form = drupal_render_children($form);
+ return $output . $render_form . $table . $more;
+}
+
+
/**
* Submit handler for rearranging form
*/
@@ -4124,6 +4223,45 @@ function views_ui_add_item_form_submit($form, &$form_state) {
views_ui_cache_set($form_state['view']);
}
+/**
+ * Override handler for views_ui_edit_display_form
+ */
+function views_ui_config_item_form_build_group($form, &$form_state) {
+ $item = &$form_state['handler']->options;
+ // flip. If the filter was a group, set back to a standard filter.
+ $item['is_grouped'] = empty($item['is_grouped']);
+
+ // If necessary, set new defaults:
+ if ($item['is_grouped']) {
+ $form_state['handler']->build_group_options();
+ }
+
+ $form_state['view']->set_item($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
+
+ views_ui_add_form_to_stack($form_state['form_key'], $form_state['view'], $form_state['display_id'], array($form_state['type'], $form_state['id']), TRUE, TRUE);
+
+ views_ui_cache_set($form_state['view']);
+ $form_state['rerender'] = TRUE;
+ $form_state['rebuild'] = TRUE;
+ $form_state['force_build_group_options'] = TRUE;
+}
+
+/**
+ * Add a new group to the exposed filter groups.
+ */
+function views_ui_config_item_form_add_group($form, &$form_state) {
+ $item =& $form_state['handler']->options;
+
+ // Add a new row.
+ $item['group_info']['group_items'][] = array();
+
+ $form_state['view']->set_item($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
+
+ views_ui_cache_set($form_state['view']);
+ $form_state['rerender'] = TRUE;
+ $form_state['rebuild'] = TRUE;
+ $form_state['force_build_group_options'] = TRUE;
+}
/**
* Form to config_item items in the views UI.
@@ -4469,6 +4607,8 @@ function views_ui_config_item_form_expose($form, &$form_state) {
$form_state['view']->set_item($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
+ views_ui_add_form_to_stack($form_state['form_key'], $form_state['view'], $form_state['display_id'], array($form_state['type'], $form_state['id']), TRUE, TRUE);
+
views_ui_cache_set($form_state['view']);
$form_state['rerender'] = TRUE;
$form_state['rebuild'] = TRUE;
@@ -4978,7 +5118,14 @@ function _views_sort_types($a, $b) {
/**
* Fetch a list of all fields available for a given base type.
*
- * @return
+ * @param (array|string) $base
+ * A list or a single base_table, for example node.
+ * @param string $type
+ * The handler type, for example field or filter.
+ * @param bool $grouping
+ * Should the result grouping by its 'group' label.
+ *
+ * @return array
* A keyed array of in the form of 'base_table' => 'Description'.
*/
function views_fetch_fields($base, $type, $grouping = FALSE) {
@@ -5240,7 +5387,7 @@ function views_ui_default_button($element, &$form_state, $form) {
*
* Therefore it builds up a table of each field which is used in any view.
*
- * @see field_ui_fields_list
+ * @see field_ui_fields_list()
*/
function views_ui_field_list() {
$views = views_get_all_views();
@@ -5289,3 +5436,26 @@ function views_ui_field_list() {
return $output;
}
+
+/**
+ * Lists all plugins and what enabled Views use them.
+ */
+function views_ui_plugin_list() {
+ $rows = views_plugin_list();
+ foreach ($rows as &$row) {
+ // Link each view name to the view itself.
+ foreach ($row['views'] as $row_name => $view) {
+ $row['views'][$row_name] = l($view, "admin/structure/views/view/$view");
+ }
+ $row['views'] = implode(', ', $row['views']);
+ }
+
+ // Sort rows by field name.
+ ksort($rows);
+ return array(
+ '#theme' => 'table',
+ '#header' => array(t('Type'), t('Name'), t('Provided by'), t('Used in')),
+ '#rows' => $rows,
+ '#empty' => t('There are no enabled views.'),
+ );
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/ajax.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/ajax.inc
index 4e2ad38..39d8c6f 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/ajax.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/ajax.inc
@@ -1,12 +1,14 @@
<?php
/**
- * @file ajax.inc
- *
+ * @file
* Handles the server side AJAX interactions of Views.
- *
- * @defgroup ajax Views ajax library
+ */
+
+/**
+ * @defgroup ajax Views AJAX library
* @{
+ * Handles the server side AJAX interactions of Views.
*/
/**
@@ -17,14 +19,12 @@ function views_ajax() {
$name = $_REQUEST['view_name'];
$display_id = $_REQUEST['view_display_id'];
$args = isset($_REQUEST['view_args']) && $_REQUEST['view_args'] !== '' ? explode('/', $_REQUEST['view_args']) : array();
- $path = isset($_REQUEST['view_path']) ? $_REQUEST['view_path'] : NULL;
+ $path = isset($_REQUEST['view_path']) ? rawurldecode($_REQUEST['view_path']) : NULL;
$dom_id = isset($_REQUEST['view_dom_id']) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $_REQUEST['view_dom_id']) : NULL;
$pager_element = isset($_REQUEST['pager_element']) ? intval($_REQUEST['pager_element']) : NULL;
$commands = array();
- $arg = explode('/', $_REQUEST['view_path']);
-
// Remove all of this stuff from $_GET so it doesn't end up in pagers and tablesort URLs.
foreach (array('view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', 'ajax_html_ids', 'ajax_page_state') as $key) {
if (isset($_GET[$key])) {
@@ -48,7 +48,7 @@ function views_ajax() {
// Add all $_POST data, because AJAX is always a post and many things,
// such as tablesorts, exposed filters and paging assume $_GET.
- $_GET += $_POST;
+ $_GET = $_POST + $_GET;
// Overwrite the destination.
// @see drupal_get_destination()
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/analyze.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/analyze.inc
index df7b743..68ee334 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/analyze.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/analyze.inc
@@ -47,6 +47,7 @@ function views_analyze_format_result($view, $messages) {
$output = '';
foreach ($types as $type => $messages) {
+ $type .= ' messages';
$message = '';
if (count($messages) > 1) {
$message = theme('item_list', array('items' => $messages));
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/base.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/base.inc
index b5d09a4..0e2a407 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/base.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/base.inc
@@ -1,12 +1,12 @@
<?php
+
/**
* @file
- *
* Provides the basic object definitions used by plugins and handlers.
*/
/**
- * Basic definition for many views objects
+ * Basic definition for many views objects.
*/
class views_object {
/**
@@ -33,17 +33,24 @@ class views_object {
* @code
* 'option_name' => array(
* - 'default' => default value,
- * - 'translatable' => TRUE/FALSE (wrap in t() on export if true),
- * - 'contains' => array of items this contains, with its own defaults, etc.
- * If contains is set, the default will be ignored and assumed to
- * be array()
- *
+ * - 'translatable' => (optional) TRUE/FALSE (wrap in t() on export if true),
+ * - 'contains' => (optional) array of items this contains, with its own
+ * defaults, etc. If contains is set, the default will be ignored and
+ * assumed to be array().
+ * - 'bool' => (optional) TRUE/FALSE Is the value a boolean value. This will
+ * change the export format to TRUE/FALSE instead of 1/0.
+ * - 'export' => (optional) FALSE or a callback for special export handling
+ * if necessary.
+ * - 'unpack_translatable' => (optional) callback for special handling for
+ * translating data within the option, if necessary.
* ),
- * @endcode
- * Each option may have any of the following functions:
- * - export_option_OPTIONNAME -- Special export handling if necessary.
- * - translate_option_OPTIONNAME -- Special handling for translating data
- * within the option, if necessary.
+ *
+ * @return array
+ * Returns the options of this handler/plugin.
+ *
+ * @see views_object::export_option()
+ * @see views_object::export_option_always()
+ * @see views_object::unpack_translatable()
*/
function option_definition() { return array(); }
@@ -56,6 +63,8 @@ class views_object {
/**
* Set default options on this object. Called by the constructor in a
* complex chain to deal with backward compatibility.
+ *
+ * @deprecated since views2
*/
function options(&$options) { }
@@ -251,6 +260,17 @@ class views_object {
}
/**
+ * Always exports the option, regardless of the default value.
+ */
+ function export_option_always($indent, $prefix, $storage, $option, $definition, $parents) {
+ // If there is no default, the option will always be exported.
+ unset($definition['default']);
+ // Unset our export method to prevent recursion.
+ unset($definition['export']);
+ return $this->export_option($indent, $prefix, $storage, $option, $definition, $parents);
+ }
+
+ /**
* Unpacks each handler to store translatable texts.
*/
function unpack_translatables(&$translatable, $parents = array()) {
@@ -326,7 +346,7 @@ class views_object {
$value = $options;
// Build source data and add to the array
$format = NULL;
- if (isset($definition['format_key']) && isset($storage[$definition['format_key']])) {
+ if (isset($definition['format_key']) && isset($options[$definition['format_key']])) {
$format = $options[$definition['format_key']];
}
$translatable[] = array(
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/cache.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/cache.inc
index b2fe7d8..c655c21 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/cache.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/cache.inc
@@ -1,9 +1,8 @@
<?php
+
/**
- * @file cache.inc
- *
- * Functions to load Views' data so that it knows what is available to
- * build queries from.
+ * @file
+ * Load Views' data so that it knows what is available to build queries from.
*/
/**
@@ -14,8 +13,8 @@
* One example is views_get_handler.
*/
function _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) {
- static $cache = NULL;
- static $recursion_protection = array();
+ $cache = &drupal_static(__FUNCTION__ . '_cache');
+ $recursion_protection = &drupal_static(__FUNCTION__ . '_recursion_protected');
if (!isset($cache) || $reset) {
$start = microtime(TRUE);
// NOTE: This happens whether we retrieve them from cache or otherwise.
@@ -146,16 +145,19 @@ function views_cache_set($cid, $data, $use_language = FALSE) {
*
* This is just a convenience wrapper around cache_get().
*
- * @param $cid
+ * @param int $cid
* The cache ID of the data to retrieve.
- * @param $use_language
+ * @param bool $use_language
* If TRUE, the data will be requested specific to the currently active language.
+ *
+ * @return stdClass|bool
+ * The cache or FALSE on failure.
*/
function views_cache_get($cid, $use_language = FALSE) {
global $language;
if (variable_get('views_skip_cache', FALSE)) {
- return 0;
+ return FALSE;
}
if ($use_language) {
$cid .= ':' . $language->language;
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/form.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/form.inc
deleted file mode 100644
index 9152ae9..0000000
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/form.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-/**
- * @file form.inc
- * Views' replacements for Drupal's form functions.
- *
- */
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/handlers.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/handlers.inc
index 45a3a45..a79aa5c 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/handlers.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/handlers.inc
@@ -1,6 +1,7 @@
<?php
+
/**
- * @file handlers.inc
+ * @file
* Defines the various handler objects to help build and display views.
*/
@@ -57,6 +58,7 @@ function _views_create_handler($definition, $type = 'handler', $handler_type = N
else {
$handler->is_plugin = TRUE;
$handler->plugin_type = $type;
+ $handler->plugin_name = $definition['name'];
}
// let the handler have something like a constructor.
@@ -313,12 +315,18 @@ class views_handler extends views_object {
* The value being rendered.
* @param $type
* The type of sanitization needed. If not provided, check_plain() is used.
+ *
+ * @return string
+ * Returns the safe value.
*/
function sanitize_value($value, $type = NULL) {
switch ($type) {
case 'xss':
$value = filter_xss($value);
break;
+ case 'xss_admin':
+ $value = filter_xss_admin($value);
+ break;
case 'url':
$value = check_url($value);
break;
@@ -556,11 +564,11 @@ class views_handler extends views_object {
}
}
- /**
- * Check whether current user has access to this handler.
- *
- * @return boolean
- */
+ /**
+ * Check whether current user has access to this handler.
+ *
+ * @return boolean
+ */
function access() {
if (isset($this->definition['access callback']) && function_exists($this->definition['access callback'])) {
if (isset($this->definition['access arguments']) && is_array($this->definition['access arguments'])) {
@@ -664,6 +672,18 @@ class views_handler extends views_object {
}
/**
+ * Returns TRUE if the exposed filter works like a grouped filter.
+ */
+ function is_a_group() { return FALSE; }
+
+ /**
+ * Define if the exposed input has to be submitted multiple times.
+ * This is TRUE when exposed filters grouped are using checkboxes as
+ * widgets.
+ */
+ function multiple_exposed_input() { return FALSE; }
+
+ /**
* Take input from exposed handlers and assign to this handler, if necessary.
*/
function accept_exposed_input($input) { return TRUE; }
@@ -736,7 +756,7 @@ class views_many_to_one_helper {
}
static function option_definition(&$options) {
- $options['reduce_duplicates'] = array('default' => FALSE);
+ $options['reduce_duplicates'] = array('default' => FALSE, 'bool' => TRUE);
}
function options_form(&$form, &$form_state) {
@@ -1030,7 +1050,7 @@ class views_many_to_one_helper {
}
}
-/*
+/**
* Break x,y,z and x+y+z into an array. Works for strings.
*
* @param $str
@@ -1062,12 +1082,17 @@ function views_break_phrase_string($str, &$handler = NULL) {
return $handler;
}
- if (preg_match('/^(\w+[+ ])+\w+$/', $str)) {
- // The '+' character in a query string may be parsed as ' '.
+ // Determine if the string has 'or' operators (plus signs) or 'and' operators
+ // (commas) and split the string accordingly. If we have an 'and' operator,
+ // spaces are treated as part of the word being split, but otherwise they are
+ // treated the same as a plus sign.
+ $or_wildcard = '[^\s+,]';
+ $and_wildcard = '[^+,]';
+ if (preg_match("/^({$or_wildcard}+[+ ])+{$or_wildcard}+$/", $str)) {
$handler->operator = 'or';
$handler->value = preg_split('/[+ ]/', $str);
}
- else if (preg_match('/^((\w|\s)+,)*(\w|\s)+$/', $str)) {
+ elseif (preg_match("/^({$and_wildcard}+,)*{$and_wildcard}+$/", $str)) {
$handler->operator = 'and';
$handler->value = explode(',', $str);
}
@@ -1085,7 +1110,8 @@ function views_break_phrase_string($str, &$handler = NULL) {
return $handler;
}
-/*
+
+/**
* Break x,y,z and x+y+z into an array. Numeric only.
*
* @param $str
@@ -1386,10 +1412,10 @@ function views_date_sql_extract($extract_type, $field, $field_type = 'int', $set
*/
/**
- * @defgroup views_join_handlers Views' join handlers
+ * @defgroup views_join_handlers Views join handlers
* @{
* Handlers to tell Views how to join tables together.
-
+ *
* Here is how you do complex joins:
*
* @code
@@ -1408,6 +1434,7 @@ function views_date_sql_extract($extract_type, $field, $field_type = 'int', $set
* }
* @endcode
*/
+
/**
* A function class to represent a join and create the SQL necessary
* to implement the join.
@@ -1425,9 +1452,9 @@ function views_date_sql_extract($extract_type, $field, $field_type = 'int', $set
* - type: either LEFT (default) or INNER
* - extra: An array of extra conditions on the join. Each condition is
* either a string that's directly added, or an array of items:
- * - - table: if not set, current table; if NULL, no table. This field can't
- * be set in the cached definition because it can't know aliases; this field
- * can only be used by realtime joins.
+ * - - table: If not set, current table; if NULL, no table. If you specify a
+ * table in cached definition, Views will try to load from an existing
+ * alias. If you use realtime joins, it works better.
* - - field: Field or formula
* in formulas we can reference the right table by using %alias
* @see SelectQueryInterface::addJoin()
@@ -1479,14 +1506,14 @@ class views_join {
/**
* Build the SQL for the join this object represents.
*
+ * When possible, try to use table alias instead of table names.
+ *
* @param $select_query
* An implementation of SelectQueryInterface.
* @param $table
* The base table to join.
* @param $view_query
* The source query, implementation of views_plugin_query.
- * @return
- *
*/
function build_join($select_query, $table, $view_query) {
if (empty($this->definition['table formula'])) {
@@ -1521,7 +1548,14 @@ class views_join {
$join_table = $table['alias'] . '.';
}
elseif (isset($info['table'])) {
- $join_table = $info['table'] . '.';
+ // If we're aware of a table alias for this table, use the table
+ // alias instead of the table name.
+ if (isset($left) && $left['table'] == $info['table']) {
+ $join_table = $left['alias'] . '.';
+ }
+ else {
+ $join_table = $info['table'] . '.';
+ }
}
// Convert a single-valued array of values to the single-value case,
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/plugins.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/plugins.inc
index 51d0e93..bf09573 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/plugins.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/plugins.inc
@@ -1,15 +1,15 @@
<?php
+
/**
- * @file plugins.inc
+ * @file
* Built in plugins for Views output handling.
- *
*/
// @todo: Remove this once update.php can use the registry
views_include('base');
/**
- * Implements hook_views_plugins
+ * Implements hook_views_plugins().
*/
function views_views_plugins() {
$js_path = drupal_get_path('module', 'ctools') . '/js';
@@ -86,6 +86,7 @@ function views_views_plugins() {
'title' => t('Embed'),
'help' => t('Provide a display which can be embedded using the views api.'),
'handler' => 'views_plugin_display_embed',
+ 'theme' => 'views_view',
'uses hook menu' => FALSE,
'use ajax' => TRUE,
'use pager' => TRUE,
@@ -135,6 +136,7 @@ function views_views_plugins() {
'help' => t('Displays rows in a grid.'),
'handler' => 'views_plugin_style_grid',
'theme' => 'views_view_grid',
+ 'uses fields' => FALSE,
'uses row plugin' => TRUE,
'uses row class' => TRUE,
'uses options' => TRUE,
@@ -193,6 +195,16 @@ function views_views_plugins() {
'type' => 'normal',
'help topic' => 'style-row-fields',
),
+ 'rss_fields' => array(
+ 'title' => t('Fields'),
+ 'help' => t('Display fields as RSS items.'),
+ 'handler' => 'views_plugin_row_rss_fields',
+ 'theme' => 'views_view_row_rss',
+ 'uses fields' => TRUE,
+ 'uses options' => TRUE,
+ 'type' => 'feed',
+ 'help topic' => 'style-row-fields',
+ ),
),
'argument default' => array(
'parent' => array(
@@ -475,6 +487,11 @@ class views_plugin extends views_object {
var $plugin_type = NULL;
/**
+ * The plugin name of this plugin, for example table or full.
+ */
+ var $plugin_name = NULL;
+
+ /**
* Init will be called after construct, when the plugin is attached to a
* view and a display.
*/
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/view.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/view.inc
index 4848879..90dd3a2 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/view.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/includes/view.inc
@@ -1,11 +1,12 @@
<?php
+
/**
- * @file view.inc
+ * @file
* Provides the view object type and associated methods.
*/
/**
- * @defgroup views_objects Objects that represent a View or part of a view.
+ * @defgroup views_objects Objects that represent a View or part of a view
* @{
* These objects are the core of Views do the bulk of the direction and
* storing of data. All database activity is in these objects.
@@ -91,7 +92,13 @@ class view extends views_db_object {
var $use_ajax = FALSE;
- // Where the results of a query will go.
+ /**
+ * Where the results of a query will go.
+ *
+ * The array must use a numeric index starting at 0.
+ *
+ * @var array
+ */
var $result = array();
// May be used to override the current pager info.
@@ -122,7 +129,7 @@ class view extends views_db_object {
// Stores the next steps of form items to handle.
// It's an array of stack items, which contain the form id, the type of form,
// the view, the display and some additional arguments.
- // @see views_ui_add_form_to_stack().
+ // @see views_ui_add_form_to_stack()
// var $stack;
/**
@@ -300,24 +307,40 @@ class view extends views_db_object {
*/
function set_current_page($page) {
$this->current_page = $page;
+
+ // If the pager is already initialized, pass it through to the pager.
+ if (!empty($this->query->pager)) {
+ return $this->query->pager->set_current_page($page);
+ }
+
}
/**
* Get the current page from the pager.
*/
function get_current_page() {
+ // If the pager is already initialized, pass it through to the pager.
if (!empty($this->query->pager)) {
return $this->query->pager->get_current_page();
}
+
+ if (isset($this->current_page)) {
+ return $this->current_page;
+ }
}
/**
* Get the items per page from the pager.
*/
function get_items_per_page() {
+ // If the pager is already initialized, pass it through to the pager.
if (!empty($this->query->pager)) {
return $this->query->pager->get_items_per_page();
}
+
+ if (isset($this->items_per_page)) {
+ return $this->items_per_page;
+ }
}
/**
@@ -336,9 +359,14 @@ class view extends views_db_object {
* Get the pager offset from the pager.
*/
function get_offset() {
+ // If the pager is already initialized, pass it through to the pager.
if (!empty($this->query->pager)) {
return $this->query->pager->get_offset();
}
+
+ if (isset($this->offset)) {
+ return $this->offset;
+ }
}
/**
@@ -575,7 +603,7 @@ class view extends views_db_object {
foreach ($this->display_handler->get_option('relationships') as $id => $options) {
$options['table'] = views_move_table($options['table']);
$data = views_fetch_data($options['table'], FALSE);
- if (isset($data[$options['field']])) {
+ if (isset($data[$options['field']]['relationship']['base'])) {
$base_tables[$data[$options['field']]['relationship']['base']] = TRUE;
}
}
@@ -1035,27 +1063,53 @@ class view extends views_db_object {
/**
* Internal method to build an individual set of handlers.
+ *
+ * @param string $key
+ * The type of handlers (filter etc.) which should be iterated over to
+ * build the relationship and query information.
*/
function _build($key) {
$handlers = &$this->$key;
foreach ($handlers as $id => $data) {
+
if (!empty($handlers[$id]) && is_object($handlers[$id])) {
- // Give this handler access to the exposed filter input.
- if (!empty($this->exposed_data)) {
- $rc = $handlers[$id]->accept_exposed_input($this->exposed_data);
- $handlers[$id]->store_exposed_input($this->exposed_data, $rc);
- if (!$rc) {
- continue;
+ $multiple_exposed_input = array(0 => NULL);
+ if ($handlers[$id]->multiple_exposed_input()) {
+ $multiple_exposed_input = $handlers[$id]->group_multiple_exposed_input($this->exposed_data);
+ }
+ foreach ($multiple_exposed_input as $group_id) {
+ // Give this handler access to the exposed filter input.
+ if (!empty($this->exposed_data)) {
+ $converted = FALSE;
+ if ($handlers[$id]->is_a_group()) {
+ $converted = $handlers[$id]->convert_exposed_input($this->exposed_data, $group_id);
+ $handlers[$id]->store_group_input($this->exposed_data, $converted);
+ if (!$converted) {
+ continue;
+ }
+ }
+ $rc = $handlers[$id]->accept_exposed_input($this->exposed_data);
+ $handlers[$id]->store_exposed_input($this->exposed_data, $rc);
+ if (!$rc) {
+ continue;
+ }
}
+ $handlers[$id]->set_relationship();
+ $handlers[$id]->query($this->display_handler->use_group_by());
}
- $handlers[$id]->set_relationship();
- $handlers[$id]->query($this->display_handler->use_group_by());
}
}
}
/**
* Execute the view's query.
+ *
+ * @param string $display_id
+ * The machine name of the display, which should be executed.
+ *
+ * @return bool
+ * Return whether the executing was successful, for example an argument
+ * could stop the process.
*/
function execute($display_id = NULL) {
if (empty($this->built)) {
@@ -1096,6 +1150,9 @@ class view extends views_db_object {
}
else {
$this->query->execute($this);
+ // Enforce the array key rule as documented in
+ // views_plugin_query::execute().
+ $this->result = array_values($this->result);
$this->_post_execute();
if ($cache) {
$cache->cache_set('results');
@@ -1112,7 +1169,16 @@ class view extends views_db_object {
}
/**
- * Render this view for display.
+ * Render this view for a certain display.
+ *
+ * Note: You should better use just the preview function if you want to
+ * render a view.
+ *
+ * @param string $display_id
+ * The machine name of the display, which should be rendered.
+ *
+ * @return (string|NULL)
+ * Return the output of the rendered view or NULL if something failed in the process.
*/
function render($display_id = NULL) {
$this->execute($display_id);
@@ -1121,6 +1187,9 @@ class view extends views_db_object {
if (!empty($this->build_info['fail'])) {
return;
}
+ if (!empty($this->view->build_info['denied'])) {
+ return;
+ }
drupal_theme_initialize();
@@ -1172,7 +1241,13 @@ class view extends views_db_object {
$function($this);
}
- // Let the theme play too, because pre render is a very themey thing.
+ // Let the themes play too, because pre render is a very themey thing.
+ foreach ($GLOBALS['base_theme_info'] as $base) {
+ $function = $base->name . '_views_pre_render';
+ if (function_exists($function)) {
+ $function($this);
+ }
+ }
$function = $GLOBALS['theme'] . '_views_pre_render';
if (function_exists($function)) {
$function($this);
@@ -1196,7 +1271,13 @@ class view extends views_db_object {
$function($this, $this->display_handler->output, $cache);
}
- // Let the theme play too, because post render is a very themey thing.
+ // Let the themes play too, because post render is a very themey thing.
+ foreach ($GLOBALS['base_theme_info'] as $base) {
+ $function = $base->name . '_views_post_render';
+ if (function_exists($function)) {
+ $function($this);
+ }
+ }
$function = $GLOBALS['theme'] . '_views_post_render';
if (function_exists($function)) {
$function($this, $this->display_handler->output, $cache);
@@ -1211,7 +1292,19 @@ class view extends views_db_object {
}
/**
- * Render a specific field via the field ID and the row #.
+ * Render a specific field via the field ID and the row #
+ *
+ * Note: You might want to use views_plugin_style::render_fields as it
+ * caches the output for you.
+ *
+ * @param string $field
+ * The id of the field to be rendered.
+ *
+ * @param int $row
+ * The row number in the $view->result which is used for the rendering.
+ *
+ * @return string
+ * The rendered output of the field.
*/
function render_field($field, $row) {
if (isset($this->field[$field]) && isset($this->result[$row])) {
@@ -1291,6 +1384,9 @@ class view extends views_db_object {
$function($this, $display_id, $this->args);
}
+ // Allow hook_views_pre_view() to set the dom_id, then ensure it is set.
+ $this->dom_id = !empty($this->dom_id) ? $this->dom_id : md5($this->name . REQUEST_TIME . rand());
+
// Allow the display handler to set up for execution
$this->display_handler->pre_execute();
}
@@ -1571,7 +1667,7 @@ class view extends views_db_object {
$title = t('Home');
}
if ($title) {
- $breadcrumb[] = l($title, $path, array('html' => true));
+ $breadcrumb[] = l($title, $path, array('html' => TRUE));
}
}
@@ -1708,28 +1804,42 @@ class view extends views_db_object {
if ($this->vid == 'new') {
$this->vid = NULL;
}
+ // If there is no vid, check if a view with this machine name already exists.
+ elseif (empty($this->vid)) {
+ $vid = db_query("SELECT vid from {views_view} WHERE name = :name", array(':name' => $this->name))->fetchField();
+ $this->vid = $vid ? $vid : NULL;
+ }
- // If we have no vid or our vid is a string, this is a new view.
- if (!empty($this->vid)) {
- // remove existing table entries
- foreach ($this->db_objects() as $key) {
- db_delete('views_' . $key)
- ->condition('vid', $this->vid)
- ->execute();
+ $transaction = db_transaction();
+
+ try {
+ // If we have no vid or our vid is a string, this is a new view.
+ if (!empty($this->vid)) {
+ // remove existing table entries
+ foreach ($this->db_objects() as $key) {
+ db_delete('views_' . $key)
+ ->condition('vid', $this->vid)
+ ->execute();
+ }
}
- }
- $this->save_row(!empty($this->vid) ? 'vid' : FALSE);
+ $this->save_row(!empty($this->vid) ? 'vid' : FALSE);
- // Save all of our subtables.
- foreach ($this->db_objects() as $key) {
- $this->_save_rows($key);
+ // Save all of our subtables.
+ foreach ($this->db_objects() as $key) {
+ $this->_save_rows($key);
+ }
+ }
+ catch (Exception $e) {
+ $transaction->rollback();
+ watchdog_exception('views', $e);
+ throw $e;
}
$this->save_locale_strings();
- cache_clear_all('views_urls', 'cache_views');
- cache_clear_all(); // clear the page cache as well.
+ // Clear caches.
+ views_invalidate_cache();
}
/**
@@ -1766,8 +1876,8 @@ class view extends views_db_object {
cache_clear_all('views_query:' . $this->name, 'cache_views');
if ($clear) {
- cache_clear_all(); // this clears the block and page caches only.
- menu_rebuild(); // force a menu rebuild when a view is deleted.
+ // Clear caches.
+ views_invalidate_cache();
}
}
@@ -1909,6 +2019,16 @@ class view extends views_db_object {
unset($this->$key);
}
}
+
+ // These keys are checked by the next init, so instead of unsetting them,
+ // just set the default values.
+ $keys = array('items_per_page', 'offset', 'current_page');
+ foreach ($keys as $key) {
+ if (isset($this->$key)) {
+ $this->$key = NULL;
+ }
+ }
+
$this->built = $this->executed = FALSE;
$this->build_info = array();
$this->attachment_before = '';
@@ -1925,6 +2045,7 @@ class view extends views_db_object {
$this->init_display();
$errors = array();
+ $this->display_errors = NULL;
$current_display = $this->current_display;
foreach ($this->display as $id => $display) {
@@ -1936,6 +2057,8 @@ class view extends views_db_object {
$result = $this->display[$id]->handler->validate();
if (!empty($result) && is_array($result)) {
$errors = array_merge($errors, $result);
+ // Mark this display as having validation errors.
+ $this->display_errors[$id] = TRUE;
}
}
}
@@ -1955,6 +2078,7 @@ class view extends views_db_object {
$this->localization_plugin = views_get_plugin('localization', views_get_localization_plugin());
if (empty($this->localization_plugin)) {
+ $this->localization_plugin = views_get_plugin('localization', 'none');
return FALSE;
}
@@ -1989,9 +2113,9 @@ class view extends views_db_object {
$this->process_locale_strings('delete');
}
- /**
- * Export localized strings.
- */
+ /**
+ * Export localized strings.
+ */
function export_locale_strings() {
$this->process_locale_strings('export');
}
@@ -2136,7 +2260,7 @@ class views_db_object {
}
$schema = drupal_get_schema($this->db_table);
- $output = $indent . '$' . $identifier . ' = new ' . get_class($this) . ";\n";
+ $output = $indent . '$' . $identifier . ' = new ' . get_class($this) . "();\n";
// Go through our schema and build correlations.
foreach ($schema['fields'] as $field => $info) {
if (!empty($info['no export'])) {
@@ -2152,7 +2276,7 @@ class views_db_object {
// serialized defaults must be set as serialized.
if (isset($info['serialize'])) {
- $this->$field = unserialize(db_decode_blob($this->$field));
+ $this->$field = unserialize($this->$field);
}
}
$value = $this->$field;