Issue #1719188 by aspilicious: Coder cleanup.

8.0.x
aspilicious 2012-08-12 13:37:59 +02:00 committed by Tim Plunkett
parent 18bb81596d
commit e42f0d8c93
30 changed files with 176 additions and 173 deletions

View File

@ -146,7 +146,7 @@ function views_revert_views() {
drush_set_error(dt("The view specified '@viewname' is not overridden.", array('@viewname' => $viewname)));
}
// If the view is overriden, revert it.
elseif ($is_overridden){
elseif ($is_overridden) {
views_revert_view($views[$viewname]);
$i++;
}
@ -317,7 +317,7 @@ function drush_views_list() {
);
// setup a row for each view
foreach($views as $id => $view){
foreach ($views as $id => $view) {
// if options were specified, check that first
// mismatch push the loop to the next view
if ($with_tags && !in_array($view->tag, $tags)) {
@ -343,7 +343,7 @@ function drush_views_list() {
// place the row in the appropiate array,
// so we can have disabled views at the bottom
if($view->disabled) {
if ($view->disabled) {
$disabled_views[] = $row;
}
else{
@ -352,7 +352,7 @@ function drush_views_list() {
unset($row);
// gather some statistics
switch($view->type) {
switch ($view->type) {
case dt('Normal'):
$indb++;
break;

View File

@ -909,8 +909,7 @@ class views_handler_argument extends views_handler {
// Add the number of nodes counter
$distinct = ($this->view->display_handler->get_option('distinct') && empty($this->query->no_distinct));
$count_alias = $this->query->add_field($this->query->base_table, $this->query->base_field, 'num_records',
array('count' => TRUE, 'distinct' => $distinct));
$count_alias = $this->query->add_field($this->query->base_table, $this->query->base_field, 'num_records', array('count' => TRUE, 'distinct' => $distinct));
$this->query->add_groupby($this->name_alias);
if ($count_field) {

View File

@ -44,7 +44,7 @@ class views_handler_argument_date extends views_handler_argument_formula {
if (!$raw && $this->options['default_argument_type'] == 'date') {
return date($this->arg_format, REQUEST_TIME);
}
else if (!$raw && in_array($this->options['default_argument_type'], array('node_created', 'node_changed'))) {
elseif (!$raw && in_array($this->options['default_argument_type'], array('node_created', 'node_changed'))) {
foreach (range(1, 3) as $i) {
$node = menu_get_object('node', $i);
if (!empty($node)) {

View File

@ -1255,7 +1255,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
if (!empty($alter['make_link']) && !empty($alter['path'])) {
if (!isset($tokens)) {
$tokens = $this->get_render_tokens($alter);
$tokens = $this->get_render_tokens($alter);
}
$value = $this->render_as_link($alter, $value, $tokens);
}
@ -1341,7 +1341,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
// If no scheme is provided in the $path, assign the default 'http://'.
// This allows a url of 'www.example.com' to be converted to 'http://www.example.com'.
// Only do this on for external URLs.
if ($alter['external']){
if ($alter['external']) {
if (!isset($url['scheme'])) {
// There is no scheme, add the default 'http://' to the $path.
$path = "http://$path";
@ -1386,7 +1386,7 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
$options['attributes']['rel'] = $rel;
}
$target = check_plain(trim(strtr($alter['target'],$tokens)));
$target = check_plain(trim(strtr($alter['target'], $tokens)));
if (!empty($target)) {
$options['attributes']['target'] = $target;
}
@ -1530,13 +1530,14 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
foreach ($array as $param => $val) {
if (is_array($val)) {
// Copy parent_keys array, so we don't afect other elements of this iteration.
$child_parent_keys = $parent_keys;
$child_parent_keys[] = $param;
// Get the child tokens.
$child_tokens = $this->get_token_values_recursive($val, $child_parent_keys);
// Add them to the current tokens array.
$tokens += $child_tokens;
// Copy parent_keys array, so we don't affect other elements of this
// iteration.
$child_parent_keys = $parent_keys;
$child_parent_keys[] = $param;
// Get the child tokens.
$child_tokens = $this->get_token_values_recursive($val, $child_parent_keys);
// Add them to the current tokens array.
$tokens += $child_tokens;
}
else {
// Create a token key based on array element structure.

View File

@ -37,7 +37,7 @@ class views_handler_filter_boolean_operator extends views_handler_filter {
if (isset($this->definition['accept null'])) {
$this->accept_null = (bool) $this->definition['accept null'];
}
else if (isset($this->definition['accept_null'])) {
elseif (isset($this->definition['accept_null'])) {
$this->accept_null = (bool) $this->definition['accept_null'];
}
$this->value_options = NULL;

View File

@ -156,7 +156,7 @@ class views_handler_filter_string extends views_handler_filter {
$options = $this->operator_options('short');
$output = '';
if(!empty($options[$this->operator])) {
if (!empty($options[$this->operator])) {
$output = check_plain($options[$this->operator]);
}
if (in_array($this->operator, $this->operator_values(1))) {
@ -269,11 +269,11 @@ class views_handler_filter_string extends views_handler_filter {
preg_match_all('/ (-?)("[^"]+"|[^" ]+)/i', ' ' . $this->value, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$phrase = false;
$phrase = FALSE;
// Strip off phrase quotes
if ($match[2]{0} == '"') {
$match[2] = substr($match[2], 1, -1);
$phrase = true;
$phrase = TRUE;
}
$words = trim($match[2], ',?!();:-');
$words = $phrase ? array($words) : preg_split('/ /', $words, -1, PREG_SPLIT_NO_EMPTY);

View File

@ -45,7 +45,7 @@ function views_ui_get_admin_css() {
'group' => CSS_THEME,
);
}
else if (file_exists($theme_path . "/views-admin.$theme_key.css")) {
elseif (file_exists($theme_path . "/views-admin.$theme_key.css")) {
$list[$theme_path . "/views-admin.$theme_key.css"] = array(
'group' => CSS_THEME,
);
@ -95,7 +95,7 @@ function views_ui_check_advanced_help() {
$filename = db_query_range("SELECT filename FROM {system} WHERE type = 'module' AND name = 'advanced_help'", 0, 1)
->fetchField();
if ($filename && file_exists($filename)) {
drupal_set_message(t('If you <a href="@modules">enable the advanced help module</a>, Views will provide more and better help. <a href="@hide">Hide this message.</a>', array('@modules' => url('admin/modules'),'@hide' => url('admin/structure/views/settings'))));
drupal_set_message(t('If you <a href="@modules">enable the advanced help module</a>, Views will provide more and better help. <a href="@hide">Hide this message.</a>', array('@modules' => url('admin/modules'), '@hide' => url('admin/structure/views/settings'))));
}
else {
drupal_set_message(t('If you install the advanced help module from !href, Views will provide more and better help. <a href="@hide">Hide this message.</a>', array('!href' => l('http://drupal.org/project/advanced_help', 'http://drupal.org/project/advanced_help'), '@hide' => url('admin/structure/views/settings'))));
@ -589,7 +589,7 @@ function views_ui_add_ajax_trigger(&$wrapping_element, $trigger_key, $refresh_pa
$wrapping_element[$button_key]['#value'] = t('Update "@title" choice (@number)', array(
'@title' => $button_title,
'@number' => ++$seen_buttons[$button_title],
));
));
}
// Attach custom data to the triggering element and submit button, so we can
@ -848,7 +848,7 @@ function theme_views_ui_view_info($variables) {
$output .= '<div class="views-ui-view-title">' . $title . "</div>\n";
$output .= '<div class="views-ui-view-displays">' . $displays . "</div>\n";
$output .= '<div class="views-ui-view-storage">' . $type . "</div>\n";
$output .= '<div class="views-ui-view-base">' . t('Type') . ': ' . $variables['base']. "</div>\n";
$output .= '<div class="views-ui-view-base">' . t('Type') . ': ' . $variables['base'] . "</div>\n";
return $output;
}
@ -1187,7 +1187,7 @@ function views_ui_preview_form($form, &$form_state, $view, $display_id = 'defaul
$form_state['no_cache'] = TRUE;
$form_state['view'] = $view;
$form['#attributes'] = array('class' => array('clearfix',));
$form['#attributes'] = array('class' => array('clearfix'));
// Add a checkbox controlling whether or not this display auto-previews.
$form['live_preview'] = array(
@ -1555,29 +1555,29 @@ function views_ui_get_display_tab_details($view, $display) {
$display_title = views_ui_get_display_label($view, $display->id, FALSE);
$build = array(
'#theme_wrappers' => array('container'),
'#attributes' => array('id' => 'edit-display-settings-details',),
'#attributes' => array('id' => 'edit-display-settings-details'),
);
$plugin = views_fetch_plugin_data('display', $view->display[$display->id]->display_plugin);
// The following is for display purposes only. We need to determine if there is more than one button and wrap
// the buttons in a .ctools-dropbutton class if more than one is present. Otherwise, we'll just wrap the
// actions in the .ctools-button class.
$isDisplayDeleted = !empty($display->deleted);
$isDeletable = empty($plugin['no remove']);
$is_display_deleted = !empty($display->deleted);
$is_deletable = empty($plugin['no remove']);
// The master display cannot be cloned.
$isDefault = $display->id == 'default';
$is_default = $display->id == 'default';
// @todo: Figure out why get_option doesn't work here.
$isEnabled = $display->handler->get_option('enabled');
$is_enabled = $display->handler->get_option('enabled');
if (!$isDisplayDeleted && $isDeletable && !$isDefault) {
if (!$is_display_deleted && $is_deletable && !$is_default) {
$prefix = '<div class="ctools-no-js ctools-button ctools-dropbutton"><div class="ctools-link"><a href="#" class="ctools-twisty ctools-text">open</a></div><div class="ctools-content"><ul class="horizontal right actions">';
$suffix = '</ul></div></div>';
$itemElement = 'li';
$item_element = 'li';
}
else {
$prefix = '<div class="ctools-button"><div class="ctools-content"><ul class="horizontal right actions">';
$suffix = '</ul></div></div>';
$itemElement = 'li';
$item_element = 'li';
}
if ($display->id != 'default') {
@ -1591,15 +1591,15 @@ function views_ui_get_display_tab_details($view, $display) {
'#suffix' => $suffix,
);
if (!$isDisplayDeleted) {
if (!$isEnabled) {
if (!$is_display_deleted) {
if (!$is_enabled) {
$build['top']['actions']['enable'] = array(
'#type' => 'submit',
'#value' => t('enable @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array('views_ui_edit_form_submit_enable_display', 'views_ui_edit_form_submit_delay_destination'),
'#prefix' => '<' . $itemElement . ' class="enable">',
"#suffix" => '</' . $itemElement . '>',
'#prefix' => '<' . $item_element . ' class="enable">',
"#suffix" => '</' . $item_element . '>',
);
}
// Add a link to view the page.
@ -1611,39 +1611,39 @@ function views_ui_get_display_tab_details($view, $display) {
'#title' => t('view @display', array('@display' => $display->display_title)),
'#options' => array('alt' => array(t("Go to the real page for this display"))),
'#href' => $path,
'#prefix' => '<' . $itemElement . ' class="view">',
"#suffix" => '</' . $itemElement . '>',
'#prefix' => '<' . $item_element . ' class="view">',
"#suffix" => '</' . $item_element . '>',
);
}
}
if (!$isDefault) {
if (!$is_default) {
$build['top']['actions']['duplicate'] = array(
'#type' => 'submit',
'#value' => t('clone @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array('views_ui_edit_form_submit_duplicate_display', 'views_ui_edit_form_submit_delay_destination'),
'#prefix' => '<' . $itemElement . ' class="duplicate">',
"#suffix" => '</' . $itemElement . '>',
'#prefix' => '<' . $item_element . ' class="duplicate">',
"#suffix" => '</' . $item_element . '>',
);
}
if ($isDeletable) {
if ($is_deletable) {
$build['top']['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('delete @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array('views_ui_edit_form_submit_delete_display', 'views_ui_edit_form_submit_delay_destination'),
'#prefix' => '<' . $itemElement . ' class="delete">',
"#suffix" => '</' . $itemElement . '>',
'#prefix' => '<' . $item_element . ' class="delete">',
"#suffix" => '</' . $item_element . '>',
);
}
if ($isEnabled) {
if ($is_enabled) {
$build['top']['actions']['disable'] = array(
'#type' => 'submit',
'#value' => t('disable @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array('views_ui_edit_form_submit_disable_display', 'views_ui_edit_form_submit_delay_destination'),
'#prefix' => '<' . $itemElement . ' class="disable">',
"#suffix" => '</' . $itemElement . '>',
'#prefix' => '<' . $item_element . ' class="disable">',
"#suffix" => '</' . $item_element . '>',
);
}
}
@ -1653,8 +1653,8 @@ function views_ui_get_display_tab_details($view, $display) {
'#value' => t('undo delete of @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array('views_ui_edit_form_submit_undo_delete_display', 'views_ui_edit_form_submit_delay_destination'),
'#prefix' => '<' . $itemElement . ' class="undo-delete">',
"#suffix" => '</' . $itemElement . '>',
'#prefix' => '<' . $item_element . ' class="undo-delete">',
"#suffix" => '</' . $item_element . '>',
);
}
@ -1668,7 +1668,7 @@ function views_ui_get_display_tab_details($view, $display) {
$build['columns'] = array();
$build['columns']['#theme_wrappers'] = array('container');
$build['columns']['#attributes'] = array('id' => 'edit-display-settings-main', 'class' => array('clearfix', 'views-display-columns'),);
$build['columns']['#attributes'] = array('id' => 'edit-display-settings-main', 'class' => array('clearfix', 'views-display-columns'));
$build['columns']['first']['#theme_wrappers'] = array('container');
$build['columns']['first']['#attributes'] = array('class' => array('views-display-column', 'first'));
@ -1693,9 +1693,9 @@ function views_ui_get_display_tab_details($view, $display) {
if (!config('views.settings')->get('views_ui_show_advanced_column')) {
$build['columns']['third']['#attributes']['class'][] = 'ctools-collapsed';
}
$build['columns']['third']['advanced'] = array('#markup' => '<h3 class="ctools-collapsible-handle"><a href="">' . t('Advanced') . '</a></h3>',);
$build['columns']['third']['advanced'] = array('#markup' => '<h3 class="ctools-collapsible-handle"><a href="">' . t('Advanced') . '</a></h3>');
$build['columns']['third']['collapse']['#theme_wrappers'] = array('container');
$build['columns']['third']['collapse']['#attributes'] = array('class' => array('ctools-collapsible-content',),);
$build['columns']['third']['collapse']['#attributes'] = array('class' => array('ctools-collapsible-content'));
// Each option (e.g. title, access, display as grid/table/list) fits into one
// of several "buckets," or boxes (Format, Fields, Sort, and so on).
@ -2248,7 +2248,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
$actions['add'] = array(
'title' => t('Add'),
'href' => "admin/structure/views/nojs/add-item/$view->name/$display->id/$type",
'attributes'=> array('class' => array('icon compact add', 'views-ajax-link'), 'title' => t('Add'), 'id' => 'views-add-' . $type),
'attributes' => array('class' => array('icon compact add', 'views-ajax-link'), 'title' => t('Add'), 'id' => 'views-add-' . $type),
'html' => TRUE,
);
if ($count_handlers > 0) {
@ -2347,11 +2347,11 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
}
if ($display->handler->use_group_by() && $handler->use_group_by()) {
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Aggregation settings') . '</span>', "admin/structure/views/nojs/config-item-group/$view->name/$display->id/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link', 'title' => t('Aggregation settings')), 'html' => true));
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Aggregation settings') . '</span>', "admin/structure/views/nojs/config-item-group/$view->name/$display->id/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link', 'title' => t('Aggregation settings')), 'html' => TRUE));
}
if ($handler->has_extra_options()) {
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Settings') . '</span>', "admin/structure/views/nojs/config-item-extra/$view->name/$display->id/$type/$id", array('attributes' => array('class' => array('views-button-configure', 'views-ajax-link'), 'title' => t('Settings')), 'html' => true));
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Settings') . '</span>', "admin/structure/views/nojs/config-item-extra/$view->name/$display->id/$type/$id", array('attributes' => array('class' => array('views-button-configure', 'views-ajax-link'), 'title' => t('Settings')), 'html' => TRUE));
}
if ($grouping) {
@ -3106,7 +3106,7 @@ function _views_position_sort($display1, $display2) {
* Submit handler for rearranging display form
*/
function views_ui_reorder_displays_form_submit($form, &$form_state) {
foreach($form_state['input'] as $display => $info) {
foreach ($form_state['input'] as $display => $info) {
// add each value that is a field with a weight to our list, but only if
// it has had its 'removed' checkbox checked.
if (is_array($info) && isset($info['weight']) && empty($info['removed'])) {
@ -3120,13 +3120,13 @@ function views_ui_reorder_displays_form_submit($form, &$form_state) {
// Fixing up positions
$position = 2;
foreach(array_keys($order) as $display) {
foreach (array_keys($order) as $display) {
$order[$display] = $position++;
}
// Setting up position and removing deleted displays
$displays = $form_state['view']->display;
foreach($displays as $display_id => $display) {
foreach ($displays as $display_id => $display) {
// Don't touch the default !!!
if ($display_id === 'default') {
continue;
@ -3632,7 +3632,7 @@ function views_ui_rearrange_filter_form($form, &$form_state) {
$form['filter_groups']['#tree'] = TRUE;
$form['filter_groups']['operator'] = array(
'#type' => 'select',
'#options' => array (
'#options' => array(
'AND' => t('And'),
'OR' => t('Or'),
),
@ -3801,7 +3801,7 @@ function theme_views_ui_rearrange_filter_form(&$vars) {
$form['filters'][$id]['group']['#attributes']['class'] = array('views-group-select views-group-select-' . $group_id);
$row[] = drupal_render($form['filters'][$id]['group']);
$form['filters'][$id]['removed']['#attributes']['class'][] = 'js-hide';
$row[] = drupal_render($form['filters'][$id]['removed']) . l('<span>' . t('Remove') . '</span>', 'javascript:void()', array('attributes' => array('id' => 'views-remove-link-' . $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));
$row[] = drupal_render($form['filters'][$id]['removed']) . l('<span>' . t('Remove') . '</span>', 'javascript:void()', array('attributes' => array('id' => 'views-remove-link-' . $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));
$row = array('data' => $row, 'class' => array('draggable'), 'id' => 'views-row-' . $id);
if ($group_id !== 'ungroupable') {

View File

@ -48,12 +48,12 @@ function _views_create_handler($definition, $type = 'handler', $handler_type = N
return;
}
if (!empty($definition['override handler'])) {
$handler = new $definition['override handler'];
}
else {
$handler = new $definition['handler'];
}
if (!empty($definition['override handler'])) {
$handler = new $definition['override handler'];
}
else {
$handler = new $definition['handler'];
}
$handler->set_definition($definition);
if ($type == 'handler') {
@ -1185,7 +1185,7 @@ function views_get_timezone() {
db_query("SET @@session.time_zone = '$offset'");
}
$already_set = true;
$already_set = TRUE;
}
}
@ -1357,44 +1357,46 @@ function views_date_sql_extract($extract_type, $field, $field_type = 'int', $set
// Note there is no space after FROM to avoid db_rewrite problems
// see http://drupal.org/node/79904.
switch ($extract_type) {
case('DATE'):
return $field;
case('YEAR'):
return "EXTRACT(YEAR FROM($field))";
case('MONTH'):
return "EXTRACT(MONTH FROM($field))";
case('DAY'):
return "EXTRACT(DAY FROM($field))";
case('HOUR'):
return "EXTRACT(HOUR FROM($field))";
case('MINUTE'):
return "EXTRACT(MINUTE FROM($field))";
case('SECOND'):
return "EXTRACT(SECOND FROM($field))";
case('WEEK'): // ISO week number for date
switch ($db_type) {
case('mysql'):
// WEEK using arg 3 in mysql should return the same value as postgres EXTRACT
return "WEEK($field, 3)";
case('pgsql'):
return "EXTRACT(WEEK FROM($field))";
}
case('DOW'):
switch ($db_type) {
case('mysql'):
// mysql returns 1 for Sunday through 7 for Saturday
// php date functions and postgres use 0 for Sunday and 6 for Saturday
return "INTEGER(DAYOFWEEK($field) - 1)";
case('pgsql'):
return "EXTRACT(DOW FROM($field))";
}
case('DOY'):
switch ($db_type) {
case('mysql'):
return "DAYOFYEAR($field)";
case('pgsql'):
return "EXTRACT(DOY FROM($field))";
}
case 'DATE':
return $field;
case 'YEAR':
return "EXTRACT(YEAR FROM($field))";
case 'MONTH':
return "EXTRACT(MONTH FROM($field))";
case 'DAY':
return "EXTRACT(DAY FROM($field))";
case 'HOUR':
return "EXTRACT(HOUR FROM($field))";
case 'MINUTE':
return "EXTRACT(MINUTE FROM($field))";
case 'SECOND':
return "EXTRACT(SECOND FROM($field))";
// ISO week number for date
case 'WEEK':
switch ($db_type) {
case 'mysql':
// WEEK using arg 3 in mysql should return the same value as postgres
// EXTRACT.
return "WEEK($field, 3)";
case 'pgsql':
return "EXTRACT(WEEK FROM($field))";
}
case 'DOW':
switch ($db_type) {
case 'mysql':
// mysql returns 1 for Sunday through 7 for Saturday php date
// functions and postgres use 0 for Sunday and 6 for Saturday.
return "INTEGER(DAYOFWEEK($field) - 1)";
case 'pgsql':
return "EXTRACT(DOW FROM($field))";
}
case 'DOY':
switch ($db_type) {
case 'mysql':
return "DAYOFYEAR($field)";
case 'pgsql':
return "EXTRACT(DOY FROM($field))";
}
}
}

View File

@ -65,16 +65,16 @@ class PluginStyleTest extends ViewsSqlTest {
$expected = array();
// Use Job: as label, so be sure that the label is used for groupby as well.
$expected['Job: Singer'] = array();
$expected['Job: Singer'][0] = new StdClass();
$expected['Job: Singer'][0] = new stdClass();
$expected['Job: Singer'][0]->views_test_name = 'John';
$expected['Job: Singer'][0]->views_test_job = 'Singer';
$expected['Job: Singer'][0]->views_test_id = '1';
$expected['Job: Singer'][1] = new StdClass();
$expected['Job: Singer'][1] = new stdClass();
$expected['Job: Singer'][1]->views_test_name = 'George';
$expected['Job: Singer'][1]->views_test_job = 'Singer';
$expected['Job: Singer'][1]->views_test_id = '2';
$expected['Job: Drummer'] = array();
$expected['Job: Drummer'][2] = new StdClass();
$expected['Job: Drummer'][2] = new stdClass();
$expected['Job: Drummer'][2]->views_test_name = 'Ringo';
$expected['Job: Drummer'][2]->views_test_job = 'Drummer';
$expected['Job: Drummer'][2]->views_test_id = '3';
@ -84,17 +84,17 @@ class PluginStyleTest extends ViewsSqlTest {
$expected = array();
$expected['Job: Singer'] = array();
$expected['Job: Singer']['group'] = 'Job: Singer';
$expected['Job: Singer']['rows'][0] = new StdClass();
$expected['Job: Singer']['rows'][0] = new stdClass();
$expected['Job: Singer']['rows'][0]->views_test_name = 'John';
$expected['Job: Singer']['rows'][0]->views_test_job = 'Singer';
$expected['Job: Singer']['rows'][0]->views_test_id = '1';
$expected['Job: Singer']['rows'][1] = new StdClass();
$expected['Job: Singer']['rows'][1] = new stdClass();
$expected['Job: Singer']['rows'][1]->views_test_name = 'George';
$expected['Job: Singer']['rows'][1]->views_test_job = 'Singer';
$expected['Job: Singer']['rows'][1]->views_test_id = '2';
$expected['Job: Drummer'] = array();
$expected['Job: Drummer']['group'] = 'Job: Drummer';
$expected['Job: Drummer']['rows'][2] = new StdClass();
$expected['Job: Drummer']['rows'][2] = new stdClass();
$expected['Job: Drummer']['rows'][2]->views_test_name = 'Ringo';
$expected['Job: Drummer']['rows'][2]->views_test_job = 'Drummer';
$expected['Job: Drummer']['rows'][2]->views_test_id = '3';
@ -169,14 +169,14 @@ class PluginStyleTest extends ViewsSqlTest {
$expected['Job: Singer']['group'] = 'Job: Singer';
$expected['Job: Singer']['rows']['Age: 25'] = array();
$expected['Job: Singer']['rows']['Age: 25']['group'] = 'Age: 25';
$expected['Job: Singer']['rows']['Age: 25']['rows'][0] = new StdClass();
$expected['Job: Singer']['rows']['Age: 25']['rows'][0] = new stdClass();
$expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_name = 'John';
$expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_job = 'Singer';
$expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_age = '25';
$expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_id = '1';
$expected['Job: Singer']['rows']['Age: 27'] = array();
$expected['Job: Singer']['rows']['Age: 27']['group'] = 'Age: 27';
$expected['Job: Singer']['rows']['Age: 27']['rows'][1] = new StdClass();
$expected['Job: Singer']['rows']['Age: 27']['rows'][1] = new stdClass();
$expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_name = 'George';
$expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_job = 'Singer';
$expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_age = '27';
@ -185,7 +185,7 @@ class PluginStyleTest extends ViewsSqlTest {
$expected['Job: Drummer']['group'] = 'Job: Drummer';
$expected['Job: Drummer']['rows']['Age: 28'] = array();
$expected['Job: Drummer']['rows']['Age: 28']['group'] = 'Age: 28';
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2] = new StdClass();
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2] = new stdClass();
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_name = 'Ringo';
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_job = 'Drummer';
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_age = '28';

View File

@ -67,7 +67,7 @@ class PluginStyleUnformattedTest extends ViewsSqlTest {
if ($count == 1) {
$this->assertTrue(strpos($class, "views-row-first") !== FALSE, 'Take sure that the first class is set right.');
}
else if ($count == $count_result) {
elseif ($count == $count_result) {
$this->assertTrue(strpos($class, "views-row-last") !== FALSE, 'Take sure that the last class is set right.');
}

View File

@ -34,7 +34,7 @@ class WizardBasicTest extends WizardTestBase {
$this->assertText(t('Your view was saved. You may edit it from the list below.'));
$this->assertText($view1['human_name']);
$this->assertText($view1['description']);
foreach(array('delete', 'clone', 'edit') as $operation) {
foreach (array('delete', 'clone', 'edit') as $operation) {
$this->assertLinkByHref(url('admin/structure/views/view/' . $view1['name'] . '/' . $operation));
}

View File

@ -169,7 +169,7 @@ class View extends ViewsDbObject {
*
* @var views_plugin_style
*/
var $style_plugin;
var $style_plugin;
/**
* Stored the changed options of the style plugin.
@ -988,7 +988,7 @@ class View extends ViewsDbObject {
$filter_groups = $this->display_handler->get_option('filter_groups');
if ($filter_groups) {
$this->query->set_group_operator($filter_groups['operator']);
foreach($filter_groups['groups'] as $id => $operator) {
foreach ($filter_groups['groups'] as $id => $operator) {
$this->query->set_where_group($operator, $id);
}
}
@ -1138,7 +1138,7 @@ class View extends ViewsDbObject {
$cache = $this->display_handler->get_plugin('cache');
}
if ($cache && $cache->cache_get('results')) {
if($this->query->pager->use_pager()) {
if ($this->query->pager->use_pager()) {
$this->query->pager->total_items = $this->total_rows;
$this->query->pager->update_page_info();
}
@ -1554,9 +1554,9 @@ class View extends ViewsDbObject {
* The tokens in the title get's replaced before rendering.
*/
function set_title($title) {
$this->build_info['title'] = $title;
return TRUE;
}
$this->build_info['title'] = $title;
return TRUE;
}
/**
* Return the human readable name for a view.

View File

@ -119,7 +119,7 @@ class ViewsObject {
$localization_keys = $this->localization_keys;
}
// but plugins don't because there isn't a common init() these days.
else if (!empty($this->is_plugin)) {
elseif (!empty($this->is_plugin)) {
if ($this->plugin_type != 'display') {
$localization_keys = array($this->view->current_display);
$localization_keys[] = $this->plugin_type;
@ -150,7 +150,7 @@ class ViewsObject {
}
// Don't localize strings during editing. When editing, we need to work with
// the original data, not the translated version.
else if (empty($this->view->editing) && !empty($definition[$key]['translatable']) && !empty($value) || !empty($definition['contains'][$key]['translatable']) && !empty($value)) {
elseif (empty($this->view->editing) && !empty($definition[$key]['translatable']) && !empty($value) || !empty($definition['contains'][$key]['translatable']) && !empty($value)) {
if (!empty($this->view) && $this->view->is_translatable()) {
// Allow other modules to make changes to the string before it's
// sent for translation.
@ -172,7 +172,7 @@ class ViewsObject {
$storage[$key] = t($value);
}
}
else if ($all || !empty($definition[$key])) {
elseif ($all || !empty($definition[$key])) {
$storage[$key] = $value;
}
}
@ -330,7 +330,7 @@ class ViewsObject {
if (is_array($value)) {
$this->unpack_translatable($translatable, $options, $key, $definition, $parents, $translation_keys);
}
else if (!empty($definition[$key]['translatable']) && !empty($value)) {
elseif (!empty($definition[$key]['translatable']) && !empty($value)) {
// Build source data and add to the array
$format = NULL;
if (isset($definition['format_key']) && isset($options[$definition['format_key']])) {
@ -344,7 +344,7 @@ class ViewsObject {
}
}
}
else if (!empty($definition['translatable']) && !empty($options)) {
elseif (!empty($definition['translatable']) && !empty($options)) {
$value = $options;
// Build source data and add to the array
$format = NULL;

View File

@ -6,7 +6,7 @@
*/
/**
* Implementation of hook_views_default_views()
* Implements hook_views_default_views().
*/
function comment_views_default_views() {
$views = array();

View File

@ -58,7 +58,7 @@ class views_handler_field_comment extends views_handler_field {
$this->options['alter']['fragment'] = "comment-" . $cid;
}
// If there is no comment link to the node.
else if ($this->options['link_to_node']) {
elseif ($this->options['link_to_node']) {
$this->options['alter']['path'] = "node/" . $nid;
}
}

View File

@ -60,7 +60,7 @@ class views_handler_field_comment_link extends views_handler_field_entity {
$this->options['alter']['fragment'] = "comment-" . $cid;
}
// If there is no comment link to the node.
else if ($this->options['link_to_node']) {
elseif ($this->options['link_to_node']) {
$this->options['alter']['path'] = "node/" . $nid;
}

View File

@ -6,7 +6,7 @@
*/
/**
* Implementation of hook_views_default_views()
* Implements of hook_views_default_views().
*/
function statistics_views_default_views() {
$views = array();

View File

@ -55,7 +55,7 @@ class views_handler_field_term_node_tid extends views_handler_field_prerender_li
$form['limit'] = array(
'#type' => 'checkbox',
'#title' => t('Limit terms by vocabulary'),
'#default_value'=> $this->options['limit'],
'#default_value' => $this->options['limit'],
);
$options = array();
@ -140,9 +140,9 @@ class views_handler_field_term_node_tid extends views_handler_field_prerender_li
}
function add_self_tokens(&$tokens, $item) {
foreach(array('tid', 'name', 'vocabulary_machine_name', 'vocabulary') as $token) {
foreach (array('tid', 'name', 'vocabulary_machine_name', 'vocabulary') as $token) {
// Replace _ with - for the vocabulary machine name.
$tokens['[' . $this->options['id'] . '-' . str_replace('_', '-', $token). ']'] = isset($item[$token]) ? $item[$token] : '';
$tokens['[' . $this->options['id'] . '-' . str_replace('_', '-', $token) . ']'] = isset($item[$token]) ? $item[$token] : '';
}
}
}

View File

@ -50,7 +50,7 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d
$form['limit'] = array(
'#type' => 'checkbox',
'#title' => t('Limit terms by vocabulary'),
'#default_value'=> $this->options['limit'],
'#default_value' => $this->options['limit'],
'#states' => array(
'visible' => array(
':input[name="options[argument_default][taxonomy_tid][node]"]' => array('checked' => TRUE),
@ -80,7 +80,7 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d
$form['anyall'] = array(
'#type' => 'radios',
'#title' => t('Multiple-value handling'),
'#default_value'=> $this->options['anyall'],
'#default_value' => $this->options['anyall'],
'#process' => array('form_process_radios', 'ctools_dependent_process'),
'#options' => array(
',' => t('Filter to items that share all terms'),

View File

@ -80,7 +80,7 @@ class views_plugin_cache extends views_plugin {
* @param $type
* The cache type, either 'query', 'result' or 'output'.
*/
function cache_expire($type) { }
function cache_expire($type) { }
/**
* Determine expiration time in the cache table of the cache type
@ -270,7 +270,7 @@ class views_plugin_cache extends views_plugin {
$query_plugin = $this->view->display_handler->get_plugin('query');
foreach (array('query','count_query') as $index) {
foreach (array('query', 'count_query') as $index) {
// If the default query back-end is used generate SQL query strings from
// the query objects.
if ($build_info[$index] instanceof Drupal\Core\Database\Query\Select) {

View File

@ -15,7 +15,7 @@
* @ingroup views_display_plugins
*/
class views_plugin_display_attachment extends views_plugin_display {
function option_definition () {
function option_definition() {
$options = parent::option_definition();
$options['displays'] = array('default' => array());

View File

@ -235,7 +235,7 @@ class views_plugin_display_block extends views_plugin_display {
->fields(array(
'cache' => $cache_setting,
))
->condition('module','views')
->condition('module', 'views')
->condition('delta', $delta)
->execute();
}

View File

@ -63,7 +63,7 @@ class views_plugin_display_feed extends views_plugin_display_page {
}
function defaultable_sections($section = NULL) {
if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin',))) {
if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin'))) {
return FALSE;
}

View File

@ -30,7 +30,7 @@ class views_plugin_display_page extends views_plugin_display {
'weight' => array('default' => 0),
'name' => array('default' => variable_get('menu_default_node_menu', 'navigation')),
'context' => array('default' => ''),
),
),
);
$options['tab_options'] = array(
'contains' => array(
@ -40,7 +40,7 @@ class views_plugin_display_page extends views_plugin_display {
'description' => array('default' => '', 'translatable' => FALSE),
'weight' => array('default' => 0),
'name' => array('default' => 'navigation'),
),
),
);
return $options;
@ -266,7 +266,7 @@ class views_plugin_display_page extends views_plugin_display {
if (!is_array($menu)) {
$menu = array('type' => 'none');
}
switch($menu['type']) {
switch ($menu['type']) {
case 'none':
default:
$menu_str = t('No menu');
@ -311,7 +311,7 @@ class views_plugin_display_page extends views_plugin_display {
'#default_value' => $this->get_option('path'),
'#field_prefix' => '<span dir="ltr">' . url(NULL, array('absolute' => TRUE)),
'#field_suffix' => '</span>&lrm;',
'#attributes' => array('dir'=>'ltr'),
'#attributes' => array('dir' => 'ltr'),
);
break;
case 'menu':

View File

@ -58,7 +58,7 @@ class views_plugin_exposed_form extends views_plugin {
'#required' => TRUE,
);
$form['reset_button'] = array (
$form['reset_button'] = array(
'#type' => 'checkbox',
'#title' => t('Include reset button'),
'#description' => t('If checked the exposed form will provide a button to reset all the applied exposed filters'),
@ -176,7 +176,7 @@ class views_plugin_exposed_form extends views_plugin {
if (!$sort->is_exposed()) {
$sort->query();
}
else if ($key == $sort_by) {
elseif ($key == $sort_by) {
if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], array('ASC', 'DESC'))) {
$sort->options['order'] = $exposed_data['sort_order'];
}
@ -225,7 +225,8 @@ class views_plugin_exposed_form extends views_plugin {
);
if (isset($form_state['input']['sort_by']) && isset($this->view->sort[$form_state['input']['sort_by']])) {
$default_sort_order = $this->view->sort[$form_state['input']['sort_by']]->options['order'];
} else {
}
else {
$first_sort = reset($this->view->sort);
$default_sort_order = $first_sort->options['order'];
}

View File

@ -90,7 +90,7 @@ class views_plugin_pager_full extends views_plugin_pager {
'#default_value' => $this->options['quantity'],
);
$form['tags'] = array (
$form['tags'] = array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
@ -128,7 +128,7 @@ class views_plugin_pager_full extends views_plugin_pager {
'#default_value' => $this->options['tags']['last'],
);
$form['expose'] = array (
$form['expose'] = array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
@ -219,7 +219,7 @@ class views_plugin_pager_full extends views_plugin_pager {
if (strpos($exposed_options, '.') !== FALSE) {
$error = TRUE;
}
$options = explode(',',$exposed_options);
$options = explode(',', $exposed_options);
if (!$error && is_array($options)) {
foreach ($options as $option) {
if (!is_numeric($option) || intval($option) == 0) {
@ -366,7 +366,7 @@ class views_plugin_pager_full extends views_plugin_pager {
if ($this->current_page < 0) {
$this->current_page = 0;
}
else if ($this->current_page >= $pager_total[$this->options['id']]) {
elseif ($this->current_page >= $pager_total[$this->options['id']]) {
// Pages are numbered from 0 so if there are 10 pages, the last page is 9.
$this->current_page = $pager_total[$this->options['id']] - 1;
}

View File

@ -89,17 +89,17 @@ class views_plugin_query_default extends views_plugin_query {
*
* @var views_plugin_pager
*/
var $pager = NULL;
var $pager = NULL;
/**
* An array mapping table aliases and field names to field aliases.
*/
var $field_aliases = array();
var $field_aliases = array();
/**
* Query tags which will be passed over to the dbtng query object.
*/
var $tags = array();
var $tags = array();
/**
* Is the view marked as not distinct.
@ -1044,8 +1044,8 @@ class views_plugin_query_default extends views_plugin_query {
'direction' => strtoupper($order)
);
/**
* -- removing, this should be taken care of by field adding now.
/**
* -- removing, this should be taken care of by field adding now.
* -- leaving commented because I am unsure.
// If grouping, all items in the order by must also be in the
// group by clause. Check $table to ensure that this is not a
@ -1053,7 +1053,7 @@ class views_plugin_query_default extends views_plugin_query {
if ($this->groupby && $table) {
$this->add_groupby($as);
}
*/
*/
}
/**
@ -1243,7 +1243,7 @@ class views_plugin_query_default extends views_plugin_query {
function query($get_count = FALSE) {
// Check query distinct value.
if (empty($this->no_distinct) && $this->distinct && !empty($this->fields)) {
if ($this->pure_distinct === FALSE){
if ($this->pure_distinct === FALSE) {
$base_field_alias = $this->add_field($this->base_table, $this->base_field);
$this->add_groupby($base_field_alias);
}

View File

@ -89,7 +89,7 @@ class ViewsUiBaseViewsWizard implements ViewsWizardInterface {
$form['displays']['page'] = array(
'#type' => 'fieldset',
'#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend'),),
'#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')),
'#tree' => TRUE,
);
$form['displays']['page']['create'] = array(
@ -104,7 +104,7 @@ class ViewsUiBaseViewsWizard implements ViewsWizardInterface {
// can be hidden en masse when the "Create a page" checkbox is unchecked.
$form['displays']['page']['options'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('options-set'),),
'#attributes' => array('class' => array('options-set')),
'#states' => array(
'visible' => array(
':input[name="page[create]"]' => array('checked' => TRUE),
@ -232,7 +232,7 @@ class ViewsUiBaseViewsWizard implements ViewsWizardInterface {
$form['displays']['block'] = array(
'#type' => 'fieldset',
'#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend'),),
'#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')),
'#tree' => TRUE,
);
$form['displays']['block']['create'] = array(
@ -246,7 +246,7 @@ class ViewsUiBaseViewsWizard implements ViewsWizardInterface {
// can be hidden en masse when the "Create a block" checkbox is unchecked.
$form['displays']['block']['options'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('options-set'),),
'#attributes' => array('class' => array('options-set')),
'#states' => array(
'visible' => array(
':input[name="block[create]"]' => array('checked' => TRUE),
@ -928,12 +928,12 @@ class ViewsUiBaseViewsWizard implements ViewsWizardInterface {
*
* @throws ViewsWizardException if the values have not been validated.
*/
function create_view($form, &$form_state) {
function create_view($form, &$form_state) {
$view = $this->retrieve_validated_view($form, $form_state);
if (empty($view)) {
throw new ViewsWizardException(t('Attempted to create_view with values that have not been validated'));
}
return $view;
}
if (empty($view)) {
throw new ViewsWizardException(t('Attempted to create_view with values that have not been validated'));
}
return $view;
}
}

View File

@ -7,7 +7,7 @@
?>
<div <?php print $attributes; ?>>
<?php print $item_help_icon; ?>
<?php if(!empty($actions)) : ?>
<?php if (!empty($actions)) : ?>
<?php print $actions; ?>
<?php endif; ?>
<?php if (!empty($title)) : ?>

View File

@ -1708,7 +1708,7 @@ function views_debug($message, $placeholders = array()) {
$output = $message;
watchdog('views_logging', $output, $placeholders);
}
else if ($devel_region == 'drupal_debug') {
elseif ($devel_region == 'drupal_debug') {
$output = empty($output) ? t($message, $placeholders) : $output;
dd($output);
}