Completed
Pull Request — master (#1862)
by Christian
09:13
created
modules/contrib/cck/modules/content_permissions/content_permissions.module 4 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
  *  Implementation of hook_perm().
6 6
  */
7 7
 function content_permissions_perm() {
8
-  $perms = array();
9
-  foreach (content_fields() as $field) {
8
+    $perms = array();
9
+    foreach (content_fields() as $field) {
10 10
     $perms[] = 'edit '. $field['field_name'];
11 11
     $perms[] = 'view '. $field['field_name'];
12
-  }
13
-  return $perms;
12
+    }
13
+    return $perms;
14 14
 }
15 15
 
16 16
 /**
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @see content_access().
20 20
  */
21 21
 function content_permissions_field_access($op, $field, $account, $node = NULL) {
22
-  switch ($op) {
22
+    switch ($op) {
23 23
     case 'view':
24 24
     case 'edit':
25 25
       return user_access($op .' '. $field['field_name'], $account);
26
-  }
27
-  return TRUE;
26
+    }
27
+    return TRUE;
28 28
 }
Please login to merge, or discard this patch.
Switch Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
  */
21 21
 function content_permissions_field_access($op, $field, $account, $node = NULL) {
22 22
   switch ($op) {
23
-    case 'view':
24
-    case 'edit':
25
-      return user_access($op .' '. $field['field_name'], $account);
23
+  case 'view':
24
+  case 'edit':
25
+    return user_access($op .' '. $field['field_name'], $account);
26 26
   }
27 27
   return TRUE;
28 28
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 function content_permissions_perm() {
8 8
   $perms = array();
9 9
   foreach (content_fields() as $field) {
10
-    $perms[] = 'edit '. $field['field_name'];
11
-    $perms[] = 'view '. $field['field_name'];
10
+    $perms[] = 'edit '.$field['field_name'];
11
+    $perms[] = 'view '.$field['field_name'];
12 12
   }
13 13
   return $perms;
14 14
 }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   switch ($op) {
23 23
     case 'view':
24 24
     case 'edit':
25
-      return user_access($op .' '. $field['field_name'], $account);
25
+      return user_access($op.' '.$field['field_name'], $account);
26 26
   }
27 27
   return TRUE;
28 28
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
  *
19 19
  * @see content_access().
20 20
  */
21
-function content_permissions_field_access($op, $field, $account, $node = NULL) {
21
+function content_permissions_field_access($op, $field, $account, $node = null) {
22 22
   switch ($op) {
23 23
     case 'view':
24 24
     case 'edit':
25 25
       return user_access($op .' '. $field['field_name'], $account);
26 26
   }
27
-  return TRUE;
27
+  return true;
28 28
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/modules/text/text.module 5 patches
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -10,101 +10,101 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_theme().
11 11
  */
12 12
 function text_theme() {
13
-  return array(
13
+    return array(
14 14
     'text_textarea' => array(
15
-      'arguments' => array('element' => NULL),
15
+        'arguments' => array('element' => NULL),
16 16
     ),
17 17
     'text_textfield' => array(
18
-      'arguments' => array('element' => NULL),
18
+        'arguments' => array('element' => NULL),
19 19
     ),
20 20
     'text_formatter_default' => array(
21
-      'arguments' => array('element' => NULL),
21
+        'arguments' => array('element' => NULL),
22 22
     ),
23 23
     'text_formatter_plain' => array(
24
-      'arguments' => array('element' => NULL),
24
+        'arguments' => array('element' => NULL),
25 25
     ),
26 26
     'text_formatter_trimmed' => array(
27
-      'arguments' => array('element' => NULL),
27
+        'arguments' => array('element' => NULL),
28 28
     ),
29 29
     'text_formatter_foo' => array(
30
-      'arguments' => array('element' => NULL),
30
+        'arguments' => array('element' => NULL),
31 31
     ),
32
-  );
32
+    );
33 33
 }
34 34
 
35 35
 /**
36 36
  * Implementation of hook_field_info().
37 37
  */
38 38
 function text_field_info() {
39
-  return array(
39
+    return array(
40 40
     'text' => array(
41
-      'label' => t('Text'),
42
-      'description' => t('Store text in the database.'),
41
+        'label' => t('Text'),
42
+        'description' => t('Store text in the database.'),
43 43
 //      'content_icon' => 'icon_content_text.png',
44 44
     ),
45
-  );
45
+    );
46 46
 }
47 47
 
48 48
 /**
49 49
  * Implementation of hook_field_settings().
50 50
  */
51 51
 function text_field_settings($op, $field) {
52
-  switch ($op) {
52
+    switch ($op) {
53 53
     case 'form':
54 54
       $form = array();
55
-      $options = array(0 => t('Plain text'), 1 => t('Filtered text (user selects input format)'));
56
-      $form['text_processing'] = array(
55
+        $options = array(0 => t('Plain text'), 1 => t('Filtered text (user selects input format)'));
56
+        $form['text_processing'] = array(
57 57
         '#type' => 'radios',
58 58
         '#title' => t('Text processing'),
59 59
         '#default_value' => is_numeric($field['text_processing']) ? $field['text_processing'] : 0,
60 60
         '#options' => $options,
61
-      );
62
-      $form['max_length'] = array(
61
+        );
62
+        $form['max_length'] = array(
63 63
         '#type' => 'textfield',
64 64
         '#title' => t('Maximum length'),
65 65
         '#default_value' => is_numeric($field['max_length']) ? $field['max_length'] : '',
66 66
         '#required' => FALSE,
67 67
         '#element_validate' => array('_element_validate_integer_positive'),
68 68
         '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'),
69
-      );
70
-      $form['allowed_values_fieldset'] = array(
69
+        );
70
+        $form['allowed_values_fieldset'] = array(
71 71
         '#type' => 'fieldset',
72 72
         '#title' => t('Allowed values'),
73 73
         '#collapsible' => TRUE,
74 74
         '#collapsed' => TRUE,
75
-      );
76
-      $form['allowed_values_fieldset']['allowed_values'] = array(
75
+        );
76
+        $form['allowed_values_fieldset']['allowed_values'] = array(
77 77
         '#type' => 'textarea',
78 78
         '#title' => t('Allowed values list'),
79 79
         '#default_value' => !empty($field['allowed_values']) ? $field['allowed_values'] : '',
80 80
         '#required' => FALSE,
81 81
         '#rows' => 10,
82 82
         '#description' => t('The possible values this field can contain. Enter one value per line, in the format key|label. The key is the value that will be stored in the database, and it must match the field storage type (%type). The label is optional, and the key will be used as the label if no label is specified.<br />Allowed HTML tags: @tags', array('%type' => $field['type'], '@tags' => _content_filter_xss_display_allowed_tags())),
83
-      );
84
-      $form['allowed_values_fieldset']['advanced_options'] = array(
83
+        );
84
+        $form['allowed_values_fieldset']['advanced_options'] = array(
85 85
         '#type' => 'fieldset',
86 86
         '#title' => t('PHP code'),
87 87
         '#collapsible' => TRUE,
88 88
         '#collapsed' => empty($field['allowed_values_php']),
89
-      );
90
-      if (user_access('Use PHP input for field settings (dangerous - grant with care)')) {
89
+        );
90
+        if (user_access('Use PHP input for field settings (dangerous - grant with care)')) {
91 91
         $form['allowed_values_fieldset']['advanced_options']['allowed_values_php'] = array(
92
-          '#type' => 'textarea',
93
-          '#title' => t('Code'),
94
-          '#default_value' => !empty($field['allowed_values_php']) ? $field['allowed_values_php'] : '',
95
-          '#rows' => 6,
96
-          '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'),
92
+            '#type' => 'textarea',
93
+            '#title' => t('Code'),
94
+            '#default_value' => !empty($field['allowed_values_php']) ? $field['allowed_values_php'] : '',
95
+            '#rows' => 6,
96
+            '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'),
97 97
         );
98
-      }
99
-      else {
98
+        }
99
+        else {
100 100
         $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array(
101
-          '#type' => 'item',
102
-          '#title' => t('Code'),
103
-          '#value' => !empty($field['allowed_values_php']) ? '<code>'. check_plain($field['allowed_values_php']) .'</code>' : t('&lt;none&gt;'),
104
-          '#description' => empty($field['allowed_values_php']) ? t("You're not allowed to input PHP code.") : t('This PHP code was set by an administrator and will override the allowed values list above.'),
101
+            '#type' => 'item',
102
+            '#title' => t('Code'),
103
+            '#value' => !empty($field['allowed_values_php']) ? '<code>'. check_plain($field['allowed_values_php']) .'</code>' : t('&lt;none&gt;'),
104
+            '#description' => empty($field['allowed_values_php']) ? t("You're not allowed to input PHP code.") : t('This PHP code was set by an administrator and will override the allowed values list above.'),
105 105
         );
106
-      }
107
-      return $form;
106
+        }
107
+        return $form;
108 108
 
109 109
     case 'save':
110 110
       return array('text_processing', 'max_length', 'allowed_values', 'allowed_values_php');
@@ -112,18 +112,18 @@  discard block
 block discarded – undo
112 112
     case 'database columns':
113 113
       if (empty($field['max_length']) || $field['max_length'] > 255) {
114 114
         $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
115
-      }
116
-      else {
115
+        }
116
+        else {
117 117
         $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
118
-      }
119
-      if (!empty($field['text_processing'])) {
118
+        }
119
+        if (!empty($field['text_processing'])) {
120 120
         $columns['format'] = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'views' => FALSE);
121
-      }
122
-      return $columns;
121
+        }
122
+        return $columns;
123 123
 
124 124
     case 'views data':
125 125
       $allowed_values = content_allowed_values($field);
126
-      if (count($allowed_values)) {
126
+        if (count($allowed_values)) {
127 127
         $data = content_views_field_views_data($field);
128 128
         $db_info = content_database_info($field);
129 129
         $table_alias = content_views_tablename($field);
@@ -137,106 +137,106 @@  discard block
 block discarded – undo
137 137
         // Argument : swap the handler to the 'many to one' operator.
138 138
         $data[$table_alias][$field['field_name'] .'_value']['argument']['handler'] = 'content_handler_argument_many_to_one';
139 139
         return $data;
140
-      }
141
-  }
140
+        }
141
+    }
142 142
 }
143 143
 
144 144
 /**
145 145
  * Implementation of hook_field().
146 146
  */
147 147
 function text_field($op, &$node, $field, &$items, $teaser, $page) {
148
-  switch ($op) {
148
+    switch ($op) {
149 149
     case 'validate':
150 150
       $allowed_values = content_allowed_values($field);
151
-      if (is_array($items)) {
151
+        if (is_array($items)) {
152 152
         foreach ($items as $delta => $item) {
153
-          $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
154
-          if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
155
-          if (!empty($item['value'])) {
153
+            $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
154
+            if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
155
+            if (!empty($item['value'])) {
156 156
             if (count($allowed_values) && !array_key_exists($item['value'], $allowed_values)) {
157
-              form_set_error($error_element, t('%name: illegal value.', array('%name' => t($field['widget']['label']))));
157
+                form_set_error($error_element, t('%name: illegal value.', array('%name' => t($field['widget']['label']))));
158 158
             }
159 159
             if (!empty($field['max_length']) && drupal_strlen($item['value']) > $field['max_length']) {
160
-              form_set_error($error_element, t('%name: the value may not be longer than %max characters.', array('%name' => $field['widget']['label'], '%max' => $field['max_length'])));
160
+                form_set_error($error_element, t('%name: the value may not be longer than %max characters.', array('%name' => $field['widget']['label'], '%max' => $field['max_length'])));
161
+            }
161 162
             }
162
-          }
163 163
         }
164
-      }
165
-      return $items;
164
+        }
165
+        return $items;
166 166
 
167 167
     case 'sanitize':
168 168
       foreach ($items as $delta => $item) {
169 169
         if (!empty($field['text_processing'])) {
170
-          $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : '';
170
+            $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : '';
171 171
         }
172 172
         else {
173
-          $text = isset($item['value']) ? check_plain($item['value']) : '';
173
+            $text = isset($item['value']) ? check_plain($item['value']) : '';
174 174
         }
175 175
         $items[$delta]['safe'] = $text;
176
-      }
177
-  }
176
+        }
177
+    }
178 178
 }
179 179
 
180 180
 /**
181 181
  * Implementation of hook_content_is_empty().
182 182
  */
183 183
 function text_content_is_empty($item, $field) {
184
-  if (empty($item['value']) && (string)$item['value'] !== '0') {
184
+    if (empty($item['value']) && (string)$item['value'] !== '0') {
185 185
     return TRUE;
186
-  }
187
-  return FALSE;
186
+    }
187
+    return FALSE;
188 188
 }
189 189
 
190 190
 /**
191 191
  * Implementation of hook_field_formatter_info().
192 192
  */
193 193
 function text_field_formatter_info() {
194
-  return array(
194
+    return array(
195 195
     'default' => array(
196
-      'label' => t('Default'),
197
-      'field types' => array('text'),
198
-      'multiple values' => CONTENT_HANDLE_CORE,
196
+        'label' => t('Default'),
197
+        'field types' => array('text'),
198
+        'multiple values' => CONTENT_HANDLE_CORE,
199 199
     ),
200 200
     'plain' => array(
201
-      'label' => t('Plain text'),
202
-      'field types' => array('text'),
203
-      'multiple values' => CONTENT_HANDLE_CORE,
201
+        'label' => t('Plain text'),
202
+        'field types' => array('text'),
203
+        'multiple values' => CONTENT_HANDLE_CORE,
204 204
     ),
205 205
     'trimmed' => array(
206
-      'label' => t('Trimmed'),
207
-      'field types' => array('text'),
208
-      'multiple values' => CONTENT_HANDLE_CORE,
206
+        'label' => t('Trimmed'),
207
+        'field types' => array('text'),
208
+        'multiple values' => CONTENT_HANDLE_CORE,
209 209
     ),
210
-  );
210
+    );
211 211
 }
212 212
 
213 213
 /**
214 214
  * Theme function for 'default' text field formatter.
215 215
  */
216 216
 function theme_text_formatter_default($element) {
217
-  return ($allowed =_text_allowed_values($element)) ? $allowed : $element['#item']['safe'];
217
+    return ($allowed =_text_allowed_values($element)) ? $allowed : $element['#item']['safe'];
218 218
 }
219 219
 
220 220
 /**
221 221
  * Theme function for 'plain' text field formatter.
222 222
  */
223 223
 function theme_text_formatter_plain($element) {
224
-  return ($allowed =_text_allowed_values($element)) ? $allowed : strip_tags($element['#item']['safe']);
224
+    return ($allowed =_text_allowed_values($element)) ? $allowed : strip_tags($element['#item']['safe']);
225 225
 }
226 226
 
227 227
 /**
228 228
  * Theme function for 'trimmed' text field formatter.
229 229
  */
230 230
 function theme_text_formatter_trimmed($element) {
231
-  $field = content_fields($element['#field_name'], $element['#type_name']);
232
-  return ($allowed =_text_allowed_values($element)) ? $allowed : node_teaser($element['#item']['safe'], $field['text_processing'] ? $element['#item']['format'] : NULL);
231
+    $field = content_fields($element['#field_name'], $element['#type_name']);
232
+    return ($allowed =_text_allowed_values($element)) ? $allowed : node_teaser($element['#item']['safe'], $field['text_processing'] ? $element['#item']['format'] : NULL);
233 233
 }
234 234
 
235 235
 function _text_allowed_values($element) {
236
-  $field = content_fields($element['#field_name'], $element['#type_name']);
237
-  if (($allowed_values = content_allowed_values($field)) && isset($allowed_values[$element['#item']['value']])) {
236
+    $field = content_fields($element['#field_name'], $element['#type_name']);
237
+    if (($allowed_values = content_allowed_values($field)) && isset($allowed_values[$element['#item']['value']])) {
238 238
     return $allowed_values[$element['#item']['value']];
239
-  }
239
+    }
240 240
 }
241 241
 
242 242
 /**
@@ -251,24 +251,24 @@  discard block
 block discarded – undo
251 251
  * differently.
252 252
  */
253 253
 function text_widget_info() {
254
-  return array(
254
+    return array(
255 255
     'text_textfield' => array(
256
-      'label' => t('Text field'),
257
-      'field types' => array('text'),
258
-      'multiple values' => CONTENT_HANDLE_CORE,
259
-      'callbacks' => array(
256
+        'label' => t('Text field'),
257
+        'field types' => array('text'),
258
+        'multiple values' => CONTENT_HANDLE_CORE,
259
+        'callbacks' => array(
260 260
         'default value' => CONTENT_CALLBACK_DEFAULT,
261
-      ),
261
+        ),
262 262
     ),
263 263
     'text_textarea' => array(
264
-      'label' => t('Text area (multiple rows)'),
265
-      'field types' => array('text'),
266
-      'multiple values' => CONTENT_HANDLE_CORE,
267
-      'callbacks' => array(
264
+        'label' => t('Text area (multiple rows)'),
265
+        'field types' => array('text'),
266
+        'multiple values' => CONTENT_HANDLE_CORE,
267
+        'callbacks' => array(
268 268
         'default value' => CONTENT_CALLBACK_DEFAULT,
269
-      ),
269
+        ),
270 270
     ),
271
-  );
271
+    );
272 272
 }
273 273
 
274 274
 /**
@@ -284,56 +284,56 @@  discard block
 block discarded – undo
284 284
  * (see nodereference and userreference).
285 285
  */
286 286
 function text_elements() {
287
-  return array(
287
+    return array(
288 288
     'text_textfield' => array(
289
-      '#input' => TRUE,
290
-      '#columns' => array('value'), '#delta' => 0,
291
-      '#process' => array('text_textfield_process'),
292
-      '#autocomplete_path' => FALSE,
289
+        '#input' => TRUE,
290
+        '#columns' => array('value'), '#delta' => 0,
291
+        '#process' => array('text_textfield_process'),
292
+        '#autocomplete_path' => FALSE,
293 293
     ),
294 294
     'text_textarea' => array(
295
-      '#input' => TRUE,
296
-      '#columns' => array('value', 'format'), '#delta' => 0,
297
-      '#process' => array('text_textarea_process'),
298
-      '#filter_value' => FILTER_FORMAT_DEFAULT,
295
+        '#input' => TRUE,
296
+        '#columns' => array('value', 'format'), '#delta' => 0,
297
+        '#process' => array('text_textarea_process'),
298
+        '#filter_value' => FILTER_FORMAT_DEFAULT,
299 299
     ),
300
-  );
300
+    );
301 301
 }
302 302
 
303 303
 /**
304 304
  * Implementation of hook_widget_settings().
305 305
  */
306 306
 function text_widget_settings($op, $widget) {
307
-  switch ($op) {
307
+    switch ($op) {
308 308
     case 'form':
309 309
       $form = array();
310
-      $rows = (isset($widget['rows']) && is_numeric($widget['rows'])) ? $widget['rows'] : 5;
311
-      $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
312
-      if ($widget['type'] == 'text_textfield') {
310
+        $rows = (isset($widget['rows']) && is_numeric($widget['rows'])) ? $widget['rows'] : 5;
311
+        $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
312
+        if ($widget['type'] == 'text_textfield') {
313 313
         $form['rows'] = array('#type' => 'hidden', '#value' => $rows);
314 314
         $form['size'] = array(
315
-          '#type' => 'textfield',
316
-          '#title' => t('Size of textfield'),
317
-          '#default_value' => $size,
318
-          '#element_validate' => array('_element_validate_integer_positive'),
319
-          '#required' => TRUE,
315
+            '#type' => 'textfield',
316
+            '#title' => t('Size of textfield'),
317
+            '#default_value' => $size,
318
+            '#element_validate' => array('_element_validate_integer_positive'),
319
+            '#required' => TRUE,
320 320
         );
321
-      }
322
-      else {
321
+        }
322
+        else {
323 323
         $form['rows'] = array(
324
-          '#type' => 'textfield',
325
-          '#title' => t('Rows'),
326
-          '#default_value' => $rows,
327
-          '#element_validate' => array('_element_validate_integer_positive'),
328
-          '#required' => TRUE,
324
+            '#type' => 'textfield',
325
+            '#title' => t('Rows'),
326
+            '#default_value' => $rows,
327
+            '#element_validate' => array('_element_validate_integer_positive'),
328
+            '#required' => TRUE,
329 329
         );
330 330
         $form['size'] = array('#type' => 'hidden', '#value' => $size);
331
-      }
332
-      return $form;
331
+        }
332
+        return $form;
333 333
 
334 334
     case 'save':
335 335
       return array('rows', 'size');
336
-  }
336
+    }
337 337
 }
338 338
 
339 339
 /**
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
  *   the form item for a single element for this field
369 369
  */
370 370
 function text_widget(&$form, &$form_state, $field, $items, $delta = 0) {
371
-  $element = array(
371
+    $element = array(
372 372
     '#type' => $field['widget']['type'],
373 373
     '#default_value' => isset($items[$delta]) ? $items[$delta] : '',
374
-  );
375
-  return $element;
374
+    );
375
+    return $element;
376 376
 }
377 377
 
378 378
 /**
@@ -384,10 +384,10 @@  discard block
 block discarded – undo
384 384
  * The $fields array is in $form['#field_info'][$element['#field_name']].
385 385
  */
386 386
 function text_textfield_process($element, $edit, $form_state, $form) {
387
-  $field = $form['#field_info'][$element['#field_name']];
388
-  $field_key = $element['#columns'][0];
389
-  $delta = $element['#delta'];
390
-  $element[$field_key] = array(
387
+    $field = $form['#field_info'][$element['#field_name']];
388
+    $field_key = $element['#columns'][0];
389
+    $delta = $element['#delta'];
390
+    $element[$field_key] = array(
391 391
     '#type' => 'textfield',
392 392
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
393 393
     '#autocomplete_path' => $element['#autocomplete_path'],
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
     '#type_name' => $element['#type_name'],
403 403
     '#delta' => $element['#delta'],
404 404
     '#columns' => $element['#columns'],
405
-  );
405
+    );
406 406
 
407
-  $element[$field_key]['#maxlength'] = !empty($field['max_length']) ? $field['max_length'] : NULL;
407
+    $element[$field_key]['#maxlength'] = !empty($field['max_length']) ? $field['max_length'] : NULL;
408 408
 
409
-  if (!empty($field['text_processing'])) {
409
+    if (!empty($field['text_processing'])) {
410 410
     $filter_key = $element['#columns'][1];
411 411
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
412 412
     $parents = array_merge($element['#parents'] , array($filter_key));
413 413
     $element[$filter_key] = filter_form($format, 1, $parents);
414
-  }
414
+    }
415 415
 
416
-  // Used so that hook_field('validate') knows where to flag an error.
417
-  $element['_error_element'] = array(
416
+    // Used so that hook_field('validate') knows where to flag an error.
417
+    $element['_error_element'] = array(
418 418
     '#type' => 'value',
419 419
     '#value' => implode('][', array_merge($element['#parents'], array($field_key))),
420
-  );
420
+    );
421 421
 
422
-  return $element;
422
+    return $element;
423 423
 }
424 424
 
425 425
 /**
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
  * The $fields array is in $form['#field_info'][$element['#field_name']].
432 432
  */
433 433
 function text_textarea_process($element, $edit, $form_state, $form) {
434
-  $field = $form['#field_info'][$element['#field_name']];
435
-  $field_key   = $element['#columns'][0];
436
-  $element[$field_key] = array(
434
+    $field = $form['#field_info'][$element['#field_name']];
435
+    $field_key   = $element['#columns'][0];
436
+    $element[$field_key] = array(
437 437
     '#type' => 'textarea',
438 438
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
439 439
     '#rows' => !empty($field['widget']['rows']) ? $field['widget']['rows'] : 10,
@@ -447,22 +447,22 @@  discard block
 block discarded – undo
447 447
     '#type_name' => $element['#type_name'],
448 448
     '#delta' => $element['#delta'],
449 449
     '#columns' => $element['#columns'],
450
-  );
450
+    );
451 451
 
452
-  if (!empty($field['text_processing'])) {
452
+    if (!empty($field['text_processing'])) {
453 453
     $filter_key  = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
454 454
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
455 455
     $parents = array_merge($element['#parents'] , array($filter_key));
456 456
     $element[$filter_key] = filter_form($format, 1, $parents);
457
-  }
457
+    }
458 458
 
459
-  // Used so that hook_field('validate') knows where to flag an error.
460
-  $element['_error_element'] = array(
459
+    // Used so that hook_field('validate') knows where to flag an error.
460
+    $element['_error_element'] = array(
461 461
     '#type' => 'value',
462 462
     '#value' => implode('][', array_merge($element['#parents'], array($field_key))),
463
-  );
463
+    );
464 464
 
465
-  return $element;
465
+    return $element;
466 466
 }
467 467
 
468 468
 /**
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
  * $element['#delta]  is the position of this element in the group
478 478
  */
479 479
 function theme_text_textfield($element) {
480
-  return $element['#children'];
480
+    return $element['#children'];
481 481
 }
482 482
 
483 483
 function theme_text_textarea($element) {
484
-  return $element['#children'];
484
+    return $element['#children'];
485 485
 }
Please login to merge, or discard this patch.
Switch Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -50,94 +50,94 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function text_field_settings($op, $field) {
52 52
   switch ($op) {
53
-    case 'form':
54
-      $form = array();
55
-      $options = array(0 => t('Plain text'), 1 => t('Filtered text (user selects input format)'));
56
-      $form['text_processing'] = array(
57
-        '#type' => 'radios',
58
-        '#title' => t('Text processing'),
59
-        '#default_value' => is_numeric($field['text_processing']) ? $field['text_processing'] : 0,
60
-        '#options' => $options,
61
-      );
62
-      $form['max_length'] = array(
63
-        '#type' => 'textfield',
64
-        '#title' => t('Maximum length'),
65
-        '#default_value' => is_numeric($field['max_length']) ? $field['max_length'] : '',
66
-        '#required' => FALSE,
67
-        '#element_validate' => array('_element_validate_integer_positive'),
68
-        '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'),
69
-      );
70
-      $form['allowed_values_fieldset'] = array(
71
-        '#type' => 'fieldset',
72
-        '#title' => t('Allowed values'),
73
-        '#collapsible' => TRUE,
74
-        '#collapsed' => TRUE,
75
-      );
76
-      $form['allowed_values_fieldset']['allowed_values'] = array(
53
+  case 'form':
54
+    $form = array();
55
+    $options = array(0 => t('Plain text'), 1 => t('Filtered text (user selects input format)'));
56
+    $form['text_processing'] = array(
57
+      '#type' => 'radios',
58
+      '#title' => t('Text processing'),
59
+      '#default_value' => is_numeric($field['text_processing']) ? $field['text_processing'] : 0,
60
+      '#options' => $options,
61
+    );
62
+    $form['max_length'] = array(
63
+      '#type' => 'textfield',
64
+      '#title' => t('Maximum length'),
65
+      '#default_value' => is_numeric($field['max_length']) ? $field['max_length'] : '',
66
+      '#required' => FALSE,
67
+      '#element_validate' => array('_element_validate_integer_positive'),
68
+      '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'),
69
+    );
70
+    $form['allowed_values_fieldset'] = array(
71
+      '#type' => 'fieldset',
72
+      '#title' => t('Allowed values'),
73
+      '#collapsible' => TRUE,
74
+      '#collapsed' => TRUE,
75
+    );
76
+    $form['allowed_values_fieldset']['allowed_values'] = array(
77
+      '#type' => 'textarea',
78
+      '#title' => t('Allowed values list'),
79
+      '#default_value' => !empty($field['allowed_values']) ? $field['allowed_values'] : '',
80
+      '#required' => FALSE,
81
+      '#rows' => 10,
82
+      '#description' => t('The possible values this field can contain. Enter one value per line, in the format key|label. The key is the value that will be stored in the database, and it must match the field storage type (%type). The label is optional, and the key will be used as the label if no label is specified.<br />Allowed HTML tags: @tags', array('%type' => $field['type'], '@tags' => _content_filter_xss_display_allowed_tags())),
83
+    );
84
+    $form['allowed_values_fieldset']['advanced_options'] = array(
85
+      '#type' => 'fieldset',
86
+      '#title' => t('PHP code'),
87
+      '#collapsible' => TRUE,
88
+      '#collapsed' => empty($field['allowed_values_php']),
89
+    );
90
+    if (user_access('Use PHP input for field settings (dangerous - grant with care)')) {
91
+      $form['allowed_values_fieldset']['advanced_options']['allowed_values_php'] = array(
77 92
         '#type' => 'textarea',
78
-        '#title' => t('Allowed values list'),
79
-        '#default_value' => !empty($field['allowed_values']) ? $field['allowed_values'] : '',
80
-        '#required' => FALSE,
81
-        '#rows' => 10,
82
-        '#description' => t('The possible values this field can contain. Enter one value per line, in the format key|label. The key is the value that will be stored in the database, and it must match the field storage type (%type). The label is optional, and the key will be used as the label if no label is specified.<br />Allowed HTML tags: @tags', array('%type' => $field['type'], '@tags' => _content_filter_xss_display_allowed_tags())),
93
+        '#title' => t('Code'),
94
+        '#default_value' => !empty($field['allowed_values_php']) ? $field['allowed_values_php'] : '',
95
+        '#rows' => 6,
96
+        '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'),
83 97
       );
84
-      $form['allowed_values_fieldset']['advanced_options'] = array(
85
-        '#type' => 'fieldset',
86
-        '#title' => t('PHP code'),
87
-        '#collapsible' => TRUE,
88
-        '#collapsed' => empty($field['allowed_values_php']),
98
+    }
99
+    else {
100
+      $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array(
101
+        '#type' => 'item',
102
+        '#title' => t('Code'),
103
+        '#value' => !empty($field['allowed_values_php']) ? '<code>'. check_plain($field['allowed_values_php']) .'</code>' : t('&lt;none&gt;'),
104
+        '#description' => empty($field['allowed_values_php']) ? t("You're not allowed to input PHP code.") : t('This PHP code was set by an administrator and will override the allowed values list above.'),
89 105
       );
90
-      if (user_access('Use PHP input for field settings (dangerous - grant with care)')) {
91
-        $form['allowed_values_fieldset']['advanced_options']['allowed_values_php'] = array(
92
-          '#type' => 'textarea',
93
-          '#title' => t('Code'),
94
-          '#default_value' => !empty($field['allowed_values_php']) ? $field['allowed_values_php'] : '',
95
-          '#rows' => 6,
96
-          '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'),
97
-        );
98
-      }
99
-      else {
100
-        $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array(
101
-          '#type' => 'item',
102
-          '#title' => t('Code'),
103
-          '#value' => !empty($field['allowed_values_php']) ? '<code>'. check_plain($field['allowed_values_php']) .'</code>' : t('&lt;none&gt;'),
104
-          '#description' => empty($field['allowed_values_php']) ? t("You're not allowed to input PHP code.") : t('This PHP code was set by an administrator and will override the allowed values list above.'),
105
-        );
106
-      }
107
-      return $form;
108
-
109
-    case 'save':
110
-      return array('text_processing', 'max_length', 'allowed_values', 'allowed_values_php');
111
-
112
-    case 'database columns':
113
-      if (empty($field['max_length']) || $field['max_length'] > 255) {
114
-        $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
115
-      }
116
-      else {
117
-        $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
118
-      }
119
-      if (!empty($field['text_processing'])) {
120
-        $columns['format'] = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'views' => FALSE);
121
-      }
122
-      return $columns;
123
-
124
-    case 'views data':
125
-      $allowed_values = content_allowed_values($field);
126
-      if (count($allowed_values)) {
127
-        $data = content_views_field_views_data($field);
128
-        $db_info = content_database_info($field);
129
-        $table_alias = content_views_tablename($field);
130
-
131
-        // Filter: Add a 'many to one' filter.
132
-        $copy = $data[$table_alias][$field['field_name'] .'_value'];
133
-        $copy['title'] = t('@label (!name) - Allowed values', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
134
-        $copy['filter']['handler'] = 'content_handler_filter_many_to_one';
135
-        unset($copy['field'], $copy['argument'], $copy['sort']);
136
-        $data[$table_alias][$field['field_name'] .'_value_many_to_one'] = $copy;
137
-        // Argument : swap the handler to the 'many to one' operator.
138
-        $data[$table_alias][$field['field_name'] .'_value']['argument']['handler'] = 'content_handler_argument_many_to_one';
139
-        return $data;
140
-      }
106
+    }
107
+    return $form;
108
+
109
+  case 'save':
110
+    return array('text_processing', 'max_length', 'allowed_values', 'allowed_values_php');
111
+
112
+  case 'database columns':
113
+    if (empty($field['max_length']) || $field['max_length'] > 255) {
114
+      $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
115
+    }
116
+    else {
117
+      $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
118
+    }
119
+    if (!empty($field['text_processing'])) {
120
+      $columns['format'] = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'views' => FALSE);
121
+    }
122
+    return $columns;
123
+
124
+  case 'views data':
125
+    $allowed_values = content_allowed_values($field);
126
+    if (count($allowed_values)) {
127
+      $data = content_views_field_views_data($field);
128
+      $db_info = content_database_info($field);
129
+      $table_alias = content_views_tablename($field);
130
+
131
+      // Filter: Add a 'many to one' filter.
132
+      $copy = $data[$table_alias][$field['field_name'] .'_value'];
133
+      $copy['title'] = t('@label (!name) - Allowed values', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
134
+      $copy['filter']['handler'] = 'content_handler_filter_many_to_one';
135
+      unset($copy['field'], $copy['argument'], $copy['sort']);
136
+      $data[$table_alias][$field['field_name'] .'_value_many_to_one'] = $copy;
137
+      // Argument : swap the handler to the 'many to one' operator.
138
+      $data[$table_alias][$field['field_name'] .'_value']['argument']['handler'] = 'content_handler_argument_many_to_one';
139
+      return $data;
140
+    }
141 141
   }
142 142
 }
143 143
 
@@ -146,34 +146,34 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function text_field($op, &$node, $field, &$items, $teaser, $page) {
148 148
   switch ($op) {
149
-    case 'validate':
150
-      $allowed_values = content_allowed_values($field);
151
-      if (is_array($items)) {
152
-        foreach ($items as $delta => $item) {
153
-          $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
154
-          if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
155
-          if (!empty($item['value'])) {
156
-            if (count($allowed_values) && !array_key_exists($item['value'], $allowed_values)) {
157
-              form_set_error($error_element, t('%name: illegal value.', array('%name' => t($field['widget']['label']))));
158
-            }
159
-            if (!empty($field['max_length']) && drupal_strlen($item['value']) > $field['max_length']) {
160
-              form_set_error($error_element, t('%name: the value may not be longer than %max characters.', array('%name' => $field['widget']['label'], '%max' => $field['max_length'])));
161
-            }
149
+  case 'validate':
150
+    $allowed_values = content_allowed_values($field);
151
+    if (is_array($items)) {
152
+      foreach ($items as $delta => $item) {
153
+        $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
154
+        if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
155
+        if (!empty($item['value'])) {
156
+          if (count($allowed_values) && !array_key_exists($item['value'], $allowed_values)) {
157
+            form_set_error($error_element, t('%name: illegal value.', array('%name' => t($field['widget']['label']))));
158
+          }
159
+          if (!empty($field['max_length']) && drupal_strlen($item['value']) > $field['max_length']) {
160
+            form_set_error($error_element, t('%name: the value may not be longer than %max characters.', array('%name' => $field['widget']['label'], '%max' => $field['max_length'])));
162 161
           }
163 162
         }
164 163
       }
165
-      return $items;
164
+    }
165
+    return $items;
166 166
 
167
-    case 'sanitize':
168
-      foreach ($items as $delta => $item) {
169
-        if (!empty($field['text_processing'])) {
170
-          $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : '';
171
-        }
172
-        else {
173
-          $text = isset($item['value']) ? check_plain($item['value']) : '';
174
-        }
175
-        $items[$delta]['safe'] = $text;
167
+  case 'sanitize':
168
+    foreach ($items as $delta => $item) {
169
+      if (!empty($field['text_processing'])) {
170
+        $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : '';
171
+      }
172
+      else {
173
+        $text = isset($item['value']) ? check_plain($item['value']) : '';
176 174
       }
175
+      $items[$delta]['safe'] = $text;
176
+    }
177 177
   }
178 178
 }
179 179
 
@@ -305,34 +305,34 @@  discard block
 block discarded – undo
305 305
  */
306 306
 function text_widget_settings($op, $widget) {
307 307
   switch ($op) {
308
-    case 'form':
309
-      $form = array();
310
-      $rows = (isset($widget['rows']) && is_numeric($widget['rows'])) ? $widget['rows'] : 5;
311
-      $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
312
-      if ($widget['type'] == 'text_textfield') {
313
-        $form['rows'] = array('#type' => 'hidden', '#value' => $rows);
314
-        $form['size'] = array(
315
-          '#type' => 'textfield',
316
-          '#title' => t('Size of textfield'),
317
-          '#default_value' => $size,
318
-          '#element_validate' => array('_element_validate_integer_positive'),
319
-          '#required' => TRUE,
320
-        );
321
-      }
322
-      else {
323
-        $form['rows'] = array(
324
-          '#type' => 'textfield',
325
-          '#title' => t('Rows'),
326
-          '#default_value' => $rows,
327
-          '#element_validate' => array('_element_validate_integer_positive'),
328
-          '#required' => TRUE,
329
-        );
330
-        $form['size'] = array('#type' => 'hidden', '#value' => $size);
331
-      }
332
-      return $form;
308
+  case 'form':
309
+    $form = array();
310
+    $rows = (isset($widget['rows']) && is_numeric($widget['rows'])) ? $widget['rows'] : 5;
311
+    $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
312
+    if ($widget['type'] == 'text_textfield') {
313
+      $form['rows'] = array('#type' => 'hidden', '#value' => $rows);
314
+      $form['size'] = array(
315
+        '#type' => 'textfield',
316
+        '#title' => t('Size of textfield'),
317
+        '#default_value' => $size,
318
+        '#element_validate' => array('_element_validate_integer_positive'),
319
+        '#required' => TRUE,
320
+      );
321
+    }
322
+    else {
323
+      $form['rows'] = array(
324
+        '#type' => 'textfield',
325
+        '#title' => t('Rows'),
326
+        '#default_value' => $rows,
327
+        '#element_validate' => array('_element_validate_integer_positive'),
328
+        '#required' => TRUE,
329
+      );
330
+      $form['size'] = array('#type' => 'hidden', '#value' => $size);
331
+    }
332
+    return $form;
333 333
 
334
-    case 'save':
335
-      return array('rows', 'size');
334
+  case 'save':
335
+    return array('rows', 'size');
336 336
   }
337 337
 }
338 338
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array(
101 101
           '#type' => 'item',
102 102
           '#title' => t('Code'),
103
-          '#value' => !empty($field['allowed_values_php']) ? '<code>'. check_plain($field['allowed_values_php']) .'</code>' : t('&lt;none&gt;'),
103
+          '#value' => !empty($field['allowed_values_php']) ? '<code>'.check_plain($field['allowed_values_php']).'</code>' : t('&lt;none&gt;'),
104 104
           '#description' => empty($field['allowed_values_php']) ? t("You're not allowed to input PHP code.") : t('This PHP code was set by an administrator and will override the allowed values list above.'),
105 105
         );
106 106
       }
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
         $table_alias = content_views_tablename($field);
130 130
 
131 131
         // Filter: Add a 'many to one' filter.
132
-        $copy = $data[$table_alias][$field['field_name'] .'_value'];
132
+        $copy = $data[$table_alias][$field['field_name'].'_value'];
133 133
         $copy['title'] = t('@label (!name) - Allowed values', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
134 134
         $copy['filter']['handler'] = 'content_handler_filter_many_to_one';
135 135
         unset($copy['field'], $copy['argument'], $copy['sort']);
136
-        $data[$table_alias][$field['field_name'] .'_value_many_to_one'] = $copy;
136
+        $data[$table_alias][$field['field_name'].'_value_many_to_one'] = $copy;
137 137
         // Argument : swap the handler to the 'many to one' operator.
138
-        $data[$table_alias][$field['field_name'] .'_value']['argument']['handler'] = 'content_handler_argument_many_to_one';
138
+        $data[$table_alias][$field['field_name'].'_value']['argument']['handler'] = 'content_handler_argument_many_to_one';
139 139
         return $data;
140 140
       }
141 141
   }
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
  * Theme function for 'default' text field formatter.
215 215
  */
216 216
 function theme_text_formatter_default($element) {
217
-  return ($allowed =_text_allowed_values($element)) ? $allowed : $element['#item']['safe'];
217
+  return ($allowed = _text_allowed_values($element)) ? $allowed : $element['#item']['safe'];
218 218
 }
219 219
 
220 220
 /**
221 221
  * Theme function for 'plain' text field formatter.
222 222
  */
223 223
 function theme_text_formatter_plain($element) {
224
-  return ($allowed =_text_allowed_values($element)) ? $allowed : strip_tags($element['#item']['safe']);
224
+  return ($allowed = _text_allowed_values($element)) ? $allowed : strip_tags($element['#item']['safe']);
225 225
 }
226 226
 
227 227
 /**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function theme_text_formatter_trimmed($element) {
231 231
   $field = content_fields($element['#field_name'], $element['#type_name']);
232
-  return ($allowed =_text_allowed_values($element)) ? $allowed : node_teaser($element['#item']['safe'], $field['text_processing'] ? $element['#item']['format'] : NULL);
232
+  return ($allowed = _text_allowed_values($element)) ? $allowed : node_teaser($element['#item']['safe'], $field['text_processing'] ? $element['#item']['format'] : NULL);
233 233
 }
234 234
 
235 235
 function _text_allowed_values($element) {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
   if (!empty($field['text_processing'])) {
410 410
     $filter_key = $element['#columns'][1];
411 411
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
412
-    $parents = array_merge($element['#parents'] , array($filter_key));
412
+    $parents = array_merge($element['#parents'], array($filter_key));
413 413
     $element[$filter_key] = filter_form($format, 1, $parents);
414 414
   }
415 415
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
  */
433 433
 function text_textarea_process($element, $edit, $form_state, $form) {
434 434
   $field = $form['#field_info'][$element['#field_name']];
435
-  $field_key   = $element['#columns'][0];
435
+  $field_key = $element['#columns'][0];
436 436
   $element[$field_key] = array(
437 437
     '#type' => 'textarea',
438 438
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
   );
451 451
 
452 452
   if (!empty($field['text_processing'])) {
453
-    $filter_key  = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
453
+    $filter_key = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
454 454
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
455
-    $parents = array_merge($element['#parents'] , array($filter_key));
455
+    $parents = array_merge($element['#parents'], array($filter_key));
456 456
     $element[$filter_key] = filter_form($format, 1, $parents);
457 457
   }
458 458
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -95,8 +95,7 @@  discard block
 block discarded – undo
95 95
           '#rows' => 6,
96 96
           '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'),
97 97
         );
98
-      }
99
-      else {
98
+      } else {
100 99
         $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array(
101 100
           '#type' => 'item',
102 101
           '#title' => t('Code'),
@@ -112,8 +111,7 @@  discard block
 block discarded – undo
112 111
     case 'database columns':
113 112
       if (empty($field['max_length']) || $field['max_length'] > 255) {
114 113
         $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
115
-      }
116
-      else {
114
+      } else {
117 115
         $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
118 116
       }
119 117
       if (!empty($field['text_processing'])) {
@@ -168,8 +166,7 @@  discard block
 block discarded – undo
168 166
       foreach ($items as $delta => $item) {
169 167
         if (!empty($field['text_processing'])) {
170 168
           $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : '';
171
-        }
172
-        else {
169
+        } else {
173 170
           $text = isset($item['value']) ? check_plain($item['value']) : '';
174 171
         }
175 172
         $items[$delta]['safe'] = $text;
@@ -318,8 +315,7 @@  discard block
 block discarded – undo
318 315
           '#element_validate' => array('_element_validate_integer_positive'),
319 316
           '#required' => TRUE,
320 317
         );
321
-      }
322
-      else {
318
+      } else {
323 319
         $form['rows'] = array(
324 320
           '#type' => 'textfield',
325 321
           '#title' => t('Rows'),
Please login to merge, or discard this patch.
Upper-Lower-Casing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
 function text_theme() {
13 13
   return array(
14 14
     'text_textarea' => array(
15
-      'arguments' => array('element' => NULL),
15
+      'arguments' => array('element' => null),
16 16
     ),
17 17
     'text_textfield' => array(
18
-      'arguments' => array('element' => NULL),
18
+      'arguments' => array('element' => null),
19 19
     ),
20 20
     'text_formatter_default' => array(
21
-      'arguments' => array('element' => NULL),
21
+      'arguments' => array('element' => null),
22 22
     ),
23 23
     'text_formatter_plain' => array(
24
-      'arguments' => array('element' => NULL),
24
+      'arguments' => array('element' => null),
25 25
     ),
26 26
     'text_formatter_trimmed' => array(
27
-      'arguments' => array('element' => NULL),
27
+      'arguments' => array('element' => null),
28 28
     ),
29 29
     'text_formatter_foo' => array(
30
-      'arguments' => array('element' => NULL),
30
+      'arguments' => array('element' => null),
31 31
     ),
32 32
   );
33 33
 }
@@ -63,28 +63,28 @@  discard block
 block discarded – undo
63 63
         '#type' => 'textfield',
64 64
         '#title' => t('Maximum length'),
65 65
         '#default_value' => is_numeric($field['max_length']) ? $field['max_length'] : '',
66
-        '#required' => FALSE,
66
+        '#required' => false,
67 67
         '#element_validate' => array('_element_validate_integer_positive'),
68 68
         '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'),
69 69
       );
70 70
       $form['allowed_values_fieldset'] = array(
71 71
         '#type' => 'fieldset',
72 72
         '#title' => t('Allowed values'),
73
-        '#collapsible' => TRUE,
74
-        '#collapsed' => TRUE,
73
+        '#collapsible' => true,
74
+        '#collapsed' => true,
75 75
       );
76 76
       $form['allowed_values_fieldset']['allowed_values'] = array(
77 77
         '#type' => 'textarea',
78 78
         '#title' => t('Allowed values list'),
79 79
         '#default_value' => !empty($field['allowed_values']) ? $field['allowed_values'] : '',
80
-        '#required' => FALSE,
80
+        '#required' => false,
81 81
         '#rows' => 10,
82 82
         '#description' => t('The possible values this field can contain. Enter one value per line, in the format key|label. The key is the value that will be stored in the database, and it must match the field storage type (%type). The label is optional, and the key will be used as the label if no label is specified.<br />Allowed HTML tags: @tags', array('%type' => $field['type'], '@tags' => _content_filter_xss_display_allowed_tags())),
83 83
       );
84 84
       $form['allowed_values_fieldset']['advanced_options'] = array(
85 85
         '#type' => 'fieldset',
86 86
         '#title' => t('PHP code'),
87
-        '#collapsible' => TRUE,
87
+        '#collapsible' => true,
88 88
         '#collapsed' => empty($field['allowed_values_php']),
89 89
       );
90 90
       if (user_access('Use PHP input for field settings (dangerous - grant with care)')) {
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 
112 112
     case 'database columns':
113 113
       if (empty($field['max_length']) || $field['max_length'] > 255) {
114
-        $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
114
+        $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => false, 'sortable' => true, 'views' => true);
115 115
       }
116 116
       else {
117
-        $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
117
+        $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => false, 'sortable' => true, 'views' => true);
118 118
       }
119 119
       if (!empty($field['text_processing'])) {
120
-        $columns['format'] = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'views' => FALSE);
120
+        $columns['format'] = array('type' => 'int', 'unsigned' => true, 'not null' => false, 'views' => false);
121 121
       }
122 122
       return $columns;
123 123
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     case 'sanitize':
168 168
       foreach ($items as $delta => $item) {
169 169
         if (!empty($field['text_processing'])) {
170
-          $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : '';
170
+          $text = isset($item['value']) ? check_markup($item['value'], $item['format'], false) : '';
171 171
         }
172 172
         else {
173 173
           $text = isset($item['value']) ? check_plain($item['value']) : '';
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
  */
183 183
 function text_content_is_empty($item, $field) {
184 184
   if (empty($item['value']) && (string)$item['value'] !== '0') {
185
-    return TRUE;
185
+    return true;
186 186
   }
187
-  return FALSE;
187
+  return false;
188 188
 }
189 189
 
190 190
 /**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function theme_text_formatter_trimmed($element) {
231 231
   $field = content_fields($element['#field_name'], $element['#type_name']);
232
-  return ($allowed =_text_allowed_values($element)) ? $allowed : node_teaser($element['#item']['safe'], $field['text_processing'] ? $element['#item']['format'] : NULL);
232
+  return ($allowed =_text_allowed_values($element)) ? $allowed : node_teaser($element['#item']['safe'], $field['text_processing'] ? $element['#item']['format'] : null);
233 233
 }
234 234
 
235 235
 function _text_allowed_values($element) {
@@ -286,13 +286,13 @@  discard block
 block discarded – undo
286 286
 function text_elements() {
287 287
   return array(
288 288
     'text_textfield' => array(
289
-      '#input' => TRUE,
289
+      '#input' => true,
290 290
       '#columns' => array('value'), '#delta' => 0,
291 291
       '#process' => array('text_textfield_process'),
292
-      '#autocomplete_path' => FALSE,
292
+      '#autocomplete_path' => false,
293 293
     ),
294 294
     'text_textarea' => array(
295
-      '#input' => TRUE,
295
+      '#input' => true,
296 296
       '#columns' => array('value', 'format'), '#delta' => 0,
297 297
       '#process' => array('text_textarea_process'),
298 298
       '#filter_value' => FILTER_FORMAT_DEFAULT,
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
           '#title' => t('Size of textfield'),
317 317
           '#default_value' => $size,
318 318
           '#element_validate' => array('_element_validate_integer_positive'),
319
-          '#required' => TRUE,
319
+          '#required' => true,
320 320
         );
321 321
       }
322 322
       else {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
           '#title' => t('Rows'),
326 326
           '#default_value' => $rows,
327 327
           '#element_validate' => array('_element_validate_integer_positive'),
328
-          '#required' => TRUE,
328
+          '#required' => true,
329 329
         );
330 330
         $form['size'] = array('#type' => 'hidden', '#value' => $size);
331 331
       }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
   $delta = $element['#delta'];
390 390
   $element[$field_key] = array(
391 391
     '#type' => 'textfield',
392
-    '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
392
+    '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : null,
393 393
     '#autocomplete_path' => $element['#autocomplete_path'],
394 394
     '#size' => !empty($field['widget']['size']) ? $field['widget']['size'] : 60,
395 395
     '#attributes' => array('class' => 'text'),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     '#columns' => $element['#columns'],
405 405
   );
406 406
 
407
-  $element[$field_key]['#maxlength'] = !empty($field['max_length']) ? $field['max_length'] : NULL;
407
+  $element[$field_key]['#maxlength'] = !empty($field['max_length']) ? $field['max_length'] : null;
408 408
 
409 409
   if (!empty($field['text_processing'])) {
410 410
     $filter_key = $element['#columns'][1];
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
   $field_key   = $element['#columns'][0];
436 436
   $element[$field_key] = array(
437 437
     '#type' => 'textarea',
438
-    '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
438
+    '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : null,
439 439
     '#rows' => !empty($field['widget']['rows']) ? $field['widget']['rows'] : 10,
440 440
     '#weight' => 0,
441 441
     // The following values were set by the content module and need
Please login to merge, or discard this patch.
cck/modules/userreference/panels/relationships/user_from_userref.inc 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_ctools_relationships().
11 11
  */
12 12
 function userreference_user_from_userref_ctools_relationships() {
13
-  return array(
13
+    return array(
14 14
     'title' => t('User from reference'),
15 15
     'keyword' => 'userreference',
16 16
     'description' => t('Adds a user from a user reference in a node context; if multiple users are referenced, this will get the first referenced user only.'),
@@ -18,48 +18,48 @@  discard block
 block discarded – undo
18 18
     'context' => 'userreference_user_from_userref_context',
19 19
     'settings form' => 'userreference_user_from_userref_settings_form',
20 20
     'settings form validate' => 'userreference_user_from_userref_settings_form_validate',
21
-  );
21
+    );
22 22
 }
23 23
 
24 24
 /**
25 25
  * Return a new ctools context based on an existing context.
26 26
  */
27 27
 function userreference_user_from_userref_context($context, $conf) {
28
-  // If unset it wants a generic, unfilled context, which is just NULL.
29
-  if (empty($context->data)) {
28
+    // If unset it wants a generic, unfilled context, which is just NULL.
29
+    if (empty($context->data)) {
30 30
     return ctools_context_create_empty('user', NULL);
31
-  }
31
+    }
32 32
 
33
-  // Prevent whitescreens on stale data.
34
-  if (empty($conf)) {
33
+    // Prevent whitescreens on stale data.
34
+    if (empty($conf)) {
35 35
     return ctools_context_create_empty('user', NULL);
36
-  }
36
+    }
37 37
 
38
-  if (isset($context->data->{$conf['field_name']}[0]['uid']) && ($uid = $context->data->{$conf['field_name']}[0]['uid'])) {
38
+    if (isset($context->data->{$conf['field_name']}[0]['uid']) && ($uid = $context->data->{$conf['field_name']}[0]['uid'])) {
39 39
     if ($account = user_load(array('uid' => $uid))) {
40
-      return ctools_context_create('user', $account);
40
+        return ctools_context_create('user', $account);
41
+    }
41 42
     }
42
-  }
43 43
 }
44 44
 
45 45
 /**
46 46
  * Settings form for the ctools relationship.
47 47
  */
48 48
 function userreference_user_from_userref_settings_form($conf) {
49
-  $options = array();
50
-  foreach (content_fields() as $field) {
49
+    $options = array();
50
+    foreach (content_fields() as $field) {
51 51
     if ($field['type'] == 'userreference') {
52
-      $options[$field['field_name']] = t($field['widget']['label']);
52
+        $options[$field['field_name']] = t($field['widget']['label']);
53
+    }
53 54
     }
54
-  }
55
-  $form['field_name'] = array(
55
+    $form['field_name'] = array(
56 56
     '#title' => t('User reference field'),
57 57
     '#type' => 'select',
58 58
     '#options' => $options,
59 59
     '#default_value' => isset($conf['field_name']) ? $conf['field_name'] : '',
60 60
     '#prefix' => '<div class="clear-block">',
61 61
     '#suffix' => '</div>',
62
-  );
62
+    );
63 63
 
64
-  return $form;
64
+    return $form;
65 65
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
 function userreference_user_from_userref_context($context, $conf) {
28 28
   // If unset it wants a generic, unfilled context, which is just NULL.
29 29
   if (empty($context->data)) {
30
-    return ctools_context_create_empty('user', NULL);
30
+    return ctools_context_create_empty('user', null);
31 31
   }
32 32
 
33 33
   // Prevent whitescreens on stale data.
34 34
   if (empty($conf)) {
35
-    return ctools_context_create_empty('user', NULL);
35
+    return ctools_context_create_empty('user', null);
36 36
   }
37 37
 
38 38
   if (isset($context->data->{$conf['field_name']}[0]['uid']) && ($uid = $context->data->{$conf['field_name']}[0]['uid'])) {
Please login to merge, or discard this patch.
boinc/modules/contrib/cck/modules/userreference/userreference.rules.inc 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,39 +10,39 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_rules_action_info()
11 11
  */
12 12
 function userreference_rules_action_info() {
13
-  $info = array();
14
-  $info['userreference_rules_action_load'] = array(
13
+    $info = array();
14
+    $info['userreference_rules_action_load'] = array(
15 15
     'label' => t('Load a referenced user'),
16 16
     'arguments' => array(
17
-      'node' => array(
17
+        'node' => array(
18 18
         'type' => 'node',
19 19
         'label' => t('Content containing the user reference field'),
20
-      ),
20
+        ),
21 21
     ),
22 22
     'new variables' => array(
23
-      'referenced_user' => array(
23
+        'referenced_user' => array(
24 24
         'type' => 'user',
25 25
         'label' => t('Referenced user'),
26
-      ),
26
+        ),
27 27
     ),
28 28
     'module' => 'CCK',
29 29
     'help' => t('Note that if the field has multiple values, only the first user will be loaded.'),
30
-  );
31
-  return $info;
30
+    );
31
+    return $info;
32 32
 }
33 33
 
34 34
 function userreference_rules_action_load($node, $settings) {
35
-  $uid = $node->{$settings['field']}[0]['uid'];
36
-  if (isset($uid)) {
35
+    $uid = $node->{$settings['field']}[0]['uid'];
36
+    if (isset($uid)) {
37 37
     $user = user_load(array('uid' => $uid));
38 38
     return array('referenced_user' => $user);
39
-  }
39
+    }
40 40
 }
41 41
 
42 42
 function userreference_rules_action_load_form($settings, &$form) {
43
-  $settings += array('field' => '');
44
-  $options = content_rules_get_field_names_by_type('userreference');
45
-  $form['settings']['field'] = array(
43
+    $settings += array('field' => '');
44
+    $options = content_rules_get_field_names_by_type('userreference');
45
+    $form['settings']['field'] = array(
46 46
     '#type' => 'select',
47 47
     '#title' => t('Field'),
48 48
     '#default_value' => $settings['field'],
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     '#required' => TRUE,
51 51
     '#disabled' => empty($options),
52 52
     '#description' => empty($options) ? t('There are no userreference fields defined.') : '',
53
-  );
53
+    );
54 54
 }
55 55
 
56 56
 /**
@@ -58,5 +58,5 @@  discard block
 block discarded – undo
58 58
  * "workflow_ng_action_load_referenced_user" to the equivalent rules action.
59 59
  */
60 60
 function workflow_ng_action_load_referenced_user_upgrade(&$element) {
61
-  $element['#name'] = 'userreference_rules_action_load';
61
+    $element['#name'] = 'userreference_rules_action_load';
62 62
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     '#title' => t('Field'),
48 48
     '#default_value' => $settings['field'],
49 49
     '#options' => $options,
50
-    '#required' => TRUE,
50
+    '#required' => true,
51 51
     '#disabled' => empty($options),
52 52
     '#description' => empty($options) ? t('There are no userreference fields defined.') : '',
53 53
   );
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/theme/theme.inc 5 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,43 +6,43 @@  discard block
 block discarded – undo
6 6
  * Theme preprocess function for content-admin-field-overview-form.tpl.php.
7 7
  */
8 8
 function template_preprocess_content_field_overview_form(&$vars) {
9
-  $form = &$vars['form'];
9
+    $form = &$vars['form'];
10 10
 
11
-  $vars['help'] = theme('advanced_help_topic', 'content', 'manage-fields') . t('Add fields and groups to the content type, and arrange them on content display and input forms.');
12
-  if (module_exists('fieldgroup')) {
11
+    $vars['help'] = theme('advanced_help_topic', 'content', 'manage-fields') . t('Add fields and groups to the content type, and arrange them on content display and input forms.');
12
+    if (module_exists('fieldgroup')) {
13 13
     $vars['help'] .= '<br/>'. t('You can add a field to a group by dragging it below and to the right of the group.');
14
-  }
15
-  if (!module_exists('advanced_help')) {
14
+    }
15
+    if (!module_exists('advanced_help')) {
16 16
     $vars['help'] .= '<br/>' . t('Note: Installing the <a href="!adv_help">Advanced help</a> module will let you access more and better help.', array('!adv_help' => 'http://drupal.org/project/advanced_help'));
17
-  }
17
+    }
18 18
 
19
-  $order = _content_overview_order($form, $form['#field_rows'], $form['#group_rows']);
20
-  $rows = array();
19
+    $order = _content_overview_order($form, $form['#field_rows'], $form['#group_rows']);
20
+    $rows = array();
21 21
 
22
-  // Identify the 'new item' keys in the form, they look like
23
-  // _add_new_field, add_new_group.
24
-  $keys = array_keys($form);
25
-  $add_rows = array();
26
-  foreach ($keys as $key) {
22
+    // Identify the 'new item' keys in the form, they look like
23
+    // _add_new_field, add_new_group.
24
+    $keys = array_keys($form);
25
+    $add_rows = array();
26
+    foreach ($keys as $key) {
27 27
     if (substr($key, 0, 4) == '_add') {
28
-      $add_rows[] = $key;
28
+        $add_rows[] = $key;
29
+    }
29 30
     }
30
-  }
31
-  while ($order) {
31
+    while ($order) {
32 32
     $key = reset($order);
33 33
     $element = &$form[$key];
34 34
 
35 35
     // Only display the 'Add' separator if the 'add' rows are still
36 36
     // at the end of the table.
37 37
     if (!isset($added_separator)) {
38
-      $remaining_rows = array_diff($order, $add_rows);
39
-      if (empty($remaining_rows) && empty($element['#depth'])) {
38
+        $remaining_rows = array_diff($order, $add_rows);
39
+        if (empty($remaining_rows) && empty($element['#depth'])) {
40 40
         $row = new stdClass();
41 41
         $row->row_type = 'separator';
42 42
         $row->class = 'tabledrag-leaf region';
43 43
         $rows[] = $row;
44 44
         $added_separator = TRUE;
45
-      }
45
+        }
46 46
     }
47 47
 
48 48
     $row = new stdClass();
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
     $element['hidden_name']['#attributes']['class'] = 'field-name';
54 54
     // Add target classes for the update selects behavior.
55 55
     switch ($element['#row_type']) {
56
-      case 'add_new_field':
56
+        case 'add_new_field':
57 57
         $element['type']['#attributes']['class'] = 'content-field-type-select';
58 58
         $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
59 59
         break;
60
-      case 'add_existing_field':
60
+        case 'add_existing_field':
61 61
         $element['field_name']['#attributes']['class'] = 'content-field-select';
62 62
         $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
63 63
         $element['label']['#attributes']['class'] = 'content-label-textfield';
64 64
         break;
65 65
     }
66 66
     foreach (element_children($element) as $child) {
67
-      $row->{$child} = drupal_render($element[$child]);
67
+        $row->{$child} = drupal_render($element[$child]);
68 68
     }
69 69
     $row->label_class = 'label-'. strtr($element['#row_type'], '_', '-');
70 70
     $row->row_type = $element['#row_type'];
@@ -77,69 +77,69 @@  discard block
 block discarded – undo
77 77
 
78 78
     $rows[] = $row;
79 79
     array_shift($order);
80
-  }
81
-  $vars['rows'] = $rows;
82
-  $vars['submit'] = drupal_render($form);
80
+    }
81
+    $vars['rows'] = $rows;
82
+    $vars['submit'] = drupal_render($form);
83 83
 
84
-  // Add tabledrag behavior.
84
+    // Add tabledrag behavior.
85 85
 //  drupal_add_tabledrag('content-field-overview', 'match', 'parent', 'group-parent', 'group-parent', 'field-name', FALSE, 1);
86
-  drupal_add_tabledrag('content-field-overview', 'match', 'parent', 'group-parent', 'group-parent', 'field-name', TRUE, 1);
86
+    drupal_add_tabledrag('content-field-overview', 'match', 'parent', 'group-parent', 'group-parent', 'field-name', TRUE, 1);
87 87
 //  drupal_add_tabledrag('content-field-overview', 'order', 'sibling', 'field-weight', NULL, NULL, FALSE);
88
-  drupal_add_tabledrag('content-field-overview', 'order', 'sibling', 'field-weight');
88
+    drupal_add_tabledrag('content-field-overview', 'order', 'sibling', 'field-weight');
89 89
 
90
-  // Add settings for the update selects behavior.
91
-  $js_fields = array();
92
-  foreach (array_keys(content_existing_field_options($form['#type_name'])) as $field_name) {
90
+    // Add settings for the update selects behavior.
91
+    $js_fields = array();
92
+    foreach (array_keys(content_existing_field_options($form['#type_name'])) as $field_name) {
93 93
     $field = content_fields($field_name);
94 94
     $js_fields[$field_name] = array('label' => $field['widget']['label'], 'type' => $field['type'], 'widget' => $field['widget']['type']);
95
-  }
96
-  drupal_add_js(array('contentWidgetTypes' => content_widget_type_options(), 'contentFields' => $js_fields), 'setting');
97
-  drupal_add_js(drupal_get_path('module', 'content') .'/content.js');
95
+    }
96
+    drupal_add_js(array('contentWidgetTypes' => content_widget_type_options(), 'contentFields' => $js_fields), 'setting');
97
+    drupal_add_js(drupal_get_path('module', 'content') .'/content.js');
98 98
 }
99 99
 
100 100
 /**
101 101
  * Theme preprocess function for content-admin-display-overview-form.tpl.php.
102 102
  */
103 103
 function template_preprocess_content_display_overview_form(&$vars) {
104
-  $form = &$vars['form'];
104
+    $form = &$vars['form'];
105 105
 
106
-  $contexts_selector = $form['#contexts'];
107
-  $vars['basic'] = $contexts_selector == 'basic';
108
-  $vars['contexts'] = content_build_modes($contexts_selector);
106
+    $contexts_selector = $form['#contexts'];
107
+    $vars['basic'] = $contexts_selector == 'basic';
108
+    $vars['contexts'] = content_build_modes($contexts_selector);
109 109
 
110
-  if ($contexts_selector == 'basic') {
110
+    if ($contexts_selector == 'basic') {
111 111
     $help = t("Configure how this content type's fields and field labels should be displayed when it's viewed in teaser and full-page mode.");
112
-  }
113
-  else {
112
+    }
113
+    else {
114 114
     $help = t("Configure how this content type's fields should be displayed when it's rendered in the following contexts.");
115
-  }
116
-  $help .= ' '. t("Use the 'Exclude' checkbox to exclude an item from the !content value passed to the node template.", array('!content' => '$content'));
117
-  $vars['help'] = $help;
115
+    }
116
+    $help .= ' '. t("Use the 'Exclude' checkbox to exclude an item from the !content value passed to the node template.", array('!content' => '$content'));
117
+    $vars['help'] = $help;
118 118
 
119
-  $order = _content_overview_order($form, $form['#fields'], $form['#groups']);
120
-  if (empty($order)) {
119
+    $order = _content_overview_order($form, $form['#fields'], $form['#groups']);
120
+    if (empty($order)) {
121 121
     $vars['rows'] = array();
122 122
     $vars['submit'] = '';
123 123
     return;
124
-  }
124
+    }
125 125
 
126
-  $rows = array();
127
-  foreach ($order as $key) {
126
+    $rows = array();
127
+    foreach ($order as $key) {
128 128
     $element = &$form[$key];
129 129
     $row = new stdClass();
130 130
     foreach (element_children($element) as $child) {
131
-      if (!array_key_exists('exclude', $element[$child])) {
131
+        if (!array_key_exists('exclude', $element[$child])) {
132 132
         $row->{$child} = drupal_render($element[$child]);
133
-      }
134
-      else {
133
+        }
134
+        else {
135 135
         $row->{$child}->format = drupal_render($element[$child]['format']);
136 136
         $row->{$child}->exclude = drupal_render($element[$child]['exclude']);
137
-      }
137
+        }
138 138
     }
139 139
     $row->label_class = in_array($key, $form['#groups']) ? 'label-group' : 'label-field';
140 140
     $row->indentation = theme('indentation', isset($element['#depth']) ? $element['#depth'] : 0);
141 141
     $rows[] = $row;
142
-  }
143
-  $vars['rows'] = $rows;
144
-  $vars['submit'] = drupal_render($form);
142
+    }
143
+    $vars['rows'] = $rows;
144
+    $vars['submit'] = drupal_render($form);
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@
 block discarded – undo
53 53
     $element['hidden_name']['#attributes']['class'] = 'field-name';
54 54
     // Add target classes for the update selects behavior.
55 55
     switch ($element['#row_type']) {
56
-      case 'add_new_field':
57
-        $element['type']['#attributes']['class'] = 'content-field-type-select';
58
-        $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
59
-        break;
60
-      case 'add_existing_field':
61
-        $element['field_name']['#attributes']['class'] = 'content-field-select';
62
-        $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
63
-        $element['label']['#attributes']['class'] = 'content-label-textfield';
64
-        break;
56
+    case 'add_new_field':
57
+      $element['type']['#attributes']['class'] = 'content-field-type-select';
58
+      $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
59
+      break;
60
+    case 'add_existing_field':
61
+      $element['field_name']['#attributes']['class'] = 'content-field-select';
62
+      $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
63
+      $element['label']['#attributes']['class'] = 'content-label-textfield';
64
+      break;
65 65
     }
66 66
     foreach (element_children($element) as $child) {
67 67
       $row->{$child} = drupal_render($element[$child]);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 function template_preprocess_content_field_overview_form(&$vars) {
9 9
   $form = &$vars['form'];
10 10
 
11
-  $vars['help'] = theme('advanced_help_topic', 'content', 'manage-fields') . t('Add fields and groups to the content type, and arrange them on content display and input forms.');
11
+  $vars['help'] = theme('advanced_help_topic', 'content', 'manage-fields').t('Add fields and groups to the content type, and arrange them on content display and input forms.');
12 12
   if (module_exists('fieldgroup')) {
13
-    $vars['help'] .= '<br/>'. t('You can add a field to a group by dragging it below and to the right of the group.');
13
+    $vars['help'] .= '<br/>'.t('You can add a field to a group by dragging it below and to the right of the group.');
14 14
   }
15 15
   if (!module_exists('advanced_help')) {
16
-    $vars['help'] .= '<br/>' . t('Note: Installing the <a href="!adv_help">Advanced help</a> module will let you access more and better help.', array('!adv_help' => 'http://drupal.org/project/advanced_help'));
16
+    $vars['help'] .= '<br/>'.t('Note: Installing the <a href="!adv_help">Advanced help</a> module will let you access more and better help.', array('!adv_help' => 'http://drupal.org/project/advanced_help'));
17 17
   }
18 18
 
19 19
   $order = _content_overview_order($form, $form['#field_rows'], $form['#group_rows']);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     foreach (element_children($element) as $child) {
67 67
       $row->{$child} = drupal_render($element[$child]);
68 68
     }
69
-    $row->label_class = 'label-'. strtr($element['#row_type'], '_', '-');
69
+    $row->label_class = 'label-'.strtr($element['#row_type'], '_', '-');
70 70
     $row->row_type = $element['#row_type'];
71 71
     $row->indentation = theme('indentation', isset($element['#depth']) ? $element['#depth'] : 0);
72 72
     $row->class = 'draggable';
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     $js_fields[$field_name] = array('label' => $field['widget']['label'], 'type' => $field['type'], 'widget' => $field['widget']['type']);
95 95
   }
96 96
   drupal_add_js(array('contentWidgetTypes' => content_widget_type_options(), 'contentFields' => $js_fields), 'setting');
97
-  drupal_add_js(drupal_get_path('module', 'content') .'/content.js');
97
+  drupal_add_js(drupal_get_path('module', 'content').'/content.js');
98 98
 }
99 99
 
100 100
 /**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
   else {
114 114
     $help = t("Configure how this content type's fields should be displayed when it's rendered in the following contexts.");
115 115
   }
116
-  $help .= ' '. t("Use the 'Exclude' checkbox to exclude an item from the !content value passed to the node template.", array('!content' => '$content'));
116
+  $help .= ' '.t("Use the 'Exclude' checkbox to exclude an item from the !content value passed to the node template.", array('!content' => '$content'));
117 117
   $vars['help'] = $help;
118 118
 
119 119
   $order = _content_overview_order($form, $form['#fields'], $form['#groups']);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,8 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
   if ($contexts_selector == 'basic') {
111 111
     $help = t("Configure how this content type's fields and field labels should be displayed when it's viewed in teaser and full-page mode.");
112
-  }
113
-  else {
112
+  } else {
114 113
     $help = t("Configure how this content type's fields should be displayed when it's rendered in the following contexts.");
115 114
   }
116 115
   $help .= ' '. t("Use the 'Exclude' checkbox to exclude an item from the !content value passed to the node template.", array('!content' => '$content'));
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
     foreach (element_children($element) as $child) {
131 130
       if (!array_key_exists('exclude', $element[$child])) {
132 131
         $row->{$child} = drupal_render($element[$child]);
133
-      }
134
-      else {
132
+      } else {
135 133
         $row->{$child}->format = drupal_render($element[$child]['format']);
136 134
         $row->{$child}->exclude = drupal_render($element[$child]['exclude']);
137 135
       }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         $row->row_type = 'separator';
42 42
         $row->class = 'tabledrag-leaf region';
43 43
         $rows[] = $row;
44
-        $added_separator = TRUE;
44
+        $added_separator = true;
45 45
       }
46 46
     }
47 47
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
   // Add tabledrag behavior.
85 85
 //  drupal_add_tabledrag('content-field-overview', 'match', 'parent', 'group-parent', 'group-parent', 'field-name', FALSE, 1);
86
-  drupal_add_tabledrag('content-field-overview', 'match', 'parent', 'group-parent', 'group-parent', 'field-name', TRUE, 1);
86
+  drupal_add_tabledrag('content-field-overview', 'match', 'parent', 'group-parent', 'group-parent', 'field-name', true, 1);
87 87
 //  drupal_add_tabledrag('content-field-overview', 'order', 'sibling', 'field-weight', NULL, NULL, FALSE);
88 88
   drupal_add_tabledrag('content-field-overview', 'order', 'sibling', 'field-weight');
89 89
 
Please login to merge, or discard this patch.
modules/contrib/content_profile/modules/content_profile_registration.module 4 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_form_alter().
11 11
  */
12 12
 function content_profile_registration_form_alter(&$form, &$form_state, $form_id) {
13
-  if ($form_id == 'user_register') {
13
+    if ($form_id == 'user_register') {
14 14
     require_once drupal_get_path('module', 'node') .'/node.pages.inc';
15 15
 
16 16
     // Allow other modules to customize the used profile types, so modules
@@ -19,44 +19,44 @@  discard block
 block discarded – undo
19 19
     $form += array('#content_profile_registration_use_types' => $default_types);
20 20
 
21 21
     foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
22
-      content_profile_registration_add_profile_form($type, $form, $form_state);
22
+        content_profile_registration_add_profile_form($type, $form, $form_state);
23 23
     }
24
-  }
25
-  elseif ($form_id == 'content_profile_admin_settings') {
24
+    }
25
+    elseif ($form_id == 'content_profile_admin_settings') {
26 26
     $type = $form_state['type'];
27 27
     // Let other modules add registration child elements before us!
28 28
     $form += array('registration' => array());
29 29
     $form['registration'] += array(
30
-      '#type' => 'fieldset',
31
-      '#title' => t('User Registration'),
32
-      '#description' => t('Customize how this content profile shows up on the user registration page.'),
33
-      '#collapsible' => TRUE,
30
+        '#type' => 'fieldset',
31
+        '#title' => t('User Registration'),
32
+        '#description' => t('Customize how this content profile shows up on the user registration page.'),
33
+        '#collapsible' => TRUE,
34 34
     );
35 35
     $form['registration']['registration_use'] = array(
36
-      '#type' => 'checkbox',
37
-      '#title' => t('Use on Registration'),
38
-      '#description' => t('Use this content type on the user registration page'),
39
-      '#default_value' => content_profile_get_settings($type, 'registration_use'),
36
+        '#type' => 'checkbox',
37
+        '#title' => t('Use on Registration'),
38
+        '#description' => t('Use this content type on the user registration page'),
39
+        '#default_value' => content_profile_get_settings($type, 'registration_use'),
40 40
     );
41 41
     $form['registration']['admin_user_create_use'] = array(
42
-      '#type' => 'checkbox',
43
-      '#title' => t('Use on administrative user creation form'),
44
-      '#description' => t('Use this content type when an administrative user creates a new user'),
45
-      '#default_value' => content_profile_get_settings($type, 'admin_user_create_use'),
42
+        '#type' => 'checkbox',
43
+        '#title' => t('Use on administrative user creation form'),
44
+        '#description' => t('Use this content type when an administrative user creates a new user'),
45
+        '#default_value' => content_profile_get_settings($type, 'admin_user_create_use'),
46 46
     );
47 47
     $form['registration']['registration_hide'] = array(
48
-      '#type' => 'checkboxes',
49
-      '#title' => t('Hide form fields'),
50
-      '#description' => t('Hide fields from the user registration form. Required fields cannot be hidden and are not shown here.'),
51
-      '#options' => _content_profile_registration_get_field_select($type),
52
-      '#default_value' => content_profile_get_settings($type, 'registration_hide'),
48
+        '#type' => 'checkboxes',
49
+        '#title' => t('Hide form fields'),
50
+        '#description' => t('Hide fields from the user registration form. Required fields cannot be hidden and are not shown here.'),
51
+        '#options' => _content_profile_registration_get_field_select($type),
52
+        '#default_value' => content_profile_get_settings($type, 'registration_hide'),
53 53
     );
54 54
     array_unshift($form['#submit'], 'content_profile_registration_admin_form_submit');
55
-  }
55
+    }
56 56
 }
57 57
 
58 58
 function content_profile_registration_admin_form_submit($form, &$form_state) {
59
-  $form_state['values']['registration_hide'] = array_keys(array_filter($form_state['values']['registration_hide']));
59
+    $form_state['values']['registration_hide'] = array_keys(array_filter($form_state['values']['registration_hide']));
60 60
 }
61 61
 
62 62
 /**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
  *   Associated fields for the given content type.
69 69
  */
70 70
 function _content_profile_registration_get_fields($type) {
71
-  $typeinfo = content_types($type);
72
-  return $typeinfo['fields'];
71
+    $typeinfo = content_types($type);
72
+    return $typeinfo['fields'];
73 73
 }
74 74
 
75 75
 /**
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
  *   An array of fields suitable for use in a select field.
82 82
 */
83 83
 function _content_profile_registration_get_field_select($type) {
84
-  $fields = module_exists('content') ? _content_profile_registration_get_fields($type) : array();
85
-  $return = array();
86
-  if (!module_exists('auto_nodetitle') || auto_nodetitle_get_setting($type) != AUTO_NODETITLE_ENABLED) {
84
+    $fields = module_exists('content') ? _content_profile_registration_get_fields($type) : array();
85
+    $return = array();
86
+    if (!module_exists('auto_nodetitle') || auto_nodetitle_get_setting($type) != AUTO_NODETITLE_ENABLED) {
87 87
     $return['title'] = t('Title');
88
-  }
89
-  foreach ($fields as $fieldname => $info) {
88
+    }
89
+    foreach ($fields as $fieldname => $info) {
90 90
     if (!$info['required']) {
91
-      $return[$fieldname] = drupal_ucfirst($info['widget']['label']);
91
+        $return[$fieldname] = drupal_ucfirst($info['widget']['label']);
92 92
     }
93
-  }
94
-  $return['other'] = t('Other form elements (except for required CCK fields)');
93
+    }
94
+    $return['other'] = t('Other form elements (except for required CCK fields)');
95 95
   
96
-  return $return;
96
+    return $return;
97 97
 }
98 98
 
99 99
 /**
@@ -104,28 +104,28 @@  discard block
 block discarded – undo
104 104
  * @see content_profile_registration_user_register_submit()
105 105
  */
106 106
 function content_profile_registration_add_profile_form($type, &$form, &$form_state) {
107
-  // Initialize new node and add in its form.
108
-  $node = array('uid' => 0, 'name' => '', 'type' => $type);
109
-  // Get the original node form.
110
-  $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node);
111
-  drupal_prepare_form($type .'_node_form', $node_form, $form_state);
107
+    // Initialize new node and add in its form.
108
+    $node = array('uid' => 0, 'name' => '', 'type' => $type);
109
+    // Get the original node form.
110
+    $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node);
111
+    drupal_prepare_form($type .'_node_form', $node_form, $form_state);
112 112
 
113
-  $node_form += array('#field_info' => array());
114
-  $form_add = array();
113
+    $node_form += array('#field_info' => array());
114
+    $form_add = array();
115 115
 
116
-  // If non-CCK form elements are hidden, only copy over the CCK stuff
117
-  if (in_array('other', content_profile_get_settings($type, 'registration_hide'))) {
116
+    // If non-CCK form elements are hidden, only copy over the CCK stuff
117
+    if (in_array('other', content_profile_get_settings($type, 'registration_hide'))) {
118 118
     foreach ($node_form['#field_info'] as $field_name => $info) {
119
-      if (isset($node_form[$field_name])) {
119
+        if (isset($node_form[$field_name])) {
120 120
         $form_add[$field_name] = $node_form[$field_name];
121
-      }
121
+        }
122 122
     }
123 123
     // Copy over any fieldgroups
124 124
     $keys = array_keys($node_form);
125 125
     foreach ($keys as $key) {
126
-      if (stristr($key, 'group_')) {
126
+        if (stristr($key, 'group_')) {
127 127
         $form_add[$key] = $node_form[$key];
128
-      }
128
+        }
129 129
     }
130 130
     // Add the title
131 131
     $form_add['title'] = $node_form['title'];
@@ -133,51 +133,51 @@  discard block
 block discarded – undo
133 133
     // Set this to the values of one node, as it might be need by some #ahah callbacks
134 134
     $form_add['#node'] = $node_form['#node'];
135 135
     $form_add['type'] = $node_form['type'];
136
-  }
137
-  else {
136
+    }
137
+    else {
138 138
     foreach (array('uid', 'name', 'author', 'buttons', 'language', '#theme', 'options') as $key) {
139
-      unset($node_form[$key]);
139
+        unset($node_form[$key]);
140 140
     }
141 141
     $form_add = $node_form;
142
-  }
142
+    }
143 143
 
144
-  // Hide fields as configured
145
-  foreach (content_profile_get_settings($type, 'registration_hide') as $field_name) {
144
+    // Hide fields as configured
145
+    foreach (content_profile_get_settings($type, 'registration_hide') as $field_name) {
146 146
     if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type, $field_name))) {
147
-      unset($form_add[$group_name][$field_name]);
148
-      if (count(element_children($form_add[$group_name])) == 0) {
147
+        unset($form_add[$group_name][$field_name]);
148
+        if (count(element_children($form_add[$group_name])) == 0) {
149 149
         unset($form_add[$group_name]);
150
-      }
150
+        }
151 151
     }
152 152
     else {
153
-      unset($form_add[$field_name]);
153
+        unset($form_add[$field_name]);
154
+    }
154 155
     }
155
-  }
156 156
   
157
-  // Add in the new form elements into $form.
158
-  $form += array('#field_info' => array());
159
-  $form['#field_info'] += $node_form['#field_info'];
160
-  $form += $form_add;
157
+    // Add in the new form elements into $form.
158
+    $form += array('#field_info' => array());
159
+    $form['#field_info'] += $node_form['#field_info'];
160
+    $form += $form_add;
161 161
   
162
-  // Add in further callbacks needed, if not yet done.
163
-  if (!isset($form['#content_profile_weights'])) {
162
+    // Add in further callbacks needed, if not yet done.
163
+    if (!isset($form['#content_profile_weights'])) {
164 164
     $form['#submit'][] = 'content_profile_registration_user_register_submit';
165 165
     $form['#validate'][] = 'content_profile_registration_user_register_validate';
166 166
     $form['#pre_render'][] = 'content_profile_registration_alter_weights';
167
-  }
167
+    }
168 168
 
169
-  // Care for the weights: Make use of the content types weight and sort the fields in behalf
170
-  // The weights will be applied by the pre_render callback.
171
-  $form += array('#content_profile_weights' => array());
172
-  $weight = content_profile_get_settings($type, 'weight') + 1;
173
-  foreach (element_children($form_add) as $key) {
169
+    // Care for the weights: Make use of the content types weight and sort the fields in behalf
170
+    // The weights will be applied by the pre_render callback.
171
+    $form += array('#content_profile_weights' => array());
172
+    $weight = content_profile_get_settings($type, 'weight') + 1;
173
+    foreach (element_children($form_add) as $key) {
174 174
     $form['#content_profile_weights'] += array($key => $weight);
175
-  }
175
+    }
176 176
 
177
-  // Set the enctype, if necessary.
178
-  if (isset($node_form['#attributes']['enctype'])){
177
+    // Set the enctype, if necessary.
178
+    if (isset($node_form['#attributes']['enctype'])){
179 179
     $form['#attributes']['enctype'] = $node_form['#attributes']['enctype'];
180
-  }
180
+    }
181 181
 }
182 182
 
183 183
 /**
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
  * @see content_profile_registration_add_profile_form().
188 188
  */
189 189
 function content_profile_registration_alter_weights($elements) {
190
-  foreach ($elements['#content_profile_weights'] as $key => $weight) {
190
+    foreach ($elements['#content_profile_weights'] as $key => $weight) {
191 191
     if (isset($elements[$key]) && is_array($elements[$key])) {
192
-      $elements[$key] += array('#weight' => 0);
193
-      $elements[$key]['#weight'] = $weight + $elements[$key]['#weight'] / 1000;
192
+        $elements[$key] += array('#weight' => 0);
193
+        $elements[$key]['#weight'] = $weight + $elements[$key]['#weight'] / 1000;
194 194
     }
195
-  }
196
-  return $elements;
195
+    }
196
+    return $elements;
197 197
 }
198 198
 
199 199
 
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
  * Validates the user registration form
202 202
  */
203 203
 function content_profile_registration_user_register_validate($form, &$form_state) {
204
-  require_once drupal_get_path('module', 'node') .'/node.pages.inc';
204
+    require_once drupal_get_path('module', 'node') .'/node.pages.inc';
205 205
 
206
-  foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
206
+    foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
207 207
     $node = (object)$form_state['values'];
208 208
     $node->type = $type;
209 209
     node_object_prepare($node);
@@ -212,32 +212,32 @@  discard block
 block discarded – undo
212 212
     unset($node->name);
213 213
 
214 214
     if (!in_array('other', content_profile_get_settings($type, 'registration_hide'))) {
215
-      node_validate($node, $form);
215
+        node_validate($node, $form);
216 216
     }
217 217
     elseif (module_exists('content')) {
218
-      content_validate($node);
218
+        content_validate($node);
219 219
     }
220 220
 
221 221
     $form_state['content_profile_registration'][$type]['node'] = $node;
222
-  }
223
-  // Remove our added values
224
-  foreach ($form['#content_profile_weights'] as $key => $weight) {
222
+    }
223
+    // Remove our added values
224
+    foreach ($form['#content_profile_weights'] as $key => $weight) {
225 225
     _content_profile_registration_remove_values($key, $form[$key], $form_state);
226
-  }
226
+    }
227 227
 }
228 228
 
229 229
 /**
230 230
  * Recursivly removes all form values created by this element or its children.
231 231
  */
232 232
 function _content_profile_registration_remove_values($key, $element, &$form_state) {
233
-  if ((isset($element['#input']) || !empty($element['#tree'])) && isset($form_state['values'][$key])) {
233
+    if ((isset($element['#input']) || !empty($element['#tree'])) && isset($form_state['values'][$key])) {
234 234
     unset($form_state['values'][$key]);
235
-  }
236
-  elseif (empty($element['#input']) && empty($element['#tree'])) {
235
+    }
236
+    elseif (empty($element['#input']) && empty($element['#tree'])) {
237 237
     foreach (element_children($element) as $key) {
238
-      _content_profile_registration_remove_values($key, $element[$key], $form_state);
238
+        _content_profile_registration_remove_values($key, $element[$key], $form_state);
239
+    }
239 240
     }
240
-  }
241 241
 }
242 242
 
243 243
 
@@ -245,33 +245,33 @@  discard block
 block discarded – undo
245 245
  * Submits the user registration form
246 246
  */
247 247
 function content_profile_registration_user_register_submit($form, &$form_state) {
248
-  foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
248
+    foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
249 249
     if ($node = &$form_state['content_profile_registration'][$type]['node']) {
250
-      // Set user's information for the node.
251
-      if (empty($node->title) && (!module_exists('auto_nodetitle') || auto_nodetitle_get_setting($type) != AUTO_NODETITLE_OPTIONAL)) {
250
+        // Set user's information for the node.
251
+        if (empty($node->title) && (!module_exists('auto_nodetitle') || auto_nodetitle_get_setting($type) != AUTO_NODETITLE_OPTIONAL)) {
252 252
         $node->title = $form_state['user']->name;
253
-      }
254
-      $node->uid = $form_state['user']->uid;
255
-      $node->name = $form_state['user']->name;
253
+        }
254
+        $node->uid = $form_state['user']->uid;
255
+        $node->name = $form_state['user']->name;
256 256
 
257
-      // Create the node.
258
-      $node = node_submit($node);
259
-      node_save($node);
260
-      // Give us a nice log message.
261
-      if ($node->nid) {
257
+        // Create the node.
258
+        $node = node_submit($node);
259
+        node_save($node);
260
+        // Give us a nice log message.
261
+        if ($node->nid) {
262 262
         watchdog('content', 'Content Profile: added %user %type upon registration.', array('%user' => $node->name, '%type' => $type), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
263
-      }
263
+        }
264
+    }
264 265
     }
265
-  }
266 266
 }
267 267
 
268 268
 /**
269 269
  * Implementation of hook_content_profile_settings().
270 270
  */
271 271
 function content_profile_registration_content_profile_settings() {
272
-  return array(
272
+    return array(
273 273
     'registration_use' => FALSE,
274 274
     'admin_user_create_use' => FALSE,
275 275
     'registration_hide' => array(),
276
-  );
276
+    );
277 277
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function content_profile_registration_form_alter(&$form, &$form_state, $form_id) {
13 13
   if ($form_id == 'user_register') {
14
-    require_once drupal_get_path('module', 'node') .'/node.pages.inc';
14
+    require_once drupal_get_path('module', 'node').'/node.pages.inc';
15 15
 
16 16
     // Allow other modules to customize the used profile types, so modules
17 17
     // can easily customize the registration form.
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
   // Initialize new node and add in its form.
108 108
   $node = array('uid' => 0, 'name' => '', 'type' => $type);
109 109
   // Get the original node form.
110
-  $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node);
111
-  drupal_prepare_form($type .'_node_form', $node_form, $form_state);
110
+  $node_form = drupal_retrieve_form($type.'_node_form', $form_state, $node);
111
+  drupal_prepare_form($type.'_node_form', $node_form, $form_state);
112 112
 
113 113
   $node_form += array('#field_info' => array());
114 114
   $form_add = array();
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
   }
176 176
 
177 177
   // Set the enctype, if necessary.
178
-  if (isset($node_form['#attributes']['enctype'])){
178
+  if (isset($node_form['#attributes']['enctype'])) {
179 179
     $form['#attributes']['enctype'] = $node_form['#attributes']['enctype'];
180 180
   }
181 181
 }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
   foreach ($elements['#content_profile_weights'] as $key => $weight) {
191 191
     if (isset($elements[$key]) && is_array($elements[$key])) {
192 192
       $elements[$key] += array('#weight' => 0);
193
-      $elements[$key]['#weight'] = $weight + $elements[$key]['#weight'] / 1000;
193
+      $elements[$key]['#weight'] = $weight + $elements[$key]['#weight']/1000;
194 194
     }
195 195
   }
196 196
   return $elements;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
  * Validates the user registration form
202 202
  */
203 203
 function content_profile_registration_user_register_validate($form, &$form_state) {
204
-  require_once drupal_get_path('module', 'node') .'/node.pages.inc';
204
+  require_once drupal_get_path('module', 'node').'/node.pages.inc';
205 205
 
206 206
   foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
207 207
     $node = (object)$form_state['values'];
Please login to merge, or discard this patch.
Braces   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
     foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
22 22
       content_profile_registration_add_profile_form($type, $form, $form_state);
23 23
     }
24
-  }
25
-  elseif ($form_id == 'content_profile_admin_settings') {
24
+  } elseif ($form_id == 'content_profile_admin_settings') {
26 25
     $type = $form_state['type'];
27 26
     // Let other modules add registration child elements before us!
28 27
     $form += array('registration' => array());
@@ -133,8 +132,7 @@  discard block
 block discarded – undo
133 132
     // Set this to the values of one node, as it might be need by some #ahah callbacks
134 133
     $form_add['#node'] = $node_form['#node'];
135 134
     $form_add['type'] = $node_form['type'];
136
-  }
137
-  else {
135
+  } else {
138 136
     foreach (array('uid', 'name', 'author', 'buttons', 'language', '#theme', 'options') as $key) {
139 137
       unset($node_form[$key]);
140 138
     }
@@ -148,8 +146,7 @@  discard block
 block discarded – undo
148 146
       if (count(element_children($form_add[$group_name])) == 0) {
149 147
         unset($form_add[$group_name]);
150 148
       }
151
-    }
152
-    else {
149
+    } else {
153 150
       unset($form_add[$field_name]);
154 151
     }
155 152
   }
@@ -175,7 +172,7 @@  discard block
 block discarded – undo
175 172
   }
176 173
 
177 174
   // Set the enctype, if necessary.
178
-  if (isset($node_form['#attributes']['enctype'])){
175
+  if (isset($node_form['#attributes']['enctype'])) {
179 176
     $form['#attributes']['enctype'] = $node_form['#attributes']['enctype'];
180 177
   }
181 178
 }
@@ -213,8 +210,7 @@  discard block
 block discarded – undo
213 210
 
214 211
     if (!in_array('other', content_profile_get_settings($type, 'registration_hide'))) {
215 212
       node_validate($node, $form);
216
-    }
217
-    elseif (module_exists('content')) {
213
+    } elseif (module_exists('content')) {
218 214
       content_validate($node);
219 215
     }
220 216
 
@@ -232,8 +228,7 @@  discard block
 block discarded – undo
232 228
 function _content_profile_registration_remove_values($key, $element, &$form_state) {
233 229
   if ((isset($element['#input']) || !empty($element['#tree'])) && isset($form_state['values'][$key])) {
234 230
     unset($form_state['values'][$key]);
235
-  }
236
-  elseif (empty($element['#input']) && empty($element['#tree'])) {
231
+  } elseif (empty($element['#input']) && empty($element['#tree'])) {
237 232
     foreach (element_children($element) as $key) {
238 233
       _content_profile_registration_remove_values($key, $element[$key], $form_state);
239 234
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
       '#type' => 'fieldset',
31 31
       '#title' => t('User Registration'),
32 32
       '#description' => t('Customize how this content profile shows up on the user registration page.'),
33
-      '#collapsible' => TRUE,
33
+      '#collapsible' => true,
34 34
     );
35 35
     $form['registration']['registration_use'] = array(
36 36
       '#type' => 'checkbox',
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
  */
271 271
 function content_profile_registration_content_profile_settings() {
272 272
   return array(
273
-    'registration_use' => FALSE,
274
-    'admin_user_create_use' => FALSE,
273
+    'registration_use' => false,
274
+    'admin_user_create_use' => false,
275 275
     'registration_hide' => array(),
276 276
   );
277 277
 }
Please login to merge, or discard this patch.
boinc/modules/contrib/content_profile/modules/content_profile_tokens.module 5 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -12,83 +12,83 @@
 block discarded – undo
12 12
  * Implementation of hook_token_values().
13 13
  */
14 14
 function content_profile_tokens_token_values($type, $object = NULL, $options = array()) {
15
-  $values = array();
16
-  $types = content_profile_get_types('types');
17
-  switch ($type) {
15
+    $values = array();
16
+    $types = content_profile_get_types('types');
17
+    switch ($type) {
18 18
     case 'user':
19 19
       foreach($types as $type_name => $type) {
20 20
         if (isset($object)) {
21
-          $profile = content_profile_load($type_name, $object->uid);
21
+            $profile = content_profile_load($type_name, $object->uid);
22 22
         }
23 23
         else {
24
-          global $user;
25
-          $profile = content_profile_load($type_name, $user->uid);
24
+            global $user;
25
+            $profile = content_profile_load($type_name, $user->uid);
26 26
         }
27 27
         $fields = content_types($type_name);
28 28
         foreach ($fields['fields'] as $field_name => $field) {
29
-          if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
32
-          }
29
+            if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
+                $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
+                $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
32
+            }
33
+        }
33 34
         }
34
-      }
35
-      break;
35
+        break;
36 36
 
37 37
     case 'flag_friend':
38 38
       if(!empty($object)) {
39 39
         foreach($types as $type_name => $type) {
40
-          $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41
-          $profile_requestee = content_profile_load($type_name, $object->uid);
40
+            $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41
+            $profile_requestee = content_profile_load($type_name, $object->uid);
42 42
           
43
-          $fields = content_types($type_name);
44
-          foreach ($fields['fields'] as $field_name => $field) {
43
+            $fields = content_types($type_name);
44
+            foreach ($fields['fields'] as $field_name => $field) {
45 45
             if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
46
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
46
+                $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
+                $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
48 48
               
49
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
49
+                $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
+                $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
51 51
             }
52
-          }
52
+            }
53
+        }
53 54
         }
54
-      }
55
-      break;
56
-  }
57
-  return $values;
55
+        break;
56
+    }
57
+    return $values;
58 58
 }
59 59
 
60 60
 /**
61 61
  * Implementation of hook_token_list().
62 62
  */
63 63
 function content_profile_tokens_token_list($type = 'all') {
64
-  $tokens = array();
65
-  if ($type == 'user' || $type == 'all') {
64
+    $tokens = array();
65
+    if ($type == 'user' || $type == 'all') {
66 66
     $types = content_profile_get_types('types');
67 67
     foreach ($types as $type_name => $type) {
68 68
     
69
-      $fields = content_types($type_name);
70
-      foreach ($fields['fields'] as $field_name => $field) {
69
+        $fields = content_types($type_name);
70
+        foreach ($fields['fields'] as $field_name => $field) {
71 71
         if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
72
-          $tokens['user']['content-profile-'. $type_name .'-'. substr($field_name, 6)] = t($fields['description']) .'-'. t($field['widget']['label']);
73
-          $tokens['user']['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
72
+            $tokens['user']['content-profile-'. $type_name .'-'. substr($field_name, 6)] = t($fields['description']) .'-'. t($field['widget']['label']);
73
+            $tokens['user']['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
74
+        }
74 75
         }
75
-      }
76 76
     }
77
-  }
77
+    }
78 78
   
79
-  if ($type == 'flag_friend' && module_exists('flag_friend')) {
79
+    if ($type == 'flag_friend' && module_exists('flag_friend')) {
80 80
     foreach($types as $type_name => $type) {
81
-      $fields = content_types($type_name);
82
-      foreach ($fields['fields'] as $field_name => $field) {
81
+        $fields = content_types($type_name);
82
+        foreach ($fields['fields'] as $field_name => $field) {
83 83
         if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
84
-          $tokens['content_profile_flag_friend']['requestor-'. $type_name .'-'. substr($field_name, 6)] = t('Requestor:') . t($fields['description']) .'-'. t($field['widget']['label']);
85
-          $tokens['content_profile_flag_friend']['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t('Requestor:') . t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
84
+            $tokens['content_profile_flag_friend']['requestor-'. $type_name .'-'. substr($field_name, 6)] = t('Requestor:') . t($fields['description']) .'-'. t($field['widget']['label']);
85
+            $tokens['content_profile_flag_friend']['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t('Requestor:') . t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
86 86
 
87
-          $tokens['content_profile_flag_friend']['requestee-'. $type_name .'-'. substr($field_name, 6)] = t('Requestee:') . t($fields['description']) .'-'. t($field['widget']['label']);
88
-          $tokens['content_profile_flag_friend']['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t('Requestee:') .t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
87
+            $tokens['content_profile_flag_friend']['requestee-'. $type_name .'-'. substr($field_name, 6)] = t('Requestee:') . t($fields['description']) .'-'. t($field['widget']['label']);
88
+            $tokens['content_profile_flag_friend']['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t('Requestee:') .t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
89
+        }
89 90
         }
90
-      }
91 91
     }
92
-  }
93
-  return $tokens;
92
+    }
93
+    return $tokens;
94 94
 }
Please login to merge, or discard this patch.
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@
 block discarded – undo
15 15
   $values = array();
16 16
   $types = content_profile_get_types('types');
17 17
   switch ($type) {
18
-    case 'user':
19
-      foreach($types as $type_name => $type) {
20
-        if (isset($object)) {
21
-          $profile = content_profile_load($type_name, $object->uid);
22
-        }
23
-        else {
24
-          global $user;
25
-          $profile = content_profile_load($type_name, $user->uid);
26
-        }
27
-        $fields = content_types($type_name);
28
-        foreach ($fields['fields'] as $field_name => $field) {
29
-          if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
32
-          }
18
+  case 'user':
19
+    foreach($types as $type_name => $type) {
20
+      if (isset($object)) {
21
+        $profile = content_profile_load($type_name, $object->uid);
22
+      }
23
+      else {
24
+        global $user;
25
+        $profile = content_profile_load($type_name, $user->uid);
26
+      }
27
+      $fields = content_types($type_name);
28
+      foreach ($fields['fields'] as $field_name => $field) {
29
+        if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
+            $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
+            $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
33 32
         }
34 33
       }
35
-      break;
34
+    }
35
+    break;
36 36
 
37
-    case 'flag_friend':
38
-      if(!empty($object)) {
39
-        foreach($types as $type_name => $type) {
40
-          $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41
-          $profile_requestee = content_profile_load($type_name, $object->uid);
37
+  case 'flag_friend':
38
+    if(!empty($object)) {
39
+      foreach($types as $type_name => $type) {
40
+        $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41
+        $profile_requestee = content_profile_load($type_name, $object->uid);
42 42
           
43
-          $fields = content_types($type_name);
44
-          foreach ($fields['fields'] as $field_name => $field) {
45
-            if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
46
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
43
+        $fields = content_types($type_name);
44
+        foreach ($fields['fields'] as $field_name => $field) {
45
+          if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
46
+            $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
+            $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
48 48
               
49
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
51
-            }
49
+            $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
+            $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
52 51
           }
53 52
         }
54 53
       }
55
-      break;
54
+    }
55
+    break;
56 56
   }
57 57
   return $values;
58 58
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
   $types = content_profile_get_types('types');
17 17
   switch ($type) {
18 18
     case 'user':
19
-      foreach($types as $type_name => $type) {
19
+      foreach ($types as $type_name => $type) {
20 20
         if (isset($object)) {
21 21
           $profile = content_profile_load($type_name, $object->uid);
22 22
         }
@@ -27,27 +27,27 @@  discard block
 block discarded – undo
27 27
         $fields = content_types($type_name);
28 28
         foreach ($fields['fields'] as $field_name => $field) {
29 29
           if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
30
+              $values['content-profile-'.$type_name.'-'.substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
+              $values['content-profile-'.$type_name.'-'.substr($field_name, 6).'-raw'] = $profile->{$field_name}[0]['value'];
32 32
           }
33 33
         }
34 34
       }
35 35
       break;
36 36
 
37 37
     case 'flag_friend':
38
-      if(!empty($object)) {
39
-        foreach($types as $type_name => $type) {
38
+      if (!empty($object)) {
39
+        foreach ($types as $type_name => $type) {
40 40
           $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41 41
           $profile_requestee = content_profile_load($type_name, $object->uid);
42 42
           
43 43
           $fields = content_types($type_name);
44 44
           foreach ($fields['fields'] as $field_name => $field) {
45 45
             if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
46
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
46
+              $values['requestor-'.$type_name.'-'.substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
+              $values['requestor-'.$type_name.'-'.substr($field_name, 6).'-raw'] = $profile_requestor->{$field_name}[0]['value'];
48 48
               
49
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
49
+              $values['requestee-'.$type_name.'-'.substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
+              $values['requestee-'.$type_name.'-'.substr($field_name, 6).'-raw'] = $profile_requestee->{$field_name}[0]['value'];
51 51
             }
52 52
           }
53 53
         }
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
       $fields = content_types($type_name);
70 70
       foreach ($fields['fields'] as $field_name => $field) {
71 71
         if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
72
-          $tokens['user']['content-profile-'. $type_name .'-'. substr($field_name, 6)] = t($fields['description']) .'-'. t($field['widget']['label']);
73
-          $tokens['user']['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
72
+          $tokens['user']['content-profile-'.$type_name.'-'.substr($field_name, 6)] = t($fields['description']).'-'.t($field['widget']['label']);
73
+          $tokens['user']['content-profile-'.$type_name.'-'.substr($field_name, 6).'-raw'] = t($fields['description']).'-'.t($field['widget']['label']).' '.t('WARNING - raw user input');
74 74
         }
75 75
       }
76 76
     }
77 77
   }
78 78
   
79 79
   if ($type == 'flag_friend' && module_exists('flag_friend')) {
80
-    foreach($types as $type_name => $type) {
80
+    foreach ($types as $type_name => $type) {
81 81
       $fields = content_types($type_name);
82 82
       foreach ($fields['fields'] as $field_name => $field) {
83 83
         if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
84
-          $tokens['content_profile_flag_friend']['requestor-'. $type_name .'-'. substr($field_name, 6)] = t('Requestor:') . t($fields['description']) .'-'. t($field['widget']['label']);
85
-          $tokens['content_profile_flag_friend']['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t('Requestor:') . t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
84
+          $tokens['content_profile_flag_friend']['requestor-'.$type_name.'-'.substr($field_name, 6)] = t('Requestor:').t($fields['description']).'-'.t($field['widget']['label']);
85
+          $tokens['content_profile_flag_friend']['requestor-'.$type_name.'-'.substr($field_name, 6).'-raw'] = t('Requestor:').t($fields['description']).'-'.t($field['widget']['label']).' '.t('WARNING - raw user input');
86 86
 
87
-          $tokens['content_profile_flag_friend']['requestee-'. $type_name .'-'. substr($field_name, 6)] = t('Requestee:') . t($fields['description']) .'-'. t($field['widget']['label']);
88
-          $tokens['content_profile_flag_friend']['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = t('Requestee:') .t($fields['description']) .'-'. t($field['widget']['label']) .' '. t('WARNING - raw user input');
87
+          $tokens['content_profile_flag_friend']['requestee-'.$type_name.'-'.substr($field_name, 6)] = t('Requestee:').t($fields['description']).'-'.t($field['widget']['label']);
88
+          $tokens['content_profile_flag_friend']['requestee-'.$type_name.'-'.substr($field_name, 6).'-raw'] = t('Requestee:').t($fields['description']).'-'.t($field['widget']['label']).' '.t('WARNING - raw user input');
89 89
         }
90 90
       }
91 91
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
       foreach($types as $type_name => $type) {
20 20
         if (isset($object)) {
21 21
           $profile = content_profile_load($type_name, $object->uid);
22
-        }
23
-        else {
22
+        } else {
24 23
           global $user;
25 24
           $profile = content_profile_load($type_name, $user->uid);
26 25
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 /**
12 12
  * Implementation of hook_token_values().
13 13
  */
14
-function content_profile_tokens_token_values($type, $object = NULL, $options = array()) {
14
+function content_profile_tokens_token_values($type, $object = null, $options = array()) {
15 15
   $values = array();
16 16
   $types = content_profile_get_types('types');
17 17
   switch ($type) {
Please login to merge, or discard this patch.
default/boinc/modules/contrib/content_profile/content_profile.rules.inc 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,79 +10,79 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_rules_condition_info().
11 11
  */
12 12
 function content_profile_rules_condition_info() {
13
-  return array(
13
+    return array(
14 14
     'content_profile_user_has_profile_condition' => array(
15
-      'label' => t('User has content profile'),
16
-      'arguments' => array(
15
+        'label' => t('User has content profile'),
16
+        'arguments' => array(
17 17
         'user' => array('type' => 'user', 'label' => t('User')),
18
-      ),
19
-      'module' => 'Content Profile',
18
+        ),
19
+        'module' => 'Content Profile',
20 20
     ),
21
-  );
21
+    );
22 22
 }
23 23
 
24 24
 function content_profile_user_has_profile_condition($user, $settings) {
25
-  $node = content_profile_load($settings['type'], $user->uid);
26
-  return (bool)$node;
25
+    $node = content_profile_load($settings['type'], $user->uid);
26
+    return (bool)$node;
27 27
 }
28 28
 
29 29
 function content_profile_user_has_profile_condition_form($settings, &$form) {
30
-  $settings += array('type' => array());
31
-  $form['settings']['type'] = array(
30
+    $settings += array('type' => array());
31
+    $form['settings']['type'] = array(
32 32
     '#type' => 'select',
33 33
     '#title' => t('Content Profile Content Type'),
34 34
     '#options' => content_profile_get_types('names'),
35 35
     '#default_value' => $settings['type'],
36 36
     '#description' => t('Select the Content Profile content type to check for.'),
37 37
     '#required' => TRUE,
38
-  );
38
+    );
39 39
 }
40 40
 
41 41
 function content_profile_user_has_profile_condition_label($settings, $argument_labels) {
42
-  return t('@user has his @type created', $argument_labels + array('@type' => node_get_types('name', $settings['type'])));
42
+    return t('@user has his @type created', $argument_labels + array('@type' => node_get_types('name', $settings['type'])));
43 43
 }
44 44
 
45 45
 /**
46 46
  * Implementation of hook_rules_action_info().
47 47
  */
48 48
 function content_profile_rules_action_info() {
49
-  return array(
49
+    return array(
50 50
     'content_profile_action_load' => array(
51
-      'label' => t('Load Content Profile'),
52
-      'arguments' => array(
51
+        'label' => t('Load Content Profile'),
52
+        'arguments' => array(
53 53
         'user' => array('type' => 'user', 'label' => t('User, whose profile should be loaded')),
54
-      ),
55
-      'new variables' => array(
54
+        ),
55
+        'new variables' => array(
56 56
         'profile_node' => array('type' => 'node', 'label' => t('Content Profile')),
57
-      ),
58
-      'module' => 'Content Profile',
57
+        ),
58
+        'module' => 'Content Profile',
59 59
     ),
60
-  );
60
+    );
61 61
 }
62 62
 
63 63
 /**
64 64
  * Loads a Content Profile
65 65
  */
66 66
 function content_profile_action_load($user, $settings) {
67
-  if ($node = content_profile_load($settings['type'], $user->uid)) {
67
+    if ($node = content_profile_load($settings['type'], $user->uid)) {
68 68
     return array('profile_node' => $node);
69
-  }
69
+    }
70 70
 }
71 71
 
72 72
 function content_profile_action_load_form($settings, &$form) {
73
-  $settings += array('type' => array());
74
-  $form['settings']['type'] = array(
73
+    $settings += array('type' => array());
74
+    $form['settings']['type'] = array(
75 75
     '#type' => 'select',
76 76
     '#title' => t('Content Profile Content Type'),
77 77
     '#options' => content_profile_get_types('names'),
78 78
     '#default_value' => $settings['type'],
79 79
     '#description' => t('Select the Content Profile content type to load.'),
80 80
     '#required' => TRUE,
81
-  );
81
+    );
82 82
 }
83 83
 
84 84
 function content_profile_action_load_label($settings, $argument_labels) {
85
-  return t("Load @user's @type", $argument_labels + array('@type' => node_get_types('name', $settings['type'])));
85
+    return t("Load @user's @type", $argument_labels + array('@type' => node_get_types('name', $settings['type'])));
86 86
 }
87 87
 
88 88
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
  * Support upgrading from nodeprofile-workflow-ng integration.
91 91
  */
92 92
 function nodeprofile_user_has_profile_condition_upgrade(&$element) {
93
-  $element['#name'] = 'content_profile_user_has_profile_condition';
93
+    $element['#name'] = 'content_profile_user_has_profile_condition';
94 94
 }
95 95
 function nodeprofile_action_load_upgrade(&$element) {
96
-  $element['#name'] = 'content_profile_action_load';
96
+    $element['#name'] = 'content_profile_action_load';
97 97
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     '#options' => content_profile_get_types('names'),
35 35
     '#default_value' => $settings['type'],
36 36
     '#description' => t('Select the Content Profile content type to check for.'),
37
-    '#required' => TRUE,
37
+    '#required' => true,
38 38
   );
39 39
 }
40 40
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     '#options' => content_profile_get_types('names'),
78 78
     '#default_value' => $settings['type'],
79 79
     '#description' => t('Select the Content Profile content type to load.'),
80
-    '#required' => TRUE,
80
+    '#required' => true,
81 81
   );
82 82
 }
83 83
 
Please login to merge, or discard this patch.
content_profile/views/content_profile_views_handler_relationship.inc 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,46 +6,46 @@  discard block
 block discarded – undo
6 6
  * Specialized relationship handler to adding content profiles.
7 7
  */
8 8
 class content_profile_views_handler_relationship extends views_handler_relationship {
9
-  function option_definition() {
9
+    function option_definition() {
10 10
     $options = parent::option_definition();
11 11
 
12 12
     $options['type'] = array('default' => '');
13 13
     return $options;
14
-  }
14
+    }
15 15
 
16
-  /**
17
-   * Adds a form element for choosing the right content type.
18
-   */
19
-  function options_form(&$form, &$form_state) {
16
+    /**
17
+     * Adds a form element for choosing the right content type.
18
+     */
19
+    function options_form(&$form, &$form_state) {
20 20
     parent::options_form($form, $form_state);
21 21
 
22 22
     $form['type'] = array(
23
-      '#type' => 'radios',
24
-      '#title' => t('Content type'),
25
-      '#default_value' => $this->options['type'],
26
-      '#options' => content_profile_get_types('names'),
27
-      '#required' => TRUE,
23
+        '#type' => 'radios',
24
+        '#title' => t('Content type'),
25
+        '#default_value' => $this->options['type'],
26
+        '#options' => content_profile_get_types('names'),
27
+        '#required' => TRUE,
28 28
     );
29
-  }
29
+    }
30 30
 
31
-  /**
32
-   * Called to implement a relationship in a query.
33
-   */
34
-  function query() {
31
+    /**
32
+     * Called to implement a relationship in a query.
33
+     */
34
+    function query() {
35 35
     // Figure out what base table this relationship brings to the party.
36 36
     $join = new views_join();
37 37
     $join->definition = array(
38
-      'table' => 'node',
39
-      'field' => 'uid',
40
-      'left_table' => !empty($this->relationship) ? $this->relationship : 'users',
41
-      'left_field' => 'uid',
42
-      'extra' => array(
38
+        'table' => 'node',
39
+        'field' => 'uid',
40
+        'left_table' => !empty($this->relationship) ? $this->relationship : 'users',
41
+        'left_field' => 'uid',
42
+        'extra' => array(
43 43
         array('field' => 'type', 'value' => $this->options['type']),
44
-      ),
44
+        ),
45 45
     );
46 46
 
47 47
     if (!empty($this->options['required'])) {
48
-      $join->definition['type'] = 'INNER';
48
+        $join->definition['type'] = 'INNER';
49 49
     }
50 50
 
51 51
     $join->construct();
@@ -53,5 +53,5 @@  discard block
 block discarded – undo
53 53
 
54 54
     $alias = $join->definition['table'] .'_'. $join->definition['left_table'];
55 55
     $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
56
-  }
56
+    }
57 57
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     $join->construct();
52 52
     $this->ensure_my_table();
53 53
 
54
-    $alias = $join->definition['table'] .'_'. $join->definition['left_table'];
54
+    $alias = $join->definition['table'].'_'.$join->definition['left_table'];
55 55
     $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
56 56
   }
57 57
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
       '#title' => t('Content type'),
25 25
       '#default_value' => $this->options['type'],
26 26
       '#options' => content_profile_get_types('names'),
27
-      '#required' => TRUE,
27
+      '#required' => true,
28 28
     );
29 29
   }
30 30
 
Please login to merge, or discard this patch.