Passed
Pull Request — master (#2976)
by Serghei
14:27
created
drupal/sites/default/boinc/modules/contrib/cck/includes/content.crud.inc 5 patches
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -29,46 +29,46 @@  discard block
 block discarded – undo
29 29
  * Create an array of default values for a field type.
30 30
  */
31 31
 function content_field_default_values($field_type) {
32
-  $field_types = _content_field_types();
33
-  $module = $field_types[$field_type]['module'];
32
+    $field_types = _content_field_types();
33
+    $module = $field_types[$field_type]['module'];
34 34
 
35
-  $field = array(
35
+    $field = array(
36 36
     'module' => $module,
37 37
     'type' => $field_type,
38 38
     'active' => 0,
39
-  );
39
+    );
40 40
 
41
-  if (module_exists($module)) {
41
+    if (module_exists($module)) {
42 42
     $field['active'] = 1;
43
-  }
43
+    }
44 44
 
45
-  $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field);
46
-  // Ensure columns always default to NULL values.
47
-  foreach ($field['columns'] as $column_name => $column) {
45
+    $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field);
46
+    // Ensure columns always default to NULL values.
47
+    foreach ($field['columns'] as $column_name => $column) {
48 48
     $field['columns'][$column_name]['not null'] = FALSE;
49
-  }
49
+    }
50 50
 
51
-  $field['required'] = 0;
52
-  $field['multiple'] = 0;
53
-  $field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
51
+    $field['required'] = 0;
52
+    $field['multiple'] = 0;
53
+    $field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
54 54
 
55
-  // Make sure field settings all have an index in the array.
56
-  $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field);
57
-  drupal_alter('field_settings', $setting_names, 'save', $field);
58
-  foreach ($setting_names as $setting) {
55
+    // Make sure field settings all have an index in the array.
56
+    $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field);
57
+    drupal_alter('field_settings', $setting_names, 'save', $field);
58
+    foreach ($setting_names as $setting) {
59 59
     $field[$setting] = NULL;
60
-  }
61
-  return $field;
60
+    }
61
+    return $field;
62 62
 }
63 63
 
64 64
 /**
65 65
  * Create an array of default values for a field instance.
66 66
  */
67 67
 function content_instance_default_values($field_name, $type_name, $widget_type) {
68
-  $widget_types = _content_widget_types();
69
-  $module = $widget_types[$widget_type]['module'];
68
+    $widget_types = _content_widget_types();
69
+    $module = $widget_types[$widget_type]['module'];
70 70
 
71
-  $widget = array(
71
+    $widget = array(
72 72
     'field_name' => $field_name,
73 73
     'type_name' => $type_name,
74 74
     'weight' => 0,
@@ -78,101 +78,101 @@  discard block
 block discarded – undo
78 78
     'widget_module' => $module,
79 79
     'display_settings' => array(),
80 80
     'widget_settings' => array(),
81
-  );
81
+    );
82 82
 
83
-  if (module_exists($module)) {
83
+    if (module_exists($module)) {
84 84
     $widget['widget_active'] = 1;
85
-  }
85
+    }
86 86
 
87
-  $settings_names = array_merge(array('label'), array_keys(content_build_modes()));
88
-  $widget['display_settings'] = array();
89
-  foreach ($settings_names as $name) {
87
+    $settings_names = array_merge(array('label'), array_keys(content_build_modes()));
88
+    $widget['display_settings'] = array();
89
+    foreach ($settings_names as $name) {
90 90
     $widget['display_settings'][$name]['format'] = ($name == 'label') ? 'above' : 'default';
91 91
     $widget['display_settings'][$name]['exclude'] = 0;
92
-  }
92
+    }
93 93
 
94
-  // Make sure widget settings all have an index in the array.
95
-  $settings_names = (array) module_invoke($module, 'widget_settings', 'save', $widget);
96
-  drupal_alter('widget_settings', $settings_names, 'save', $widget);
97
-  $widget['widget_settings'] = array();
98
-  foreach ($settings_names as $name) {
94
+    // Make sure widget settings all have an index in the array.
95
+    $settings_names = (array) module_invoke($module, 'widget_settings', 'save', $widget);
96
+    drupal_alter('widget_settings', $settings_names, 'save', $widget);
97
+    $widget['widget_settings'] = array();
98
+    foreach ($settings_names as $name) {
99 99
     $widget['widget_settings'][$name] = NULL;
100
-  }
101
-  return $widget;
100
+    }
101
+    return $widget;
102 102
 }
103 103
 
104 104
 /**
105 105
  * Expand field info to create field => widget info.
106 106
  */
107 107
 function content_field_instance_expand($field) {
108
-  if (isset($field['widget'])) {
108
+    if (isset($field['widget'])) {
109 109
     return $field;
110
-  }
111
-  $field['widget'] = !empty($field['widget_settings']) ? $field['widget_settings'] : array();
112
-  $field['widget']['label'] = !empty($field['label']) ? $field['label'] : $field['field_name'];
113
-  $field['widget']['weight'] = !empty($field['weight']) ? $field['weight'] : 0;
114
-  $field['widget']['description'] = !empty($field['description']) ? $field['description'] : '';
110
+    }
111
+    $field['widget'] = !empty($field['widget_settings']) ? $field['widget_settings'] : array();
112
+    $field['widget']['label'] = !empty($field['label']) ? $field['label'] : $field['field_name'];
113
+    $field['widget']['weight'] = !empty($field['weight']) ? $field['weight'] : 0;
114
+    $field['widget']['description'] = !empty($field['description']) ? $field['description'] : '';
115 115
 
116
-  if (!empty($field['widget_type'])) {
116
+    if (!empty($field['widget_type'])) {
117 117
     $field['widget']['type'] = $field['widget_type'];
118 118
     $widget_types = _content_widget_types();
119 119
     $field['widget']['module'] = isset($widget_types[$field['widget_type']]['module']) ? $widget_types[$field['widget_type']]['module'] : $field['widget_module'];
120
-  }
121
-  elseif (!empty($field['widget_module'])) {
120
+    }
121
+    elseif (!empty($field['widget_module'])) {
122 122
     $field['widget']['module'] = $field['widget_module'];
123
-  }
124
-
125
-  unset($field['widget_type']);
126
-  unset($field['weight']);
127
-  unset($field['label']);
128
-  unset($field['description']);
129
-  unset($field['widget_module']);
130
-  unset($field['widget_settings']);
131
-
132
-  // If content.module is handling the default value,
133
-  // initialize $widget_settings with default values,
134
-  if (isset($field['default_value']) && isset($field['default_value_php']) &&
123
+    }
124
+
125
+    unset($field['widget_type']);
126
+    unset($field['weight']);
127
+    unset($field['label']);
128
+    unset($field['description']);
129
+    unset($field['widget_module']);
130
+    unset($field['widget_settings']);
131
+
132
+    // If content.module is handling the default value,
133
+    // initialize $widget_settings with default values,
134
+    if (isset($field['default_value']) && isset($field['default_value_php']) &&
135 135
       content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) {
136 136
     $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value']  : NULL;
137 137
     $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : NULL;
138 138
     unset($field['default_value']);
139 139
     unset($field['default_value_php']);
140
-  }
141
-  return $field;
140
+    }
141
+    return $field;
142 142
 }
143 143
 
144 144
 /**
145 145
  * Collapse field info from field => widget to flattened form values.
146 146
  */
147 147
 function content_field_instance_collapse($field) {
148
-  if (!isset($field['widget'])) {
148
+    if (!isset($field['widget'])) {
149 149
     return $field;
150
-  }
151
-  $field['widget_settings'] = !empty($field['widget']) ? $field['widget'] : array();
152
-  $field['widget_type'] = !empty($field['widget']['type']) ? $field['widget']['type'] : '';
153
-  $field['weight'] = !empty($field['widget']['weight']) ? $field['widget']['weight'] : 0;
154
-  $field['label'] = !empty($field['widget']['label']) ? $field['widget']['label'] : $field['field_name'];
155
-  $field['description'] = !empty($field['widget']['description']) ? $field['widget']['description'] : '';
156
-  $field['type_name'] = !empty($field['type_name']) ? $field['type_name'] : '';
157
-
158
-  if (!empty($field['widget']['module'])) {
150
+    }
151
+    $field['widget_settings'] = !empty($field['widget']) ? $field['widget'] : array();
152
+    $field['widget_type'] = !empty($field['widget']['type']) ? $field['widget']['type'] : '';
153
+    $field['weight'] = !empty($field['widget']['weight']) ? $field['widget']['weight'] : 0;
154
+    $field['label'] = !empty($field['widget']['label']) ? $field['widget']['label'] : $field['field_name'];
155
+    $field['description'] = !empty($field['widget']['description']) ? $field['widget']['description'] : '';
156
+    $field['type_name'] = !empty($field['type_name']) ? $field['type_name'] : '';
157
+
158
+    if (!empty($field['widget']['module'])) {
159 159
     $widget_module = $field['widget']['module'];
160
-  }
161
-  elseif (!empty($field['widget']['type'])) {
160
+    }
161
+    elseif (!empty($field['widget']['type'])) {
162 162
     $widget_types = _content_widget_types();
163 163
     $widget_module = $widget_types[$field['widget']['type']]['module'];
164
-  }
165
-  else {
164
+    }
165
+    else {
166 166
     $widget_module = '';
167
-  }
168
-  $field['widget_module'] = $widget_module;
169
-  unset($field['widget_settings']['type']);
170
-  unset($field['widget_settings']['weight']);
171
-  unset($field['widget_settings']['label']);
172
-  unset($field['widget_settings']['description']);
173
-  unset($field['widget_settings']['module']);
174
-  unset($field['widget']);
175
-  return $field;
167
+    }
168
+    $field['widget_module'] = $widget_module;
169
+    unset($field['widget_settings']['type']);
170
+    unset($field['widget_settings']['weight']);
171
+    unset($field['widget_settings']['label']);
172
+    unset($field['widget_settings']['description']);
173
+    unset($field['widget_settings']['module']);
174
+    unset($field['widget']);
175
+    return $field;
176 176
 }
177 177
 
178 178
 /**
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
  * @see menu_rebuild()
209 209
  */
210 210
 function content_field_instance_create($field, $rebuild = TRUE) {
211
-  include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
211
+    include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
212 212
 
213
-  $form_values = $field;
214
-  $field = content_field_instance_expand($field);
213
+    $form_values = $field;
214
+    $field = content_field_instance_expand($field);
215 215
 
216
-  // If there are prior instances, fill out missing values from the prior values,
217
-  // otherwise get missing values from default values.
218
-  $prior_instances = content_field_instance_read(array('field_name' => $field['field_name']));
219
-  if (!empty($prior_instances) && is_array($prior_instances)) {
216
+    // If there are prior instances, fill out missing values from the prior values,
217
+    // otherwise get missing values from default values.
218
+    $prior_instances = content_field_instance_read(array('field_name' => $field['field_name']));
219
+    if (!empty($prior_instances) && is_array($prior_instances)) {
220 220
     $prev_field = content_field_instance_expand($prior_instances[0]);
221 221
 
222 222
     // Weight, label, and description may have been forced into the $field
@@ -226,72 +226,72 @@  discard block
 block discarded – undo
226 226
     $field['widget']['weight'] = isset($form_values['weight']) ? $form_values['weight'] : $prev_field['widget']['weight'];
227 227
     $field['widget']['label']  = isset($form_values['label']) ? $form_values['label'] : $prev_field['widget']['label'];
228 228
     $field['widget']['description'] = isset($form_values['description']) ? $form_values['description'] : $prev_field['widget']['description'];
229
-  }
230
-  else {
229
+    }
230
+    else {
231 231
     $prev_field = array('widget' => array());
232
-  }
232
+    }
233 233
 
234
-  // If we have a field type, we can build default values for this field type.
235
-  $default_values = array('widget' => array());
236
-  if (isset($field['type'])) {
234
+    // If we have a field type, we can build default values for this field type.
235
+    $default_values = array('widget' => array());
236
+    if (isset($field['type'])) {
237 237
     $default_values = content_field_default_values($field['type']);
238 238
     $default_instance_values = content_instance_default_values($field['field_name'], $field['type_name'], $field['widget']['type']);
239 239
     $default_values = content_field_instance_expand(array_merge($default_values, $default_instance_values));
240
-  }
240
+    }
241 241
 
242
-  // Merge default values, previous values, and current values to create
243
-  // a complete field array.
244
-  $widget = array_merge($default_values['widget'], $prev_field['widget'], $field['widget']);
245
-  $field = array_merge($default_values, $prev_field, $field);
246
-  $field['widget'] = $widget;
242
+    // Merge default values, previous values, and current values to create
243
+    // a complete field array.
244
+    $widget = array_merge($default_values['widget'], $prev_field['widget'], $field['widget']);
245
+    $field = array_merge($default_values, $prev_field, $field);
246
+    $field['widget'] = $widget;
247 247
 
248
-  // Make sure we know what module to invoke for field info.
249
-  if (empty($field['module']) && !empty($field['type'])) {
248
+    // Make sure we know what module to invoke for field info.
249
+    if (empty($field['module']) && !empty($field['type'])) {
250 250
     $field_types = _content_field_types();
251 251
     $field['module'] = $field_types[$field['type']]['module'];
252
-  }
252
+    }
253 253
 
254
-  // The storage type may need to be updated.
255
-  $field['db_storage'] = content_storage_type($field);
254
+    // The storage type may need to be updated.
255
+    $field['db_storage'] = content_storage_type($field);
256 256
 
257
-  // Get a fresh copy of the column information whenever a field is created.
258
-  $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field);
257
+    // Get a fresh copy of the column information whenever a field is created.
258
+    $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field);
259 259
 
260
-  if (empty($prev_field['widget']) || $prior_instances < 1) {
260
+    if (empty($prev_field['widget']) || $prior_instances < 1) {
261 261
     // If this is the first instance, create the field.
262 262
     $field['db_storage'] = $field['multiple'] > 0 ? CONTENT_DB_STORAGE_PER_FIELD : CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
263 263
     _content_field_write($field, 'create');
264
-  }
265
-  elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) {
264
+    }
265
+    elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) {
266 266
     // If the database storage has changed, update the field and previous instances.
267 267
     $field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
268 268
 
269 269
     foreach ($prior_instances as $instance) {
270
-      $new_instance = $instance;
271
-      $new_instance['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
270
+        $new_instance = $instance;
271
+        $new_instance['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
272 272
 
273
-      // Invoke hook_content_fieldapi().
274
-      module_invoke_all('content_fieldapi', 'update instance', $new_instance);
273
+        // Invoke hook_content_fieldapi().
274
+        module_invoke_all('content_fieldapi', 'update instance', $new_instance);
275 275
 
276
-      content_alter_schema($instance, $new_instance);
276
+        content_alter_schema($instance, $new_instance);
277
+    }
277 278
     }
278
-  }
279 279
 
280
-  // Invoke hook_content_fieldapi().
281
-  module_invoke_all('content_fieldapi', 'create instance', $field);
280
+    // Invoke hook_content_fieldapi().
281
+    module_invoke_all('content_fieldapi', 'create instance', $field);
282 282
 
283
-  // Update the field and the instance with the latest values.
284
-  _content_field_write($field, 'update');
285
-  _content_field_instance_write($field, 'create');
283
+    // Update the field and the instance with the latest values.
284
+    _content_field_write($field, 'update');
285
+    _content_field_instance_write($field, 'create');
286 286
 
287
-  content_alter_schema(array(), $field);
287
+    content_alter_schema(array(), $field);
288 288
 
289
-  if ($rebuild) {
289
+    if ($rebuild) {
290 290
     content_clear_type_cache(TRUE);
291 291
     menu_rebuild();
292
-  }
292
+    }
293 293
 
294
-  return $field;
294
+    return $field;
295 295
 }
296 296
 
297 297
 /**
@@ -319,44 +319,44 @@  discard block
 block discarded – undo
319 319
  * @see menu_rebuild()
320 320
  */
321 321
 function content_field_instance_update($field, $rebuild = TRUE) {
322
-  include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
322
+    include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
323 323
 
324
-  // Ensure the field description is in the 'expanded' form.
325
-  $field = content_field_instance_expand($field);
324
+    // Ensure the field description is in the 'expanded' form.
325
+    $field = content_field_instance_expand($field);
326 326
 
327
-  // Get the previous value from the table.
328
-  $previous = content_field_instance_read(array('field_name' => $field['field_name'], 'type_name' => $field['type_name']));
329
-  $prev_field = array_pop($previous);
327
+    // Get the previous value from the table.
328
+    $previous = content_field_instance_read(array('field_name' => $field['field_name'], 'type_name' => $field['type_name']));
329
+    $prev_field = array_pop($previous);
330 330
 
331
-  // Create a complete field array by merging the previous and current values,
332
-  // letting the current values overwrite the previous ones.
333
-  $widget = array_merge($prev_field['widget'], $field['widget']);
334
-  $field = array_merge($prev_field, $field);
335
-  $field['widget'] = $widget;
331
+    // Create a complete field array by merging the previous and current values,
332
+    // letting the current values overwrite the previous ones.
333
+    $widget = array_merge($prev_field['widget'], $field['widget']);
334
+    $field = array_merge($prev_field, $field);
335
+    $field['widget'] = $widget;
336 336
 
337
-  // Make sure we know what module to invoke for field info.
338
-  if (empty($field['module']) && !empty($field['type'])) {
337
+    // Make sure we know what module to invoke for field info.
338
+    if (empty($field['module']) && !empty($field['type'])) {
339 339
     $field_types = _content_field_types();
340 340
     $field['module'] = $field_types[$field['type']]['module'];
341
-  }
341
+    }
342 342
 
343
-  // The storage type may need to be updated.
344
-  $field['db_storage'] = content_storage_type($field);
343
+    // The storage type may need to be updated.
344
+    $field['db_storage'] = content_storage_type($field);
345 345
 
346
-  // Changes in field values may affect columns, or column
347
-  // information may have changed, get a fresh copy.
348
-  $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field);
346
+    // Changes in field values may affect columns, or column
347
+    // information may have changed, get a fresh copy.
348
+    $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field);
349 349
 
350
-  // If the database storage has changed, update the field and previous instances.
351
-  $prior_instances = content_field_instance_read(array('field_name' => $field['field_name']));
350
+    // If the database storage has changed, update the field and previous instances.
351
+    $prior_instances = content_field_instance_read(array('field_name' => $field['field_name']));
352 352
 
353
-  if ($prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 1) {
353
+    if ($prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 1) {
354 354
     // Update the field's data storage.
355 355
     $field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
356 356
 
357 357
     // Update the schema for prior instances to adapt to the change in db storage.
358 358
     foreach ($prior_instances as $instance) {
359
-      if ($instance['type_name'] != $field['type_name']) {
359
+        if ($instance['type_name'] != $field['type_name']) {
360 360
         $new_instance = $instance;
361 361
         $new_instance['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
362 362
 
@@ -364,30 +364,30 @@  discard block
 block discarded – undo
364 364
         module_invoke_all('content_fieldapi', 'update instance', $new_instance);
365 365
 
366 366
         content_alter_schema($instance, $new_instance);
367
-      }
367
+        }
368
+    }
368 369
     }
369
-  }
370 370
 
371
-  // Invoke hook_content_fieldapi().
372
-  module_invoke_all('content_fieldapi', 'update instance', $field);
371
+    // Invoke hook_content_fieldapi().
372
+    module_invoke_all('content_fieldapi', 'update instance', $field);
373 373
 
374
-  // Update the field and the instance with the latest values.
375
-  _content_field_write($field, 'update');
376
-  _content_field_instance_write($field, 'update');
374
+    // Update the field and the instance with the latest values.
375
+    _content_field_write($field, 'update');
376
+    _content_field_instance_write($field, 'update');
377 377
 
378
-  content_alter_schema($prev_field, $field);
378
+    content_alter_schema($prev_field, $field);
379 379
 
380
-  if ($rebuild) {
380
+    if ($rebuild) {
381 381
     content_clear_type_cache(TRUE);
382 382
 
383 383
     // The label is in the menu tree, so we need a menu rebuild
384 384
     // if the label changes.
385 385
     if ($prev_field['widget']['label'] != $field['widget']['label']) {
386
-      menu_rebuild();
386
+        menu_rebuild();
387
+    }
387 388
     }
388
-  }
389 389
 
390
-  return $field;
390
+    return $field;
391 391
 }
392 392
 
393 393
 /**
@@ -397,30 +397,30 @@  discard block
 block discarded – undo
397 397
  *   The field array to process.
398 398
  */
399 399
 function _content_field_write($field, $op = 'update') {
400
-  // Rearrange the data to create the global_settings array.
401
-  $field['global_settings'] = array();
402
-  $setting_names = (array) module_invoke($field['module'], 'field_settings', 'save', $field);
403
-  drupal_alter('field_settings', $setting_names, 'save', $field);
400
+    // Rearrange the data to create the global_settings array.
401
+    $field['global_settings'] = array();
402
+    $setting_names = (array) module_invoke($field['module'], 'field_settings', 'save', $field);
403
+    drupal_alter('field_settings', $setting_names, 'save', $field);
404 404
 
405
-  foreach ($setting_names as $setting) {
405
+    foreach ($setting_names as $setting) {
406 406
     // Unlike _content_field_instance_write() and 'widget_settings', 'global_settings'
407 407
     // is never preexisting, so we take no particular precautions here.
408 408
     $field['global_settings'][$setting] = isset($field[$setting]) ? $field[$setting] : '';
409 409
     unset($field[$setting]);
410
-  }
411
-  // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'.
412
-  $field['db_columns'] = $field['columns'];
410
+    }
411
+    // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'.
412
+    $field['db_columns'] = $field['columns'];
413 413
 
414
-  switch ($op) {
414
+    switch ($op) {
415 415
     case 'create':
416 416
       drupal_write_record(content_field_tablename(), $field);
417
-      break;
417
+        break;
418 418
     case 'update':
419 419
       drupal_write_record(content_field_tablename(), $field, 'field_name');
420
-      break;
421
-  }
422
-  unset($field['db_columns']);
423
-  return $field;
420
+        break;
421
+    }
422
+    unset($field['db_columns']);
423
+    return $field;
424 424
 }
425 425
 
426 426
 /**
@@ -430,32 +430,32 @@  discard block
 block discarded – undo
430 430
  *   The field array to process.
431 431
  */
432 432
 function _content_field_instance_write($field, $op = 'update') {
433
-  // Collapse the field => widget format, so that the values to be saved by
434
-  // drupal_write_record are on top-level.
435
-  $field = content_field_instance_collapse($field);
436
-
437
-  // Rearrange the data to create the widget_settings array.
438
-  $setting_names = (array) module_invoke($field['widget_module'], 'widget_settings', 'save', $field);
439
-  drupal_alter('widget_settings', $setting_names, 'save', $field);
440
-  foreach ($setting_names as $setting) {
433
+    // Collapse the field => widget format, so that the values to be saved by
434
+    // drupal_write_record are on top-level.
435
+    $field = content_field_instance_collapse($field);
436
+
437
+    // Rearrange the data to create the widget_settings array.
438
+    $setting_names = (array) module_invoke($field['widget_module'], 'widget_settings', 'save', $field);
439
+    drupal_alter('widget_settings', $setting_names, 'save', $field);
440
+    foreach ($setting_names as $setting) {
441 441
     // In some cases (when the updated $field was originally read from
442 442
     // the db, as opposed to gathered from the values of a form), the values
443 443
     // are already in the right place, we take care to not wipe them.
444 444
     if (isset($field[$setting])) {
445
-      $field['widget_settings'][$setting] = $field[$setting];
446
-      unset($field[$setting]);
445
+        $field['widget_settings'][$setting] = $field[$setting];
446
+        unset($field[$setting]);
447
+    }
447 448
     }
448
-  }
449 449
 
450
-  switch ($op) {
450
+    switch ($op) {
451 451
     case 'create':
452 452
       drupal_write_record(content_instance_tablename(), $field);
453
-      break;
453
+        break;
454 454
     case 'update':
455 455
       drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name'));
456
-      break;
457
-  }
458
-  return $field;
456
+        break;
457
+    }
458
+    return $field;
459 459
 }
460 460
 
461 461
 /**
@@ -473,30 +473,30 @@  discard block
 block discarded – undo
473 473
  *   The field arrays.
474 474
  */
475 475
 function content_field_instance_read($param = NULL, $include_inactive = FALSE) {
476
-  $cond = array();
477
-  $args = array();
478
-  if (is_array($param)) {
476
+    $cond = array();
477
+    $args = array();
478
+    if (is_array($param)) {
479 479
     // Turn the conditions into a query.
480 480
     foreach ($param as $key => $value) {
481
-      $cond[] = 'nfi.'. db_escape_string($key) ." = '%s'";
482
-      $args[] = $value;
481
+        $cond[] = 'nfi.'. db_escape_string($key) ." = '%s'";
482
+        $args[] = $value;
483
+    }
483 484
     }
484
-  }
485
-  if (!$include_inactive) {
485
+    if (!$include_inactive) {
486 486
     $cond[] = 'nf.active = 1';
487 487
     $cond[] = 'nfi.widget_active = 1';
488
-  }
489
-  $where = $cond ? ' WHERE '. implode(' AND ', $cond) : '';
488
+    }
489
+    $where = $cond ? ' WHERE '. implode(' AND ', $cond) : '';
490 490
 
491
-  $db_result = db_query("SELECT * FROM {". content_instance_tablename() ."} nfi ".
491
+    $db_result = db_query("SELECT * FROM {". content_instance_tablename() ."} nfi ".
492 492
     " JOIN {". content_field_tablename() ."} nf ON nfi.field_name = nf.field_name ".
493 493
     "$where ORDER BY nfi.weight ASC, nfi.label ASC", $args);
494 494
 
495
-  $fields = array();
496
-  while ($instance = db_fetch_array($db_result)) {
495
+    $fields = array();
496
+    while ($instance = db_fetch_array($db_result)) {
497 497
     // Unserialize arrays.
498 498
     foreach (array('widget_settings', 'display_settings', 'global_settings', 'db_columns') as $key) {
499
-      $instance[$key] = (!empty($instance[$key])) ? (array) unserialize($instance[$key]) : array();
499
+        $instance[$key] = (!empty($instance[$key])) ? (array) unserialize($instance[$key]) : array();
500 500
     }
501 501
     // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'.
502 502
     $instance['columns'] = $instance['db_columns'];
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
     // Unfold 'global_settings'.
506 506
     foreach ($instance['global_settings'] as $key => $value) {
507
-      $instance[$key] = $value;
507
+        $instance[$key] = $value;
508 508
     }
509 509
     unset($instance['global_settings']);
510 510
 
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
     // Invoke hook_content_fieldapi().
516 516
     module_invoke_all('content_fieldapi', 'read instance', $field);
517 517
     $fields[] = $field;
518
-  }
519
-  return $fields;
518
+    }
519
+    return $fields;
520 520
 }
521 521
 
522 522
 /**
@@ -544,26 +544,26 @@  discard block
 block discarded – undo
544 544
  * @see menu_rebuild()
545 545
  */
546 546
 function content_field_instance_delete($field_name, $type_name, $rebuild = TRUE) {
547
-  include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
547
+    include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
548 548
 
549
-  // Get the previous field value.
550
-  $field = array_pop(content_field_instance_read(array('field_name' => $field_name, 'type_name' => $type_name)));
549
+    // Get the previous field value.
550
+    $field = array_pop(content_field_instance_read(array('field_name' => $field_name, 'type_name' => $type_name)));
551 551
 
552
-  // Invoke hook_content_fieldapi().
553
-  module_invoke_all('content_fieldapi', 'delete instance', $field);
552
+    // Invoke hook_content_fieldapi().
553
+    module_invoke_all('content_fieldapi', 'delete instance', $field);
554 554
 
555
-  db_query("DELETE FROM {". content_instance_tablename() .
555
+    db_query("DELETE FROM {". content_instance_tablename() .
556 556
     "} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
557 557
 
558
-  // If no instances remain, delete the field entirely.
559
-  $instances = content_field_instance_read(array('field_name' => $field_name));
560
-  if (sizeof($instances) < 1) {
558
+    // If no instances remain, delete the field entirely.
559
+    $instances = content_field_instance_read(array('field_name' => $field_name));
560
+    if (sizeof($instances) < 1) {
561 561
     db_query("DELETE FROM {". content_field_tablename() ."} WHERE field_name = '%s'", $field['field_name']);
562 562
     content_alter_schema($field, array());
563
-  }
564
-  // If only one instance remains, we may need to change the database
565
-  // representation for this field.
566
-  elseif (sizeof($instances) == 1 && !($field['multiple'])) {
563
+    }
564
+    // If only one instance remains, we may need to change the database
565
+    // representation for this field.
566
+    elseif (sizeof($instances) == 1 && !($field['multiple'])) {
567 567
     // Multiple-valued fields are always stored per-field-type.
568 568
     $instance = $instances[0];
569 569
     $new_instance = $instance;
@@ -571,23 +571,23 @@  discard block
 block discarded – undo
571 571
     _content_field_write($new_instance, 'update');
572 572
 
573 573
     content_alter_schema($instance, $new_instance);
574
-  }
574
+    }
575 575
 
576
-  // If the deleted instance was the last field for the content type,
577
-  // we drop the per-type table. We also consider possibly inactive fields.
578
-  if (!content_field_instance_read(array('type_name' => $field['type_name']), TRUE)) {
576
+    // If the deleted instance was the last field for the content type,
577
+    // we drop the per-type table. We also consider possibly inactive fields.
578
+    if (!content_field_instance_read(array('type_name' => $field['type_name']), TRUE)) {
579 579
     $base_tablename = _content_tablename($field['type_name'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
580 580
     if (db_table_exists($base_tablename)) {
581
-      db_drop_table($ret, $base_tablename);
581
+        db_drop_table($ret, $base_tablename);
582
+    }
582 583
     }
583
-  }
584 584
 
585
-  if ($rebuild) {
585
+    if ($rebuild) {
586 586
     content_clear_type_cache(TRUE);
587 587
     menu_rebuild();
588
-  }
588
+    }
589 589
 
590
-  return $field;
590
+    return $field;
591 591
 }
592 592
 
593 593
 /**
@@ -596,18 +596,18 @@  discard block
 block discarded – undo
596 596
  * @param string $module
597 597
  */
598 598
 function content_module_delete($module) {
599
-  // Delete the field data.
600
-  // If content module has been uninstalled first, all tables
601
-  // have already been dropped, and running that code will raise errors.
602
-  if (db_table_exists(content_instance_tablename())) {
599
+    // Delete the field data.
600
+    // If content module has been uninstalled first, all tables
601
+    // have already been dropped, and running that code will raise errors.
602
+    if (db_table_exists(content_instance_tablename())) {
603 603
     $results = db_query("SELECT field_name, type_name FROM {". content_instance_tablename() ."} WHERE widget_module = '%s'", $module);
604 604
     while ($field = db_fetch_array($results)) {
605
-      content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
605
+        content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
606 606
     }
607 607
     // Force the caches and static arrays to update to the new info.
608 608
     content_clear_type_cache(TRUE);
609 609
     menu_rebuild();
610
-  }
610
+    }
611 611
 }
612 612
 
613 613
 /**
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
  * content_clear_type_cache() can do its job properly.
622 622
  */
623 623
 function content_type_create($info) {
624
-  node_get_types(NULL, NULL, TRUE);
625
-  content_clear_type_cache(TRUE);
624
+    node_get_types(NULL, NULL, TRUE);
625
+    content_clear_type_cache(TRUE);
626 626
 }
627 627
 
628 628
 /**
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
  *   value supplied by hook_node_type()
633 633
  */
634 634
 function content_type_update($info) {
635
-  if (!empty($info->old_type) && $info->old_type != $info->type) {
635
+    if (!empty($info->old_type) && $info->old_type != $info->type) {
636 636
     // Rename the content type in all fields that use changed content type.
637 637
     db_query("UPDATE {". content_instance_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
638 638
 
@@ -641,23 +641,23 @@  discard block
 block discarded – undo
641 641
     $old_name = _content_tablename($old_type['type'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
642 642
     $new_name = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
643 643
     if (db_table_exists($old_name)) {
644
-      $ret = array();
645
-      db_rename_table($ret, $old_name, $new_name);
646
-      watchdog('content', 'Content fields table %old_name has been renamed to %new_name and field instances have been updated.', array(
644
+        $ret = array();
645
+        db_rename_table($ret, $old_name, $new_name);
646
+        watchdog('content', 'Content fields table %old_name has been renamed to %new_name and field instances have been updated.', array(
647 647
         '%old_name' => $old_name, '%new_name' => $new_name));
648 648
     }
649 649
 
650 650
     // Rename the variable storing weights for non-CCK fields.
651 651
     if ($extra = variable_get('content_extra_weights_'. $info->old_type, array())) {
652
-      variable_set('content_extra_weights_'. $info->type, $extra);
653
-      variable_del('content_extra_weights_'. $info->old_type);
652
+        variable_set('content_extra_weights_'. $info->type, $extra);
653
+        variable_del('content_extra_weights_'. $info->old_type);
654
+    }
654 655
     }
655
-  }
656 656
 
657
-  // Reset all content type info.
658
-  // Menu needs to be rebuilt as well, but node types need to be rebuilt first.
659
-  // node_type_form_submit() takes care of this.
660
-  content_clear_type_cache(TRUE);
657
+    // Reset all content type info.
658
+    // Menu needs to be rebuilt as well, but node types need to be rebuilt first.
659
+    // node_type_form_submit() takes care of this.
660
+    content_clear_type_cache(TRUE);
661 661
 }
662 662
 
663 663
 /**
@@ -672,24 +672,24 @@  discard block
 block discarded – undo
672 672
  *
673 673
  */
674 674
 function content_type_delete($info) {
675
-  // Don't delete data for content-types defined by disabled modules.
676
-  if (!empty($info->disabled)) {
675
+    // Don't delete data for content-types defined by disabled modules.
676
+    if (!empty($info->disabled)) {
677 677
     return;
678
-  }
678
+    }
679 679
 
680
-  // TODO : What about inactive fields ?
681
-  // Currently, content_field_instance_delete doesn't work on those...
682
-  $fields = content_field_instance_read(array('type_name' => $info->type));
683
-  foreach ($fields as $field) {
680
+    // TODO : What about inactive fields ?
681
+    // Currently, content_field_instance_delete doesn't work on those...
682
+    $fields = content_field_instance_read(array('type_name' => $info->type));
683
+    foreach ($fields as $field) {
684 684
     content_field_instance_delete($field['field_name'], $info->type, FALSE);
685
-  }
686
-  $table = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
687
-  if (db_table_exists($table)) {
685
+    }
686
+    $table = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
687
+    if (db_table_exists($table)) {
688 688
     $ret = array();
689 689
     db_drop_table($ret, $table);
690 690
     watchdog('content', 'The content fields table %name has been deleted.', array('%name' => $table));
691
-  }
692
-  // Menu needs to be rebuilt as well, but node types need to be rebuilt first.
693
-  // node_type_form_submit() takes care of this.
694
-  content_clear_type_cache(TRUE);
691
+    }
692
+    // Menu needs to be rebuilt as well, but node types need to be rebuilt first.
693
+    // node_type_form_submit() takes care of this.
694
+    content_clear_type_cache(TRUE);
695 695
 }
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
   $field['db_columns'] = $field['columns'];
413 413
 
414 414
   switch ($op) {
415
-    case 'create':
416
-      drupal_write_record(content_field_tablename(), $field);
417
-      break;
418
-    case 'update':
419
-      drupal_write_record(content_field_tablename(), $field, 'field_name');
420
-      break;
415
+  case 'create':
416
+    drupal_write_record(content_field_tablename(), $field);
417
+    break;
418
+  case 'update':
419
+    drupal_write_record(content_field_tablename(), $field, 'field_name');
420
+    break;
421 421
   }
422 422
   unset($field['db_columns']);
423 423
   return $field;
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
   }
449 449
 
450 450
   switch ($op) {
451
-    case 'create':
452
-      drupal_write_record(content_instance_tablename(), $field);
453
-      break;
454
-    case 'update':
455
-      drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name'));
456
-      break;
451
+  case 'create':
452
+    drupal_write_record(content_instance_tablename(), $field);
453
+    break;
454
+  case 'update':
455
+    drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name'));
456
+    break;
457 457
   }
458 458
   return $field;
459 459
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     $field['active'] = 1;
43 43
   }
44 44
 
45
-  $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field);
45
+  $field['columns'] = (array)module_invoke($module, 'field_settings', 'database columns', $field);
46 46
   // Ensure columns always default to NULL values.
47 47
   foreach ($field['columns'] as $column_name => $column) {
48 48
     $field['columns'][$column_name]['not null'] = FALSE;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
   $field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
54 54
 
55 55
   // Make sure field settings all have an index in the array.
56
-  $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field);
56
+  $setting_names = (array)module_invoke($module, 'field_settings', 'save', $field);
57 57
   drupal_alter('field_settings', $setting_names, 'save', $field);
58 58
   foreach ($setting_names as $setting) {
59 59
     $field[$setting] = NULL;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
   }
93 93
 
94 94
   // Make sure widget settings all have an index in the array.
95
-  $settings_names = (array) module_invoke($module, 'widget_settings', 'save', $widget);
95
+  $settings_names = (array)module_invoke($module, 'widget_settings', 'save', $widget);
96 96
   drupal_alter('widget_settings', $settings_names, 'save', $widget);
97 97
   $widget['widget_settings'] = array();
98 98
   foreach ($settings_names as $name) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
   // initialize $widget_settings with default values,
134 134
   if (isset($field['default_value']) && isset($field['default_value_php']) &&
135 135
       content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) {
136
-    $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value']  : NULL;
136
+    $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value'] : NULL;
137 137
     $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : NULL;
138 138
     unset($field['default_value']);
139 139
     unset($field['default_value_php']);
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
  * @see menu_rebuild()
209 209
  */
210 210
 function content_field_instance_create($field, $rebuild = TRUE) {
211
-  include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
211
+  include_once('./'.drupal_get_path('module', 'content').'/includes/content.admin.inc');
212 212
 
213 213
   $form_values = $field;
214 214
   $field = content_field_instance_expand($field);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
   $field['db_storage'] = content_storage_type($field);
256 256
 
257 257
   // Get a fresh copy of the column information whenever a field is created.
258
-  $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field);
258
+  $field['columns'] = (array)module_invoke($field['module'], 'field_settings', 'database columns', $field);
259 259
 
260 260
   if (empty($prev_field['widget']) || $prior_instances < 1) {
261 261
     // If this is the first instance, create the field.
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  * @see menu_rebuild()
320 320
  */
321 321
 function content_field_instance_update($field, $rebuild = TRUE) {
322
-  include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
322
+  include_once('./'.drupal_get_path('module', 'content').'/includes/content.admin.inc');
323 323
 
324 324
   // Ensure the field description is in the 'expanded' form.
325 325
   $field = content_field_instance_expand($field);
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
   // Changes in field values may affect columns, or column
347 347
   // information may have changed, get a fresh copy.
348
-  $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field);
348
+  $field['columns'] = (array)module_invoke($field['module'], 'field_settings', 'database columns', $field);
349 349
 
350 350
   // If the database storage has changed, update the field and previous instances.
351 351
   $prior_instances = content_field_instance_read(array('field_name' => $field['field_name']));
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 function _content_field_write($field, $op = 'update') {
400 400
   // Rearrange the data to create the global_settings array.
401 401
   $field['global_settings'] = array();
402
-  $setting_names = (array) module_invoke($field['module'], 'field_settings', 'save', $field);
402
+  $setting_names = (array)module_invoke($field['module'], 'field_settings', 'save', $field);
403 403
   drupal_alter('field_settings', $setting_names, 'save', $field);
404 404
 
405 405
   foreach ($setting_names as $setting) {
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
   $field = content_field_instance_collapse($field);
436 436
 
437 437
   // Rearrange the data to create the widget_settings array.
438
-  $setting_names = (array) module_invoke($field['widget_module'], 'widget_settings', 'save', $field);
438
+  $setting_names = (array)module_invoke($field['widget_module'], 'widget_settings', 'save', $field);
439 439
   drupal_alter('widget_settings', $setting_names, 'save', $field);
440 440
   foreach ($setting_names as $setting) {
441 441
     // In some cases (when the updated $field was originally read from
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
   if (is_array($param)) {
479 479
     // Turn the conditions into a query.
480 480
     foreach ($param as $key => $value) {
481
-      $cond[] = 'nfi.'. db_escape_string($key) ." = '%s'";
481
+      $cond[] = 'nfi.'.db_escape_string($key)." = '%s'";
482 482
       $args[] = $value;
483 483
     }
484 484
   }
@@ -486,17 +486,17 @@  discard block
 block discarded – undo
486 486
     $cond[] = 'nf.active = 1';
487 487
     $cond[] = 'nfi.widget_active = 1';
488 488
   }
489
-  $where = $cond ? ' WHERE '. implode(' AND ', $cond) : '';
489
+  $where = $cond ? ' WHERE '.implode(' AND ', $cond) : '';
490 490
 
491
-  $db_result = db_query("SELECT * FROM {". content_instance_tablename() ."} nfi ".
492
-    " JOIN {". content_field_tablename() ."} nf ON nfi.field_name = nf.field_name ".
491
+  $db_result = db_query("SELECT * FROM {".content_instance_tablename()."} nfi ".
492
+    " JOIN {".content_field_tablename()."} nf ON nfi.field_name = nf.field_name ".
493 493
     "$where ORDER BY nfi.weight ASC, nfi.label ASC", $args);
494 494
 
495 495
   $fields = array();
496 496
   while ($instance = db_fetch_array($db_result)) {
497 497
     // Unserialize arrays.
498 498
     foreach (array('widget_settings', 'display_settings', 'global_settings', 'db_columns') as $key) {
499
-      $instance[$key] = (!empty($instance[$key])) ? (array) unserialize($instance[$key]) : array();
499
+      $instance[$key] = (!empty($instance[$key])) ? (array)unserialize($instance[$key]) : array();
500 500
     }
501 501
     // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'.
502 502
     $instance['columns'] = $instance['db_columns'];
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
  * @see menu_rebuild()
545 545
  */
546 546
 function content_field_instance_delete($field_name, $type_name, $rebuild = TRUE) {
547
-  include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
547
+  include_once('./'.drupal_get_path('module', 'content').'/includes/content.admin.inc');
548 548
 
549 549
   // Get the previous field value.
550 550
   $field = array_pop(content_field_instance_read(array('field_name' => $field_name, 'type_name' => $type_name)));
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
   // Invoke hook_content_fieldapi().
553 553
   module_invoke_all('content_fieldapi', 'delete instance', $field);
554 554
 
555
-  db_query("DELETE FROM {". content_instance_tablename() .
555
+  db_query("DELETE FROM {".content_instance_tablename().
556 556
     "} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
557 557
 
558 558
   // If no instances remain, delete the field entirely.
559 559
   $instances = content_field_instance_read(array('field_name' => $field_name));
560 560
   if (sizeof($instances) < 1) {
561
-    db_query("DELETE FROM {". content_field_tablename() ."} WHERE field_name = '%s'", $field['field_name']);
561
+    db_query("DELETE FROM {".content_field_tablename()."} WHERE field_name = '%s'", $field['field_name']);
562 562
     content_alter_schema($field, array());
563 563
   }
564 564
   // If only one instance remains, we may need to change the database
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
   // If content module has been uninstalled first, all tables
601 601
   // have already been dropped, and running that code will raise errors.
602 602
   if (db_table_exists(content_instance_tablename())) {
603
-    $results = db_query("SELECT field_name, type_name FROM {". content_instance_tablename() ."} WHERE widget_module = '%s'", $module);
603
+    $results = db_query("SELECT field_name, type_name FROM {".content_instance_tablename()."} WHERE widget_module = '%s'", $module);
604 604
     while ($field = db_fetch_array($results)) {
605 605
       content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
606 606
     }
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 function content_type_update($info) {
635 635
   if (!empty($info->old_type) && $info->old_type != $info->type) {
636 636
     // Rename the content type in all fields that use changed content type.
637
-    db_query("UPDATE {". content_instance_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
637
+    db_query("UPDATE {".content_instance_tablename()."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
638 638
 
639 639
     // Rename the content fields table to match new content type name.
640 640
     $old_type = content_types($info->old_type);
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
     }
649 649
 
650 650
     // Rename the variable storing weights for non-CCK fields.
651
-    if ($extra = variable_get('content_extra_weights_'. $info->old_type, array())) {
652
-      variable_set('content_extra_weights_'. $info->type, $extra);
653
-      variable_del('content_extra_weights_'. $info->old_type);
651
+    if ($extra = variable_get('content_extra_weights_'.$info->old_type, array())) {
652
+      variable_set('content_extra_weights_'.$info->type, $extra);
653
+      variable_del('content_extra_weights_'.$info->old_type);
654 654
     }
655 655
   }
656 656
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -117,8 +117,7 @@  discard block
 block discarded – undo
117 117
     $field['widget']['type'] = $field['widget_type'];
118 118
     $widget_types = _content_widget_types();
119 119
     $field['widget']['module'] = isset($widget_types[$field['widget_type']]['module']) ? $widget_types[$field['widget_type']]['module'] : $field['widget_module'];
120
-  }
121
-  elseif (!empty($field['widget_module'])) {
120
+  } elseif (!empty($field['widget_module'])) {
122 121
     $field['widget']['module'] = $field['widget_module'];
123 122
   }
124 123
 
@@ -157,12 +156,10 @@  discard block
 block discarded – undo
157 156
 
158 157
   if (!empty($field['widget']['module'])) {
159 158
     $widget_module = $field['widget']['module'];
160
-  }
161
-  elseif (!empty($field['widget']['type'])) {
159
+  } elseif (!empty($field['widget']['type'])) {
162 160
     $widget_types = _content_widget_types();
163 161
     $widget_module = $widget_types[$field['widget']['type']]['module'];
164
-  }
165
-  else {
162
+  } else {
166 163
     $widget_module = '';
167 164
   }
168 165
   $field['widget_module'] = $widget_module;
@@ -226,8 +223,7 @@  discard block
 block discarded – undo
226 223
     $field['widget']['weight'] = isset($form_values['weight']) ? $form_values['weight'] : $prev_field['widget']['weight'];
227 224
     $field['widget']['label']  = isset($form_values['label']) ? $form_values['label'] : $prev_field['widget']['label'];
228 225
     $field['widget']['description'] = isset($form_values['description']) ? $form_values['description'] : $prev_field['widget']['description'];
229
-  }
230
-  else {
226
+  } else {
231 227
     $prev_field = array('widget' => array());
232 228
   }
233 229
 
@@ -261,8 +257,7 @@  discard block
 block discarded – undo
261 257
     // If this is the first instance, create the field.
262 258
     $field['db_storage'] = $field['multiple'] > 0 ? CONTENT_DB_STORAGE_PER_FIELD : CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
263 259
     _content_field_write($field, 'create');
264
-  }
265
-  elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) {
260
+  } elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) {
266 261
     // If the database storage has changed, update the field and previous instances.
267 262
     $field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
268 263
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
   $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field);
46 46
   // Ensure columns always default to NULL values.
47 47
   foreach ($field['columns'] as $column_name => $column) {
48
-    $field['columns'][$column_name]['not null'] = FALSE;
48
+    $field['columns'][$column_name]['not null'] = false;
49 49
   }
50 50
 
51 51
   $field['required'] = 0;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
   $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field);
57 57
   drupal_alter('field_settings', $setting_names, 'save', $field);
58 58
   foreach ($setting_names as $setting) {
59
-    $field[$setting] = NULL;
59
+    $field[$setting] = null;
60 60
   }
61 61
   return $field;
62 62
 }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
   drupal_alter('widget_settings', $settings_names, 'save', $widget);
97 97
   $widget['widget_settings'] = array();
98 98
   foreach ($settings_names as $name) {
99
-    $widget['widget_settings'][$name] = NULL;
99
+    $widget['widget_settings'][$name] = null;
100 100
   }
101 101
   return $widget;
102 102
 }
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
   // initialize $widget_settings with default values,
134 134
   if (isset($field['default_value']) && isset($field['default_value_php']) &&
135 135
       content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) {
136
-    $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value']  : NULL;
137
-    $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : NULL;
136
+    $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value']  : null;
137
+    $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : null;
138 138
     unset($field['default_value']);
139 139
     unset($field['default_value_php']);
140 140
   }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
  * @see content_clear_type_cache()
208 208
  * @see menu_rebuild()
209 209
  */
210
-function content_field_instance_create($field, $rebuild = TRUE) {
210
+function content_field_instance_create($field, $rebuild = true) {
211 211
   include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
212 212
 
213 213
   $form_values = $field;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
   content_alter_schema(array(), $field);
288 288
 
289 289
   if ($rebuild) {
290
-    content_clear_type_cache(TRUE);
290
+    content_clear_type_cache(true);
291 291
     menu_rebuild();
292 292
   }
293 293
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
  * @see content_clear_type_cache()
319 319
  * @see menu_rebuild()
320 320
  */
321
-function content_field_instance_update($field, $rebuild = TRUE) {
321
+function content_field_instance_update($field, $rebuild = true) {
322 322
   include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
323 323
 
324 324
   // Ensure the field description is in the 'expanded' form.
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
   content_alter_schema($prev_field, $field);
379 379
 
380 380
   if ($rebuild) {
381
-    content_clear_type_cache(TRUE);
381
+    content_clear_type_cache(true);
382 382
 
383 383
     // The label is in the menu tree, so we need a menu rebuild
384 384
     // if the label changes.
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
  * @return
473 473
  *   The field arrays.
474 474
  */
475
-function content_field_instance_read($param = NULL, $include_inactive = FALSE) {
475
+function content_field_instance_read($param = null, $include_inactive = false) {
476 476
   $cond = array();
477 477
   $args = array();
478 478
   if (is_array($param)) {
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
  * @see content_clear_type_cache()
544 544
  * @see menu_rebuild()
545 545
  */
546
-function content_field_instance_delete($field_name, $type_name, $rebuild = TRUE) {
546
+function content_field_instance_delete($field_name, $type_name, $rebuild = true) {
547 547
   include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');
548 548
 
549 549
   // Get the previous field value.
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
   // If the deleted instance was the last field for the content type,
577 577
   // we drop the per-type table. We also consider possibly inactive fields.
578
-  if (!content_field_instance_read(array('type_name' => $field['type_name']), TRUE)) {
578
+  if (!content_field_instance_read(array('type_name' => $field['type_name']), true)) {
579 579
     $base_tablename = _content_tablename($field['type_name'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
580 580
     if (db_table_exists($base_tablename)) {
581 581
       db_drop_table($ret, $base_tablename);
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
   }
584 584
 
585 585
   if ($rebuild) {
586
-    content_clear_type_cache(TRUE);
586
+    content_clear_type_cache(true);
587 587
     menu_rebuild();
588 588
   }
589 589
 
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
   if (db_table_exists(content_instance_tablename())) {
603 603
     $results = db_query("SELECT field_name, type_name FROM {". content_instance_tablename() ."} WHERE widget_module = '%s'", $module);
604 604
     while ($field = db_fetch_array($results)) {
605
-      content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
605
+      content_field_instance_delete($field['field_name'], $field['type_name'], false);
606 606
     }
607 607
     // Force the caches and static arrays to update to the new info.
608
-    content_clear_type_cache(TRUE);
608
+    content_clear_type_cache(true);
609 609
     menu_rebuild();
610 610
   }
611 611
 }
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
  * content_clear_type_cache() can do its job properly.
622 622
  */
623 623
 function content_type_create($info) {
624
-  node_get_types(NULL, NULL, TRUE);
625
-  content_clear_type_cache(TRUE);
624
+  node_get_types(null, null, true);
625
+  content_clear_type_cache(true);
626 626
 }
627 627
 
628 628
 /**
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
   // Reset all content type info.
658 658
   // Menu needs to be rebuilt as well, but node types need to be rebuilt first.
659 659
   // node_type_form_submit() takes care of this.
660
-  content_clear_type_cache(TRUE);
660
+  content_clear_type_cache(true);
661 661
 }
662 662
 
663 663
 /**
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
   // Currently, content_field_instance_delete doesn't work on those...
682 682
   $fields = content_field_instance_read(array('type_name' => $info->type));
683 683
   foreach ($fields as $field) {
684
-    content_field_instance_delete($field['field_name'], $info->type, FALSE);
684
+    content_field_instance_delete($field['field_name'], $info->type, false);
685 685
   }
686 686
   $table = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
687 687
   if (db_table_exists($table)) {
@@ -691,5 +691,5 @@  discard block
 block discarded – undo
691 691
   }
692 692
   // Menu needs to be rebuilt as well, but node types need to be rebuilt first.
693 693
   // node_type_form_submit() takes care of this.
694
-  content_clear_type_cache(TRUE);
694
+  content_clear_type_cache(true);
695 695
 }
Please login to merge, or discard this patch.
default/boinc/modules/contrib/cck/includes/views/content.views_convert.inc 4 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@  discard block
 block discarded – undo
14 14
  * the right results, usually needed to set field options or values.
15 15
  */
16 16
 function content_views_convert($display, $type, &$view, $views_field) {
17
-  static $views_fields;
17
+    static $views_fields;
18 18
 
19
-  if (empty($views_fields)) {
19
+    if (empty($views_fields)) {
20 20
     $views_fields = array();
21 21
     $types = content_types();
22 22
     foreach ($types as $ctype) {
23
-      foreach ($ctype['fields'] as $field) {
23
+        foreach ($ctype['fields'] as $field) {
24 24
         $module = $field['module'];
25 25
         $result = (array) module_invoke($module, 'field_settings', 'views data', $field);
26 26
         drupal_alter('field_settings', $result, 'views data', $field);
27 27
         if (empty($result)) {
28
-          // The views field name had the column name appended,
29
-          // like field_name_value or field_username_uid.
30
-          $column = array_shift(array_keys($field['columns']));
31
-          $views_fields[$field['field_name'] .'_'. $column] = $field;
28
+            // The views field name had the column name appended,
29
+            // like field_name_value or field_username_uid.
30
+            $column = array_shift(array_keys($field['columns']));
31
+            $views_fields[$field['field_name'] .'_'. $column] = $field;
32 32
         }
33
-      }
33
+        }
34
+    }
34 35
     }
35
-  }
36 36
 
37
-  // Is this a field that CCK should handle? If not, return.
38
-  if (!in_array($views_field['field'], array_keys($views_fields))) {
37
+    // Is this a field that CCK should handle? If not, return.
38
+    if (!in_array($views_field['field'], array_keys($views_fields))) {
39 39
     return;
40
-  }
40
+    }
41 41
 
42
-  // Now update values, options, etc. to those selected in the imported view.
43
-  switch ($type) {
42
+    // Now update values, options, etc. to those selected in the imported view.
43
+    switch ($type) {
44 44
     case 'field':
45 45
       $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options'];
46
-      if ($views_field['handler'] == 'content_views_field_handler_group') {
46
+        if ($views_field['handler'] == 'content_views_field_handler_group') {
47 47
         $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1;
48
-      }
49
-      else {
48
+        }
49
+        else {
50 50
         $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0;
51
-      }
52
-      return;
51
+        }
52
+        return;
53 53
 
54 54
     case 'filter':
55 55
       // TODO
@@ -67,6 +67,6 @@  discard block
 block discarded – undo
67 67
       // TODO
68 68
       break;
69 69
 
70
-  }
71
-  return;
70
+    }
71
+    return;
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,31 +41,31 @@
 block discarded – undo
41 41
 
42 42
   // Now update values, options, etc. to those selected in the imported view.
43 43
   switch ($type) {
44
-    case 'field':
45
-      $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options'];
46
-      if ($views_field['handler'] == 'content_views_field_handler_group') {
47
-        $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1;
48
-      }
49
-      else {
50
-        $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0;
51
-      }
52
-      return;
44
+  case 'field':
45
+    $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options'];
46
+    if ($views_field['handler'] == 'content_views_field_handler_group') {
47
+      $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1;
48
+    }
49
+    else {
50
+      $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0;
51
+    }
52
+    return;
53 53
 
54
-    case 'filter':
55
-      // TODO
56
-      return;
54
+  case 'filter':
55
+    // TODO
56
+    return;
57 57
 
58
-    case 'exposed_filter':
59
-      // TODO
60
-      return;
58
+  case 'exposed_filter':
59
+    // TODO
60
+    return;
61 61
 
62
-    case 'argument':
63
-      // TODO
64
-      return;
62
+  case 'argument':
63
+    // TODO
64
+    return;
65 65
 
66
-    case 'sort':
67
-      // TODO
68
-      break;
66
+  case 'sort':
67
+    // TODO
68
+    break;
69 69
 
70 70
   }
71 71
   return;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
     foreach ($types as $ctype) {
23 23
       foreach ($ctype['fields'] as $field) {
24 24
         $module = $field['module'];
25
-        $result = (array) module_invoke($module, 'field_settings', 'views data', $field);
25
+        $result = (array)module_invoke($module, 'field_settings', 'views data', $field);
26 26
         drupal_alter('field_settings', $result, 'views data', $field);
27 27
         if (empty($result)) {
28 28
           // The views field name had the column name appended,
29 29
           // like field_name_value or field_username_uid.
30 30
           $column = array_shift(array_keys($field['columns']));
31
-          $views_fields[$field['field_name'] .'_'. $column] = $field;
31
+          $views_fields[$field['field_name'].'_'.$column] = $field;
32 32
         }
33 33
       }
34 34
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
45 45
       $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options'];
46 46
       if ($views_field['handler'] == 'content_views_field_handler_group') {
47 47
         $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1;
48
-      }
49
-      else {
48
+      } else {
50 49
         $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0;
51 50
       }
52 51
       return;
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/cck/includes/views/content.views.inc 5 patches
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
  * Implementation of hook_views_handlers().
17 17
  */
18 18
 function content_views_handlers() {
19
-  return array(
19
+    return array(
20 20
     'info' => array(
21
-      'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
21
+        'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
22 22
     ),
23 23
     'handlers' => array(
24 24
 
25
-      // argument handlers
26
-      'content_handler_argument' => array(
25
+        // argument handlers
26
+        'content_handler_argument' => array(
27 27
         'parent' => 'views_handler_argument',
28
-      ),
29
-      'content_handler_argument_string' => array(
28
+        ),
29
+        'content_handler_argument_string' => array(
30 30
         'parent' => 'views_handler_argument_string',
31
-      ),
32
-      'content_handler_argument_numeric' => array(
31
+        ),
32
+        'content_handler_argument_numeric' => array(
33 33
         'parent' => 'views_handler_argument_numeric',
34
-      ),
35
-      'content_handler_argument_reference' => array(
34
+        ),
35
+        'content_handler_argument_reference' => array(
36 36
         'parent' => 'content_handler_argument_numeric',
37
-      ),
38
-      'content_handler_argument_many_to_one' => array(
37
+        ),
38
+        'content_handler_argument_many_to_one' => array(
39 39
         'parent' => 'views_handler_argument_many_to_one',
40
-      ),
40
+        ),
41 41
 
42
-      // field handlers
43
-      'content_handler_field' => array(
42
+        // field handlers
43
+        'content_handler_field' => array(
44 44
         'parent' => 'views_handler_field_node',
45
-      ),
46
-      'content_handler_field_multiple' => array(
45
+        ),
46
+        'content_handler_field_multiple' => array(
47 47
         'parent' => 'content_handler_field',
48
-      ),
48
+        ),
49 49
 
50
-      // filter handlers
51
-      'content_handler_filter_string' => array(
50
+        // filter handlers
51
+        'content_handler_filter_string' => array(
52 52
         'parent' => 'views_handler_filter_string',
53
-      ),
54
-      'content_handler_filter_numeric' => array(
53
+        ),
54
+        'content_handler_filter_numeric' => array(
55 55
         'parent' => 'views_handler_filter_numeric',
56
-      ),
57
-      'content_handler_filter_float' => array(
56
+        ),
57
+        'content_handler_filter_float' => array(
58 58
         'parent' => 'views_handler_filter_float',
59
-      ),
60
-      'content_handler_filter_many_to_one' => array(
59
+        ),
60
+        'content_handler_filter_many_to_one' => array(
61 61
         'parent' => 'views_handler_filter_many_to_one',
62
-      ),
62
+        ),
63 63
 
64
-      // relationship handlers
65
-      'content_handler_relationship' => array(
64
+        // relationship handlers
65
+        'content_handler_relationship' => array(
66 66
         'parent' => 'views_handler_relationship',
67
-      ),
67
+        ),
68 68
 
69
-      // sort handlers
70
-      'content_handler_sort' => array(
69
+        // sort handlers
70
+        'content_handler_sort' => array(
71 71
         'parent' => 'views_handler_sort',
72
-      ),
72
+        ),
73 73
     ),
74
-  );
74
+    );
75 75
 }
76 76
 
77 77
 /**
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
  * nodereference and userreference.
82 82
  */
83 83
 function content_views_plugins() {
84
-  $plugins = array(
84
+    $plugins = array(
85 85
     'module' => 'content', // This just tells our themes are elsewhere.
86 86
     'display' => array(
87
-      'content_simple' => array(
87
+        'content_simple' => array(
88 88
         'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
89 89
         // Those strings are not translated for now.
90 90
         // We'll need to change that if / when we remove 'no ui'
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
         'use ajax' => FALSE,
97 97
         'use pager' => FALSE,
98 98
         'accept attachments' => FALSE,
99
-      ),
100
-      'content_references' => array(
99
+        ),
100
+        'content_references' => array(
101 101
         'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
102 102
         // Those strings are not translated for now.
103 103
         // We'll need to change that if / when we remove 'no ui'
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
         'use ajax' => FALSE,
111 111
         'use pager' => FALSE,
112 112
         'accept attachments' => FALSE,
113
-      ),
113
+        ),
114 114
     ),
115 115
     'style' => array(
116
-      'content_php_array_autocomplete' => array(
116
+        'content_php_array_autocomplete' => array(
117 117
         'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
118 118
         // Those strings are not translated for now.
119 119
         // We'll need to change that if / when we remove 'no ui'
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
         'uses fields' => TRUE,
126 126
         'type' => 'content_simple',
127 127
         'even empty' => TRUE,
128
-      ),
128
+        ),
129 129
     ),
130
-  );
131
-  return $plugins;
130
+    );
131
+    return $plugins;
132 132
 }
133 133
 
134 134
 /**
@@ -137,187 +137,187 @@  discard block
 block discarded – undo
137 137
  * Exposes all fields to the views system.
138 138
  */
139 139
 function content_views_data() {
140
-  $data = array();
141
-  foreach (content_fields() as $field) {
140
+    $data = array();
141
+    foreach (content_fields() as $field) {
142 142
     $module = $field['module'];
143 143
     $result = (array) module_invoke($module, 'field_settings', 'views data', $field);
144 144
     drupal_alter('field_settings', $result, 'views data', $field);
145 145
     if (empty($result)) {
146
-      $result = content_views_field_views_data($field);
146
+        $result = content_views_field_views_data($field);
147 147
     }
148 148
     if (is_array($result)) {
149
-      $data = array_merge($data, $result);
149
+        $data = array_merge($data, $result);
150
+    }
150 151
     }
151
-  }
152
-  return $data;
152
+    return $data;
153 153
 }
154 154
 
155 155
 
156 156
 function content_views_field_views_data($field) {
157
-  $field_types = _content_field_types();
157
+    $field_types = _content_field_types();
158 158
 
159
-  // Check the field module is available.
160
-  // TODO: is this really how we should do it ?
161
-  if (isset($field_types[$field['type']])) {
159
+    // Check the field module is available.
160
+    // TODO: is this really how we should do it ?
161
+    if (isset($field_types[$field['type']])) {
162 162
     $db_info = content_database_info($field);
163 163
 
164 164
     // Field modules that do not store data in the database
165 165
     // should not create views data tables.
166 166
     if (empty($db_info['columns'])) {
167
-      return;
167
+        return;
168 168
     }
169 169
 
170 170
     $table_alias = content_views_tablename($field);
171 171
 
172 172
     $types = array();
173 173
     foreach (content_types() as $type) {
174
-      if (isset($type['fields'][$field['field_name']])) {
174
+        if (isset($type['fields'][$field['field_name']])) {
175 175
         // TODO : run check_plain here instead of on the imploded string below ?
176 176
         $types[] = $type['name'];
177
-      }
177
+        }
178 178
     }
179 179
 
180 180
     $data = array();
181 181
     $data['table']['group']  = t('Content');
182 182
     $data['table']['join']['node'] = array(
183
-      'table' => $db_info['table'],
184
-      'left_field' => 'vid',
185
-      'field' => 'vid',
183
+        'table' => $db_info['table'],
184
+        'left_field' => 'vid',
185
+        'field' => 'vid',
186 186
     );
187 187
     $data['table']['join']['node_revisions'] = array(
188
-      'table' => $db_info['table'],
189
-      'left_field' => 'vid',
190
-      'field' => 'vid',
188
+        'table' => $db_info['table'],
189
+        'left_field' => 'vid',
190
+        'field' => 'vid',
191 191
     );
192 192
 
193 193
     // Build the list of columns enabled for default views integration.
194 194
     $db_columns = array();
195 195
     $additional_fields = array();
196 196
     foreach ($db_info['columns'] as $column => $attributes) {
197
-      // Select explicitly enabled field columns.
198
-      if (!empty($attributes['views'])) {
197
+        // Select explicitly enabled field columns.
198
+        if (!empty($attributes['views'])) {
199 199
         $db_columns[$column] = $attributes;
200
-      }
201
-      // Ensure all columns are retrieved.
202
-      $additional_fields[$attributes['column']] = $attributes['column'];
200
+        }
201
+        // Ensure all columns are retrieved.
202
+        $additional_fields[$attributes['column']] = $attributes['column'];
203 203
     }
204 204
     // Pick up the first column when none has been explicitly enabled
205 205
     // (pre CCK 2.2 backwards compatibility).
206 206
     if (empty($db_columns)) {
207
-      // Can't use array_slice(), it won't work in PHP4 for assoc array.
208
-      foreach ($db_info['columns'] as $column => $attributes) {
207
+        // Can't use array_slice(), it won't work in PHP4 for assoc array.
208
+        foreach ($db_info['columns'] as $column => $attributes) {
209 209
         $db_columns[$column] = $attributes;
210 210
         break;
211
-      }
211
+        }
212 212
     }
213 213
     $columns = array();
214 214
     $db_fields = array();
215 215
     $arguments = array();
216 216
     $filters = array();
217 217
     foreach ($db_columns as $column => $attributes) {
218
-      $columns[] = $column;
219
-      $db_fields[] = $attributes['column'];
220
-      $sorts[] = !empty($attributes['sortable']) ? TRUE : FALSE;
218
+        $columns[] = $column;
219
+        $db_fields[] = $attributes['column'];
220
+        $sorts[] = !empty($attributes['sortable']) ? TRUE : FALSE;
221 221
 
222
-      // Identify likely filters and arguments for each column based on field type.
223
-      switch ($attributes['type']) {
222
+        // Identify likely filters and arguments for each column based on field type.
223
+        switch ($attributes['type']) {
224 224
         case 'int':
225 225
         case 'mediumint':
226 226
         case 'tinyint':
227 227
         case 'bigint':
228 228
         case 'serial':
229 229
           $filters[] = 'content_handler_filter_numeric';
230
-          $arguments[] = 'content_handler_argument_numeric';
231
-          break;
230
+            $arguments[] = 'content_handler_argument_numeric';
231
+            break;
232 232
         case 'numeric':
233 233
         case 'float':
234 234
           $filters[] = 'content_handler_filter_float';
235
-          $arguments[] = 'content_handler_argument_numeric';
236
-          break;
235
+            $arguments[] = 'content_handler_argument_numeric';
236
+            break;
237 237
 
238 238
         case 'text':
239 239
         case 'blob':
240 240
           // TODO add markup handlers for these types
241 241
         default:
242 242
           $filters[] = 'content_handler_filter_string';
243
-          $arguments[] = 'content_handler_argument_string';
244
-          break;
245
-      }
243
+            $arguments[] = 'content_handler_argument_string';
244
+            break;
245
+        }
246 246
     }
247 247
 
248 248
     // Provide automatic filters, sorts, and arguments for each column, not just the first.
249 249
     $db_fields_count = count($db_fields);
250 250
     foreach ($db_fields as $i => $db_field) {
251
-      $label_truncated = truncate_utf8(t($field['widget']['label']), 10, TRUE);
252
-      if ($db_fields_count == 1) {
251
+        $label_truncated = truncate_utf8(t($field['widget']['label']), 10, TRUE);
252
+        if ($db_fields_count == 1) {
253 253
         $title = t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
254 254
         $title_short = check_plain($label_truncated);
255
-      }
256
-      else {
255
+        }
256
+        else {
257 257
         $title = t('@label (!name) - !column', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'], '!column' => $columns[$i]));
258 258
         $title_short = t('@label-truncated - !column', array('@label-truncated' => $label_truncated, '!column' => $columns[$i]));
259
-      }
259
+        }
260 260
 
261
-      $data[$db_field] = array(
261
+        $data[$db_field] = array(
262 262
         'group' => t('Content'),
263 263
         'title' => $title,
264 264
         'title short' => $title_short,
265 265
         'help' =>  t($field_types[$field['type']]['label']) .' - '. t('Appears in: @types', array('@types' => implode(', ', $types))),
266
-      );
267
-      if ($i == 0) {
266
+        );
267
+        if ($i == 0) {
268 268
         $data[$db_field]['field'] = array(
269
-          'title' => t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])),
270
-          'title short' => check_plain($label_truncated),
271
-          'field' => $db_field,
272
-          'table' => $db_info['table'],
273
-          'handler' => 'content_handler_field_multiple',
274
-          'click sortable' => $sorts[$i],
275
-          'additional fields' => $additional_fields,
276
-          'content_field_name' => $field['field_name'],
277
-          'access callback' => 'content_access',
278
-          'access arguments' => array('view', $field),
269
+            'title' => t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])),
270
+            'title short' => check_plain($label_truncated),
271
+            'field' => $db_field,
272
+            'table' => $db_info['table'],
273
+            'handler' => 'content_handler_field_multiple',
274
+            'click sortable' => $sorts[$i],
275
+            'additional fields' => $additional_fields,
276
+            'content_field_name' => $field['field_name'],
277
+            'access callback' => 'content_access',
278
+            'access arguments' => array('view', $field),
279 279
         );
280
-      }
281
-      $data[$db_field]['argument'] = array(
280
+        }
281
+        $data[$db_field]['argument'] = array(
282 282
         'field' => $db_field,
283 283
         'table' => $db_info['table'],
284 284
         'handler' => $arguments[$i],
285 285
         'additional fields' => $additional_fields,
286 286
         'content_field_name' => $field['field_name'],
287 287
         'empty field name' => t('<No value>'),
288
-      );
289
-      $data[$db_field]['filter'] = array(
288
+        );
289
+        $data[$db_field]['filter'] = array(
290 290
         'field' => $db_field,
291 291
         'table' => $db_info['table'],
292 292
         'handler' => $filters[$i],
293 293
         'additional fields' => $additional_fields,
294 294
         'content_field_name' => $field['field_name'],
295 295
         'allow empty' => TRUE,
296
-      );
297
-      if (!empty($sorts[$i])) {
296
+        );
297
+        if (!empty($sorts[$i])) {
298 298
         $data[$db_field]['sort'] = array(
299
-          'field' => $db_field,
300
-          'table' => $db_info['table'],
301
-          'handler' => 'content_handler_sort',
302
-          'additional fields' => $additional_fields,
303
-          'content_field_name' => $field['field_name'],
299
+            'field' => $db_field,
300
+            'table' => $db_info['table'],
301
+            'handler' => 'content_handler_sort',
302
+            'additional fields' => $additional_fields,
303
+            'content_field_name' => $field['field_name'],
304 304
         );
305
-      }
305
+        }
306 306
     }
307 307
 
308 308
     // Expose additional delta column for multiple value fields.
309 309
     if ($field['multiple']) {
310
-      $title = t('@label (!name) - delta', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
311
-      $title_short = t('@label-truncated - delta', array('@label-truncated' => $label_truncated));
310
+        $title = t('@label (!name) - delta', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
311
+        $title_short = t('@label-truncated - delta', array('@label-truncated' => $label_truncated));
312 312
 
313
-      $db_field = 'delta';
314
-      $data[$db_field] = array(
313
+        $db_field = 'delta';
314
+        $data[$db_field] = array(
315 315
         'group' => t('Content'),
316 316
         'title' => $title,
317 317
         'title short' => $title_short,
318 318
         'help' => t('Delta - Appears in: @types', array('@types' => implode(', ', $types))),
319
-      );
320
-      $data[$db_field]['field'] = array(
319
+        );
320
+        $data[$db_field]['field'] = array(
321 321
         'title' => $title,
322 322
         'title short' => $title_short,
323 323
         'field' => $db_field,
@@ -327,31 +327,31 @@  discard block
 block discarded – undo
327 327
         'additional fields' => $additional_fields,
328 328
         'access callback' => 'content_access',
329 329
         'access arguments' => array('view', $field),
330
-      );
331
-      $data[$db_field]['argument'] = array(
330
+        );
331
+        $data[$db_field]['argument'] = array(
332 332
         'field' => $db_field,
333 333
         'table' => $db_info['table'],
334 334
         'handler' => 'views_handler_argument_numeric',
335 335
         'additional fields' => $additional_fields,
336 336
         'empty field name' => t('<No value>'),
337
-      );
338
-      $data[$db_field]['filter'] = array(
337
+        );
338
+        $data[$db_field]['filter'] = array(
339 339
         'field' => $db_field,
340 340
         'table' => $db_info['table'],
341 341
         'handler' => 'views_handler_filter_numeric',
342 342
         'additional fields' => $additional_fields,
343 343
         'allow empty' => TRUE,
344
-      );
345
-      $data[$db_field]['sort'] = array(
344
+        );
345
+        $data[$db_field]['sort'] = array(
346 346
         'field' => $db_field,
347 347
         'table' => $db_info['table'],
348 348
         'handler' => 'views_handler_sort',
349 349
         'additional fields' => $additional_fields,
350
-      );
350
+        );
351 351
     }
352 352
 
353 353
     return array($table_alias => $data);
354
-  }
354
+    }
355 355
 }
356 356
 
357 357
 /**
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
  * in the future without re-writing code.
360 360
  */
361 361
 function content_views_tablename($field) {
362
-  return 'node_data_'. $field['field_name'];
362
+    return 'node_data_'. $field['field_name'];
363 363
 }
364 364
 
365 365
 function theme_content_view_multiple_field($items, $field, $values) {
366
-  $output = '';
367
-  $i = 0;
368
-  foreach ($items as $item) {
366
+    $output = '';
367
+    $i = 0;
368
+    foreach ($items as $item) {
369 369
     if (!empty($item) || $item == '0') {
370
-      $output .= '<div class="field-item field-item-'. $i .'">'. $item .'</div>';
371
-      $i++;
370
+        $output .= '<div class="field-item field-item-'. $i .'">'. $item .'</div>';
371
+        $i++;
372
+    }
372 373
     }
373
-  }
374
-  return $output;
374
+    return $output;
375 375
 }
376 376
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -221,27 +221,27 @@
 block discarded – undo
221 221
 
222 222
       // Identify likely filters and arguments for each column based on field type.
223 223
       switch ($attributes['type']) {
224
-        case 'int':
225
-        case 'mediumint':
226
-        case 'tinyint':
227
-        case 'bigint':
228
-        case 'serial':
229
-          $filters[] = 'content_handler_filter_numeric';
230
-          $arguments[] = 'content_handler_argument_numeric';
231
-          break;
232
-        case 'numeric':
233
-        case 'float':
234
-          $filters[] = 'content_handler_filter_float';
235
-          $arguments[] = 'content_handler_argument_numeric';
236
-          break;
224
+      case 'int':
225
+      case 'mediumint':
226
+      case 'tinyint':
227
+      case 'bigint':
228
+      case 'serial':
229
+        $filters[] = 'content_handler_filter_numeric';
230
+        $arguments[] = 'content_handler_argument_numeric';
231
+        break;
232
+      case 'numeric':
233
+      case 'float':
234
+        $filters[] = 'content_handler_filter_float';
235
+        $arguments[] = 'content_handler_argument_numeric';
236
+        break;
237 237
 
238
-        case 'text':
239
-        case 'blob':
240
-          // TODO add markup handlers for these types
241
-        default:
242
-          $filters[] = 'content_handler_filter_string';
243
-          $arguments[] = 'content_handler_argument_string';
244
-          break;
238
+      case 'text':
239
+      case 'blob':
240
+        // TODO add markup handlers for these types
241
+      default:
242
+        $filters[] = 'content_handler_filter_string';
243
+        $arguments[] = 'content_handler_argument_string';
244
+        break;
245 245
       }
246 246
     }
247 247
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 function content_views_handlers() {
19 19
   return array(
20 20
     'info' => array(
21
-      'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
21
+      'path' => drupal_get_path('module', 'content').'/includes/views/handlers',
22 22
     ),
23 23
     'handlers' => array(
24 24
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     'module' => 'content', // This just tells our themes are elsewhere.
86 86
     'display' => array(
87 87
       'content_simple' => array(
88
-        'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
88
+        'path' => drupal_get_path('module', 'content').'/includes/views/handlers',
89 89
         // Those strings are not translated for now.
90 90
         // We'll need to change that if / when we remove 'no ui'
91 91
         'title' => 'Simple', // TODO: better name ? (currently not displayed anyway)
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         'accept attachments' => FALSE,
99 99
       ),
100 100
       'content_references' => array(
101
-        'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
101
+        'path' => drupal_get_path('module', 'content').'/includes/views/handlers',
102 102
         // Those strings are not translated for now.
103 103
         // We'll need to change that if / when we remove 'no ui'
104 104
         'title' => 'Simple - for reference fields', // TODO: better name ? (currently not displayed anyway)
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     ),
115 115
     'style' => array(
116 116
       'content_php_array_autocomplete' => array(
117
-        'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
117
+        'path' => drupal_get_path('module', 'content').'/includes/views/handlers',
118 118
         // Those strings are not translated for now.
119 119
         // We'll need to change that if / when we remove 'no ui'
120 120
         'title' => 'Results array (with title)',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
   $data = array();
141 141
   foreach (content_fields() as $field) {
142 142
     $module = $field['module'];
143
-    $result = (array) module_invoke($module, 'field_settings', 'views data', $field);
143
+    $result = (array)module_invoke($module, 'field_settings', 'views data', $field);
144 144
     drupal_alter('field_settings', $result, 'views data', $field);
145 145
     if (empty($result)) {
146 146
       $result = content_views_field_views_data($field);
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     $data = array();
181
-    $data['table']['group']  = t('Content');
181
+    $data['table']['group'] = t('Content');
182 182
     $data['table']['join']['node'] = array(
183 183
       'table' => $db_info['table'],
184 184
       'left_field' => 'vid',
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         'group' => t('Content'),
263 263
         'title' => $title,
264 264
         'title short' => $title_short,
265
-        'help' =>  t($field_types[$field['type']]['label']) .' - '. t('Appears in: @types', array('@types' => implode(', ', $types))),
265
+        'help' =>  t($field_types[$field['type']]['label']).' - '.t('Appears in: @types', array('@types' => implode(', ', $types))),
266 266
       );
267 267
       if ($i == 0) {
268 268
         $data[$db_field]['field'] = array(
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
  * in the future without re-writing code.
360 360
  */
361 361
 function content_views_tablename($field) {
362
-  return 'node_data_'. $field['field_name'];
362
+  return 'node_data_'.$field['field_name'];
363 363
 }
364 364
 
365 365
 function theme_content_view_multiple_field($items, $field, $values) {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
   $i = 0;
368 368
   foreach ($items as $item) {
369 369
     if (!empty($item) || $item == '0') {
370
-      $output .= '<div class="field-item field-item-'. $i .'">'. $item .'</div>';
370
+      $output .= '<div class="field-item field-item-'.$i.'">'.$item.'</div>';
371 371
       $i++;
372 372
     }
373 373
   }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,8 +252,7 @@
 block discarded – undo
252 252
       if ($db_fields_count == 1) {
253 253
         $title = t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
254 254
         $title_short = check_plain($label_truncated);
255
-      }
256
-      else {
255
+      } else {
257 256
         $title = t('@label (!name) - !column', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'], '!column' => $columns[$i]));
258 257
         $title_short = t('@label-truncated - !column', array('@label-truncated' => $label_truncated, '!column' => $columns[$i]));
259 258
       }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
         'title' => 'Simple', // TODO: better name ? (currently not displayed anyway)
92 92
         'help' => 'Destination-agnostic display. Mostly useful for programmatic views.',
93 93
         'handler' => 'content_plugin_display_simple',
94
-        'no ui' => TRUE, // Programmatic use only.
95
-        'uses hook menu' => FALSE,
96
-        'use ajax' => FALSE,
97
-        'use pager' => FALSE,
98
-        'accept attachments' => FALSE,
94
+        'no ui' => true, // Programmatic use only.
95
+        'uses hook menu' => false,
96
+        'use ajax' => false,
97
+        'use pager' => false,
98
+        'accept attachments' => false,
99 99
       ),
100 100
       'content_references' => array(
101 101
         'path' => drupal_get_path('module', 'content') . '/includes/views/handlers',
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
         'help' => 'Destination-agnostic display. Mostly useful for programmatic views.',
106 106
         'parent' => 'content_simple',
107 107
         'handler' => 'content_plugin_display_references',
108
-        'no ui' => TRUE, // Programmatic use only.
109
-        'uses hook menu' => FALSE,
110
-        'use ajax' => FALSE,
111
-        'use pager' => FALSE,
112
-        'accept attachments' => FALSE,
108
+        'no ui' => true, // Programmatic use only.
109
+        'uses hook menu' => false,
110
+        'use ajax' => false,
111
+        'use pager' => false,
112
+        'accept attachments' => false,
113 113
       ),
114 114
     ),
115 115
     'style' => array(
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
         'title' => 'Results array (with title)',
121 121
         'help' => 'Returns the view as a PHP array of names + rendered rows.',
122 122
         'handler' => 'content_plugin_style_php_array_ac',
123
-        'no ui' => TRUE, // Programmatic use only.
124
-        'uses row plugin' => TRUE,
125
-        'uses fields' => TRUE,
123
+        'no ui' => true, // Programmatic use only.
124
+        'uses row plugin' => true,
125
+        'uses fields' => true,
126 126
         'type' => 'content_simple',
127
-        'even empty' => TRUE,
127
+        'even empty' => true,
128 128
       ),
129 129
     ),
130 130
   );
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     foreach ($db_columns as $column => $attributes) {
218 218
       $columns[] = $column;
219 219
       $db_fields[] = $attributes['column'];
220
-      $sorts[] = !empty($attributes['sortable']) ? TRUE : FALSE;
220
+      $sorts[] = !empty($attributes['sortable']) ? true : false;
221 221
 
222 222
       // Identify likely filters and arguments for each column based on field type.
223 223
       switch ($attributes['type']) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     // Provide automatic filters, sorts, and arguments for each column, not just the first.
249 249
     $db_fields_count = count($db_fields);
250 250
     foreach ($db_fields as $i => $db_field) {
251
-      $label_truncated = truncate_utf8(t($field['widget']['label']), 10, TRUE);
251
+      $label_truncated = truncate_utf8(t($field['widget']['label']), 10, true);
252 252
       if ($db_fields_count == 1) {
253 253
         $title = t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
254 254
         $title_short = check_plain($label_truncated);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         'handler' => $filters[$i],
293 293
         'additional fields' => $additional_fields,
294 294
         'content_field_name' => $field['field_name'],
295
-        'allow empty' => TRUE,
295
+        'allow empty' => true,
296 296
       );
297 297
       if (!empty($sorts[$i])) {
298 298
         $data[$db_field]['sort'] = array(
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         'field' => $db_field,
324 324
         'table' => $db_info['table'],
325 325
         'handler' => 'views_handler_field_numeric',
326
-        'click sortable' => TRUE,
326
+        'click sortable' => true,
327 327
         'additional fields' => $additional_fields,
328 328
         'access callback' => 'content_access',
329 329
         'access arguments' => array('view', $field),
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         'table' => $db_info['table'],
341 341
         'handler' => 'views_handler_filter_numeric',
342 342
         'additional fields' => $additional_fields,
343
-        'allow empty' => TRUE,
343
+        'allow empty' => true,
344 344
       );
345 345
       $data[$db_field]['sort'] = array(
346 346
         'field' => $db_field,
Please login to merge, or discard this patch.
contrib/cck/includes/views/handlers/content_handler_relationship.inc 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,67 +7,67 @@
 block discarded – undo
7 7
  * values by allowing the views administrator to select deltas.
8 8
  */
9 9
 class content_handler_relationship extends views_handler_relationship {
10
-  var $content_field;
10
+    var $content_field;
11 11
 
12
-  function construct() {
12
+    function construct() {
13 13
     parent::construct();
14 14
 
15 15
     $this->content_field = content_fields($this->definition['content_field_name']);
16
-  }
16
+    }
17 17
 
18
-  function option_definition() {
18
+    function option_definition() {
19 19
     $options = parent::option_definition();
20 20
     $options['delta'] = array('default' => -1);
21 21
 
22 22
     return $options;
23
-  }
23
+    }
24 24
 
25
-  /**
26
-   * Add a delta selector for multiple fields.
27
-   */
28
-  function options_form(&$form, &$form_state) {
25
+    /**
26
+     * Add a delta selector for multiple fields.
27
+     */
28
+    function options_form(&$form, &$form_state) {
29 29
     $field = $this->content_field;
30 30
     parent::options_form($form, $form_state);
31 31
 
32 32
     // Only add the form gadget if the field is multiple.
33 33
     if ($field['multiple']) {
34
-      $max_delta = $field['multiple'];
35
-      // 1 means unlimited.
36
-      if ($max_delta == 1) {
34
+        $max_delta = $field['multiple'];
35
+        // 1 means unlimited.
36
+        if ($max_delta == 1) {
37 37
         $max_delta = 10;
38
-      }
38
+        }
39 39
 
40
-      $options = array('-1' => t('All'));
41
-      for ($i = 0; $i < $max_delta; $i++) {
40
+        $options = array('-1' => t('All'));
41
+        for ($i = 0; $i < $max_delta; $i++) {
42 42
         $options[$i] = $i + 1;
43
-      }
44
-      $form['delta'] = array(
43
+        }
44
+        $form['delta'] = array(
45 45
         '#type' => 'select',
46 46
         '#options' => $options,
47 47
         '#default_value' => $this->options['delta'],
48 48
         '#title' => t('Delta'),
49 49
         '#description' => t('The delta allows you to select which item in a multiple value field to key the relationship off of. Select "1" to use the first item, "2" for the second item, and so on. If you select "All", each item in the field will create a new row, which may appear to cause duplicates.'),
50
-      );
50
+        );
51
+    }
51 52
     }
52
-  }
53 53
 
54
-  function ensure_my_table() {
54
+    function ensure_my_table() {
55 55
     if (!isset($this->table_alias)) {
56
-      $join = $this->get_join();
57
-      if (!isset($join->extra)) {
56
+        $join = $this->get_join();
57
+        if (!isset($join->extra)) {
58 58
         $join->extra = array();
59
-      }
60
-      $delta = isset($this->options['delta']) ? $this->options['delta'] : -1;
61
-      if ($delta != -1) {
59
+        }
60
+        $delta = isset($this->options['delta']) ? $this->options['delta'] : -1;
61
+        if ($delta != -1) {
62 62
         $join->extra[] = array(
63
-          'field' => 'delta',
64
-          'value' => $delta,
65
-          'numeric' => TRUE,
63
+            'field' => 'delta',
64
+            'value' => $delta,
65
+            'numeric' => TRUE,
66 66
         );
67
-      }
67
+        }
68 68
 
69
-      $this->table_alias = $this->query->add_table($this->table, $this->relationship, $join);
69
+        $this->table_alias = $this->query->add_table($this->table, $this->relationship, $join);
70 70
     }
71 71
     return $this->table_alias;
72
-  }
72
+    }
73 73
 }
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         $join->extra[] = array(
63 63
           'field' => 'delta',
64 64
           'value' => $delta,
65
-          'numeric' => TRUE,
65
+          'numeric' => true,
66 66
         );
67 67
       }
68 68
 
Please login to merge, or discard this patch.
contrib/cck/includes/views/handlers/content_handler_argument_reference.inc 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
  * Provide handler to replace reference with title.
7 7
  */
8 8
 class content_handler_argument_reference extends content_handler_argument_numeric {
9
-  /**
10
-   * Override the behavior of title().
11
-   */
12
-  function title_query() {
9
+    /**
10
+     * Override the behavior of title().
11
+     */
12
+    function title_query() {
13 13
     $titles = array();
14 14
     $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
15 15
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
     $result = db_query("SELECT $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value);
20 20
     while ($row = db_fetch_object($result)) {
21
-      $titles[] = check_plain($row->title);
21
+        $titles[] = check_plain($row->title);
22 22
     }
23 23
     return $titles;
24
-  }
24
+    }
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     $table_data = views_fetch_data($this->name_table);
17 17
     $table = array_shift($table_data['table']['join']);
18 18
 
19
-    $result = db_query("SELECT $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value);
19
+    $result = db_query("SELECT $this->name_field AS title FROM {".$table['table']."} WHERE ".$table['field']." IN ($placeholders)", $this->value);
20 20
     while ($row = db_fetch_object($result)) {
21 21
       $titles[] = check_plain($row->title);
22 22
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     $table_data = views_fetch_data($this->name_table);
17 17
     $table = array_shift($table_data['table']['join']);
18 18
 
19
-    $result = db_query("SELECT $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value);
19
+    $result = db_query("select $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value);
20 20
     while ($row = db_fetch_object($result)) {
21 21
       $titles[] = check_plain($row->title);
22 22
     }
Please login to merge, or discard this patch.
contrib/cck/includes/views/handlers/content_plugin_style_php_array_ac.inc 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * Handler for 'content_php_array_autocomplete' style.
7 7
  */
8 8
 class content_plugin_style_php_array_ac extends views_plugin_style {
9
-  function render() {
9
+    function render() {
10 10
     $results = array();
11 11
 
12 12
     // Group the rows according to the grouping field, if specified.
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
     // Could be useful for select widget, though.
21 21
     $this->view->row_index = 0;
22 22
     foreach ($sets as $title => $records) {
23
-      foreach ($records as $label => $row) {
23
+        foreach ($records as $label => $row) {
24 24
         $results[$row->{$base_field}] = array(
25
-          'title' => $row->{$title_field_alias},
26
-          'rendered' => $this->row_plugin->render($row),
25
+            'title' => $row->{$title_field_alias},
26
+            'rendered' => $this->row_plugin->render($row),
27 27
         );
28 28
         $this->view->row_index++;
29
-      }
29
+        }
30 30
     }
31 31
     unset($this->view->row_index);
32 32
     return $results;
33
-  }
33
+    }
34 34
 }
Please login to merge, or discard this patch.
contrib/cck/includes/views/handlers/content_handler_argument_string.inc 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
  * for field-specific subclasses to use if they need to.
8 8
  */
9 9
 class content_handler_argument_string extends views_handler_argument_string {
10
-  var $content_field;
10
+    var $content_field;
11 11
 
12
-  function construct() {
12
+    function construct() {
13 13
     parent::construct();
14 14
 
15 15
     $this->content_field = content_fields($this->definition['content_field_name']);
16 16
     $this->additional_fields = $this->definition['additional fields'];
17
-  }
17
+    }
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
contrib/cck/includes/views/handlers/content_handler_argument_numeric.inc 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
  * for field-specific subclasses to use if they need to.
8 8
  */
9 9
 class content_handler_argument_numeric extends views_handler_argument_numeric {
10
-  var $content_field;
10
+    var $content_field;
11 11
 
12
-  function construct() {
12
+    function construct() {
13 13
     parent::construct();
14 14
 
15 15
     $this->content_field = content_fields($this->definition['content_field_name']);
16 16
     $this->additional_fields = $this->definition['additional fields'];
17
-  }
17
+    }
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
contrib/cck/includes/views/handlers/content_handler_filter_string.inc 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
  * for field-specific subclasses to use if they need to.
8 8
  */
9 9
 class content_handler_filter_string extends views_handler_filter_string {
10
-  var $content_field;
10
+    var $content_field;
11 11
 
12
-  function construct() {
12
+    function construct() {
13 13
     parent::construct();
14 14
     $this->content_field = content_fields($this->definition['content_field_name']);
15 15
     $this->additional_fields = $this->definition['additional fields'];
16
-  }
16
+    }
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.