Passed
Pull Request — master (#2976)
by Serghei
14:27
created
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.
sites/default/boinc/modules/contrib/content_profile/content_profile.module 5 patches
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@  discard block
 block discarded – undo
11 11
  * Implementation of hook_init().
12 12
  */
13 13
 function content_profile_init() {
14
-  module_load_include('inc', 'content_profile', 'content_profile.theme_vars');
14
+    module_load_include('inc', 'content_profile', 'content_profile.theme_vars');
15 15
 }
16 16
 
17 17
 /**
18 18
  * Implementation of hook_ctools_plugin_directory().
19 19
  */
20 20
 function content_profile_ctools_plugin_directory($module, $plugin) {
21
-  if ($module == 'ctools' && $plugin == 'relationships') {
21
+    if ($module == 'ctools' && $plugin == 'relationships') {
22 22
     return 'panels/' . $plugin;
23
-  }
23
+    }
24 24
 }
25 25
 
26 26
 /**
27 27
  * Implementation of hook_menu().
28 28
  */
29 29
 function content_profile_menu() {
30
-  $items = array();
30
+    $items = array();
31 31
 
32
-  //Register a path for each content profile type
33
-  foreach (content_profile_get_types('names') as $type => $typename) {
32
+    //Register a path for each content profile type
33
+    foreach (content_profile_get_types('names') as $type => $typename) {
34 34
     $items['admin/content/node-type/'. str_replace('_', '-', $type) .'/edit'] = array(
35
-      'title' => 'Edit',
36
-      'type' => MENU_DEFAULT_LOCAL_TASK,
35
+        'title' => 'Edit',
36
+        'type' => MENU_DEFAULT_LOCAL_TASK,
37 37
     );
38 38
     $items['admin/content/node-type/'. str_replace('_', '-', $type) .'/profile'] = array(
39
-      'title' => 'Content profile',
40
-      'description' => 'Configure the display and management of this content profile.',
41
-      'page callback' => 'drupal_get_form',
42
-      'page arguments' => array('content_profile_admin_settings', $type),
43
-      'access callback' => 'user_access',
44
-      'access arguments' => array('administer nodes'),
45
-      'type' => MENU_LOCAL_TASK,
46
-      'weight' => 1,
39
+        'title' => 'Content profile',
40
+        'description' => 'Configure the display and management of this content profile.',
41
+        'page callback' => 'drupal_get_form',
42
+        'page arguments' => array('content_profile_admin_settings', $type),
43
+        'access callback' => 'user_access',
44
+        'access arguments' => array('administer nodes'),
45
+        'type' => MENU_LOCAL_TASK,
46
+        'weight' => 1,
47 47
     );
48
-  }
49
-  foreach (content_profile_get_types('names') as $type => $type_name) {
48
+    }
49
+    foreach (content_profile_get_types('names') as $type => $type_name) {
50 50
     $items['user/%user/profile/'. $type] = array(
51
-      'title callback' => 'check_plain',
52
-      'title' => drupal_ucfirst($type_name),
53
-      'page callback' => 'content_profile_page_edit',
54
-      'page arguments' => array($type, 1),
55
-      'access callback' => 'content_profile_page_access',
56
-      'access arguments' => array($type, 1),
57
-      'weight' => content_profile_get_settings($type, 'weight'),
58
-      'file' => 'node.pages.inc',
59
-      'file path' => drupal_get_path('module', 'node'),
60
-      'type' => content_profile_get_settings($type, 'edit_tab') == 'top' ? MENU_LOCAL_TASK : MENU_CALLBACK,
51
+        'title callback' => 'check_plain',
52
+        'title' => drupal_ucfirst($type_name),
53
+        'page callback' => 'content_profile_page_edit',
54
+        'page arguments' => array($type, 1),
55
+        'access callback' => 'content_profile_page_access',
56
+        'access arguments' => array($type, 1),
57
+        'weight' => content_profile_get_settings($type, 'weight'),
58
+        'file' => 'node.pages.inc',
59
+        'file path' => drupal_get_path('module', 'node'),
60
+        'type' => content_profile_get_settings($type, 'edit_tab') == 'top' ? MENU_LOCAL_TASK : MENU_CALLBACK,
61 61
     );
62
-  }
63
-  return $items;
62
+    }
63
+    return $items;
64 64
 }
65 65
 
66 66
 /**
@@ -68,45 +68,45 @@  discard block
 block discarded – undo
68 68
  * Take over menu items generated by the user module for our categories.
69 69
  */
70 70
 function content_profile_menu_alter(&$items) {
71
-  foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
71
+    foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
72 72
     if (!empty($items['user/%user_category/edit/'. $type])) {
73
-      $item = &$items['user/%user_category/edit/'. $type];
74
-      $item = array(
73
+        $item = &$items['user/%user_category/edit/'. $type];
74
+        $item = array(
75 75
         'page callback' => 'content_profile_page_edit',
76 76
         'page arguments' => array($type, 1),
77 77
         'access callback' => 'content_profile_page_access',
78 78
         'access arguments' => array($type, 1),
79 79
         'file' => 'node.pages.inc',
80 80
         'file path' => drupal_get_path('module', 'node'),
81
-      ) + $item;
81
+        ) + $item;
82
+    }
82 83
     }
83
-  }
84 84
 }
85 85
 
86 86
 
87 87
 function content_profile_page_access($type, $account) {
88
-  if ($node = content_profile_load($type, $account->uid)) {
88
+    if ($node = content_profile_load($type, $account->uid)) {
89 89
     return node_access('update', $node);
90
-  }
91
-  // Else user may view the page when they are going to create their own profile
92
-  // or have permission to create it for others.
93
-  global $user;
94
-  if ($user->uid == $account->uid || user_access('administer nodes') ){
90
+    }
91
+    // Else user may view the page when they are going to create their own profile
92
+    // or have permission to create it for others.
93
+    global $user;
94
+    if ($user->uid == $account->uid || user_access('administer nodes') ){
95 95
     return node_access('create', $type);
96
-  }
97
-  return FALSE;
96
+    }
97
+    return FALSE;
98 98
 }
99 99
 
100 100
 /**
101 101
  * Presents a node editing or adding form for the given content profile.
102 102
  */
103 103
 function content_profile_page_edit($type, $account) {
104
-  drupal_set_title(check_plain($account->name));
105
-  $node = content_profile_load($type, $account->uid);
106
-  if (!$node) {
104
+    drupal_set_title(check_plain($account->name));
105
+    $node = content_profile_load($type, $account->uid);
106
+    if (!$node) {
107 107
     $node = array('uid' => $account->uid, 'name' => (isset($account->name) ? $account->name : ''), 'type' => $type, 'language' => '');
108
-  }
109
-  return drupal_get_form($type .'_node_form', $node);
108
+    }
109
+    return drupal_get_form($type .'_node_form', $node);
110 110
 }
111 111
 
112 112
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
  * Implementation of hook_views_api().
115 115
  */
116 116
 function content_profile_views_api() {
117
-  return array(
117
+    return array(
118 118
     'api' => 2,
119 119
     'path' => drupal_get_path('module', 'content_profile') .'/views',
120
-  );
120
+    );
121 121
 }
122 122
 
123 123
 
@@ -125,71 +125,71 @@  discard block
 block discarded – undo
125 125
  * Menu callback; content profile settings.
126 126
  */
127 127
 function content_profile_admin_settings(&$form_state, $type) {
128
-  $form_state['type'] = $type;
128
+    $form_state['type'] = $type;
129 129
 
130
-  $form['weight'] = array(
130
+    $form['weight'] = array(
131 131
     '#type' => 'weight',
132 132
     '#title' => t("Weight"),
133 133
     '#default_value' => content_profile_get_settings($type, 'weight'),
134 134
     '#description' => t('The weight of content of this content type where ever they appear - this applies to the input form integration as well to the display integration.'),
135 135
     '#weight' => 5,
136
-  );
137
-  $form['display'] = array(
136
+    );
137
+    $form['display'] = array(
138 138
     '#type' => 'fieldset',
139 139
     '#title' => t('Display settings'),
140 140
     '#description' => t('Customize the display of this content profile.'),
141 141
     '#collapsible' => TRUE,
142
-  );
143
-  $form['display']['user_display'] = array(
142
+    );
143
+    $form['display']['user_display'] = array(
144 144
     '#type' => 'radios',
145 145
     '#title' => t("User page display style"),
146 146
     '#default_value' => content_profile_get_settings($type, 'user_display'),
147 147
     '#options' => array(
148
-      0 => t("Don't display this content profile on the user account page"),
149
-      'link' => t('Display it as link to the profile content'),
150
-      'full' => t('Display the full content'),
151
-      'teaser' => t("Display the content's teaser"),
148
+        0 => t("Don't display this content profile on the user account page"),
149
+        'link' => t('Display it as link to the profile content'),
150
+        'full' => t('Display the full content'),
151
+        'teaser' => t("Display the content's teaser"),
152 152
     ),
153
-  );
154
-  $form['display']['edit_link'] = array(
153
+    );
154
+    $form['display']['edit_link'] = array(
155 155
     '#type' => 'checkbox',
156 156
     '#title' => t("Include an edit link to the display"),
157 157
     '#default_value' => content_profile_get_settings($type, 'edit_link'),
158
-  );
159
-  $form['display']['add_link'] = array(
158
+    );
159
+    $form['display']['add_link'] = array(
160 160
     '#type' => 'checkbox',
161 161
     '#title' => t("Show a link to the content profile creation page, if there is no profile."),
162 162
     '#default_value' => content_profile_get_settings($type, 'add_link'),
163 163
     '#description' => t("If selected and the user has no profile of this type yet, a link to add one is shown on the user page."),
164
-  );
165
-  $form['display']['edit_tab'] = array(
164
+    );
165
+    $form['display']['edit_tab'] = array(
166 166
     '#type' => 'radios',
167 167
     '#title' => t("Profile edit tab"),
168 168
     '#default_value' => content_profile_get_settings($type, 'edit_tab'),
169 169
     '#options' => array(
170
-      0 => t('None'),
171
-      'top' => t("Show a tab at the user's page"),
172
-      'sub' => t("Show a secondary tab below the user's edit tab"),
170
+        0 => t('None'),
171
+        'top' => t("Show a tab at the user's page"),
172
+        'sub' => t("Show a secondary tab below the user's edit tab"),
173 173
     ),
174
-  );
175
-  $form['submit'] = array(
174
+    );
175
+    $form['submit'] = array(
176 176
     '#type' => 'submit',
177 177
     '#value' => t('Submit'),
178 178
     '#weight' => 10,
179
-  );
180
-  return $form;
179
+    );
180
+    return $form;
181 181
 }
182 182
 
183 183
 function content_profile_admin_settings_submit($form, &$form_state) {
184
-  $settings = content_profile_get_settings($form_state['type']);
185
-  foreach (content_profile_settings_info() as $setting => $default) {
184
+    $settings = content_profile_get_settings($form_state['type']);
185
+    foreach (content_profile_settings_info() as $setting => $default) {
186 186
     if (isset($form_state['values'][$setting])) {
187
-      $settings[$setting] = $form_state['values'][$setting];
187
+        $settings[$setting] = $form_state['values'][$setting];
188
+    }
188 189
     }
189
-  }
190
-  content_profile_set_settings($form_state['type'], $settings);
191
-  drupal_set_message('Your changes have been saved.');
192
-  menu_rebuild();
190
+    content_profile_set_settings($form_state['type'], $settings);
191
+    drupal_set_message('Your changes have been saved.');
192
+    menu_rebuild();
193 193
 }
194 194
 
195 195
 /**
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
  *   The node object or the node's type
199 199
  */
200 200
 function is_content_profile($type) {
201
-  if (is_object($type)) {
201
+    if (is_object($type)) {
202 202
     $type = $type->type;
203
-  }
204
-  return variable_get('content_profile_use_'. $type, FALSE);
203
+    }
204
+    return variable_get('content_profile_use_'. $type, FALSE);
205 205
 }
206 206
 
207 207
 /**
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
  *   The value to compare the given setting too.
219 219
  */
220 220
 function content_profile_get_types($op = 'types', $setting = NULL , $value = TRUE) {
221
-  $types = array();
221
+    $types = array();
222 222
 
223
-  foreach (node_get_types($op) as $type => $info) {
223
+    foreach (node_get_types($op) as $type => $info) {
224 224
     if (is_content_profile($type) && (!isset($setting) || content_profile_get_settings($type, $setting) == $value)) {
225
-      $types[$type] = $info;
225
+        $types[$type] = $info;
226 226
     }
227
-  }
228
-  return $types;
227
+    }
228
+    return $types;
229 229
 }
230 230
 
231 231
 /**
@@ -233,79 +233,79 @@  discard block
 block discarded – undo
233 233
  * Rename or delete the settings variable if a type changes.
234 234
  */
235 235
 function content_profile_node_type($op, $info) {
236
-  switch ($op) {
236
+    switch ($op) {
237 237
     case 'delete':
238 238
       variable_del('content_profile_use_'. $info->type);
239
-      variable_del('content_profile_'. $info->type);
240
-      break;
239
+        variable_del('content_profile_'. $info->type);
240
+        break;
241 241
     case 'update':
242 242
       if (!empty($info->old_type) && $info->old_type != $info->type) {
243 243
         if (is_content_profile($info->old_type)) {
244
-          $settings = variable_get('content_profile_'. $info->old_type, array());
245
-          variable_del('content_profile_use_'. $info->old_type);
246
-          variable_del('content_profile_'. $info->old_type);
247
-          variable_set('content_profile_use_'. $info->type, 1);
248
-          variable_set('content_profile_'. $info->type, $settings);
244
+            $settings = variable_get('content_profile_'. $info->old_type, array());
245
+            variable_del('content_profile_use_'. $info->old_type);
246
+            variable_del('content_profile_'. $info->old_type);
247
+            variable_set('content_profile_use_'. $info->type, 1);
248
+            variable_set('content_profile_'. $info->type, $settings);
249
+        }
249 250
         }
250
-      }
251
-      break;
252
-  }
251
+        break;
252
+    }
253 253
 }
254 254
 
255 255
 /**
256 256
  * Implementation of hook_form_alter().
257 257
  */
258 258
 function content_profile_form_alter(&$form, $form_state, $form_id) {
259
-  if ($form_id == 'node_type_form') {
259
+    if ($form_id == 'node_type_form') {
260 260
     $form['content_profile'] = array(
261
-      '#type' => 'fieldset',
262
-      '#title' => t('Content Profile'),
263
-      '#group' => 'additional_settings',
264
-      '#collapsible' => TRUE,
265
-      '#collapsed' => TRUE,
266
-      '#weight' => 32,
261
+        '#type' => 'fieldset',
262
+        '#title' => t('Content Profile'),
263
+        '#group' => 'additional_settings',
264
+        '#collapsible' => TRUE,
265
+        '#collapsed' => TRUE,
266
+        '#weight' => 32,
267 267
     );
268 268
     $form['content_profile']['content_profile_use'] = array(
269
-      '#type' => 'checkbox',
270
-      '#title' => t('Use this content type as a content profile for users'),
271
-      '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE),
269
+        '#type' => 'checkbox',
270
+        '#title' => t('Use this content type as a content profile for users'),
271
+        '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE),
272 272
     );
273
-  }
274
-  elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
273
+    }
274
+    elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
275 275
     // Customize the redirect target and buttons of our own node forms.
276 276
     if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {
277
-      $form['buttons']['preview']['#access'] = FALSE;
278
-      $form['buttons']['delete']['#access'] = FALSE;
279
-      $form['#redirect'] = arg(2) == 'profile' ? 'user/'. $form['#node']->uid : $_GET['q'];
277
+        $form['buttons']['preview']['#access'] = FALSE;
278
+        $form['buttons']['delete']['#access'] = FALSE;
279
+        $form['#redirect'] = arg(2) == 'profile' ? 'user/'. $form['#node']->uid : $_GET['q'];
280 280
     }
281 281
     // Set the author value - note that this works only for admins.
282 282
     if (!empty($_GET['uid']) && ($uid = intval($_GET['uid'])) && ($user = user_load($uid))) {
283
-      $form['author']['name']['#default_value'] = $user->name;
283
+        $form['author']['name']['#default_value'] = $user->name;
284
+    }
284 285
     }
285
-  }
286 286
 }
287 287
 
288 288
 /**
289 289
  * Implementation of hook_user().
290 290
  */
291 291
 function content_profile_user($op, &$edit, &$account, $category = NULL) {
292
-  global $user;
292
+    global $user;
293 293
 
294
-  switch ($op) {
294
+    switch ($op) {
295 295
     case 'categories':
296 296
       $data = array();
297
-      foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
297
+        foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
298 298
         $data[] = array(
299
-          'name' => $type,
300
-          'title' => drupal_ucfirst($type_name),
301
-          'weight' => content_profile_get_settings($type, 'weight') + 1,
299
+            'name' => $type,
300
+            'title' => drupal_ucfirst($type_name),
301
+            'weight' => content_profile_get_settings($type, 'weight') + 1,
302 302
         );
303
-      }
304
-      return $data;
303
+        }
304
+        return $data;
305 305
 
306 306
     case 'view':
307 307
       $account->content['content_profile'] = content_profile_show_profiles($account->uid);
308
-      break;
308
+        break;
309 309
 
310 310
     case 'delete':
311 311
       // Retrieve all profile nodes (in any language) for this user by issueing an SQL query.
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 
316 316
         $result = db_query("SELECT * FROM {node} WHERE (". implode(' OR ', $condition) .") AND uid = %d", $arguments);
317 317
         while ($node = db_fetch_object($result)) {
318
-          _content_profile_node_delete($node);
318
+            _content_profile_node_delete($node);
319
+        }
319 320
         }
320
-      }
321
-      break;
322
-  }
321
+        break;
322
+    }
323 323
 }
324 324
 
325 325
 /**
@@ -333,42 +333,42 @@  discard block
 block discarded – undo
333 333
  * "SELECT * FROM {node}" query) instead of just the $nid.
334 334
  */
335 335
 function _content_profile_node_delete($node) {
336
-  // Copied over from node_load(), so that node_invoke('delete') gets
337
-  // the fully extended node object, like modules would expect:
336
+    // Copied over from node_load(), so that node_invoke('delete') gets
337
+    // the fully extended node object, like modules would expect:
338 338
 
339
-  if ($node->nid) {
339
+    if ($node->nid) {
340 340
     // Call the node specific callback (if any) and piggy-back the
341 341
     // results to the node or overwrite some values.
342 342
     if ($extra = node_invoke($node, 'load')) {
343
-      foreach ($extra as $key => $value) {
343
+        foreach ($extra as $key => $value) {
344 344
         $node->$key = $value;
345
-      }
345
+        }
346 346
     }
347 347
     if ($extra = node_invoke_nodeapi($node, 'load')) {
348
-      foreach ($extra as $key => $value) {
348
+        foreach ($extra as $key => $value) {
349 349
         $node->$key = $value;
350
-      }
350
+        }
351
+    }
351 352
     }
352
-  }
353 353
 
354
-  // Copied over from node_delete():
354
+    // Copied over from node_delete():
355 355
 
356
-  db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
357
-  db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
356
+    db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
357
+    db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
358 358
 
359
-  // Call the node-specific callback (if any):
360
-  node_invoke($node, 'delete');
361
-  node_invoke_nodeapi($node, 'delete');
359
+    // Call the node-specific callback (if any):
360
+    node_invoke($node, 'delete');
361
+    node_invoke_nodeapi($node, 'delete');
362 362
 
363
-  // Clear the cache so an anonymous poster can see the node being deleted.
364
-  cache_clear_all();
363
+    // Clear the cache so an anonymous poster can see the node being deleted.
364
+    cache_clear_all();
365 365
 
366
-  // Remove this node from the search index if needed.
367
-  if (function_exists('search_wipe')) {
366
+    // Remove this node from the search index if needed.
367
+    if (function_exists('search_wipe')) {
368 368
     search_wipe($node->nid, 'node');
369
-  }
370
-  watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
371
-  drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_types('name', $node), '%title' => $node->title)));
369
+    }
370
+    watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
371
+    drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_types('name', $node), '%title' => $node->title)));
372 372
 }
373 373
 
374 374
 /**
@@ -376,30 +376,30 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function content_profile_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
378 378
 
379
-  if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer nodes') && arg(0) != 'admin') {
379
+    if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer nodes') && arg(0) != 'admin') {
380 380
     // Check if this nodetype already exists
381 381
     if ($nid = content_profile_profile_exists($node, $node->uid)) {
382
-      // This node already exists, redirect to edit page
383
-      drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);
382
+        // This node already exists, redirect to edit page
383
+        drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);
384 384
     }
385
-  }
386
-  elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) {
385
+    }
386
+    elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) {
387 387
     $form = $a3;
388 388
     // Only validate if the user-name changed or we add a new node
389 389
     if (!empty($node->nid) && $form['author']['name']['#default_value'] == $node->name) {
390
-      return;
390
+        return;
391 391
     }
392 392
     //check whether the selected user has already a profile
393 393
     $uid = db_result(db_query("SELECT uid FROM {users} WHERE name = '%s'", $node->name));
394 394
     if ($uid && content_profile_profile_exists($node, $uid)) {
395
-      form_set_error('name', t('This user already has a content profile of this type. You can only create one profile per user.'));
395
+        form_set_error('name', t('This user already has a content profile of this type. You can only create one profile per user.'));
396
+    }
396 397
     }
397
-  }
398
-  elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) {
398
+    elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) {
399 399
     // Make sure the translated profile belongs to the same user.
400 400
     $node->uid = $node->translation_source->uid;
401 401
     $node->name = $node->translation_source->name;
402
-  }
402
+    }
403 403
 }
404 404
 
405 405
 /**
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
  * @return If a node exists, the node id, FALSE else.
413 413
  */
414 414
 function content_profile_profile_exists($node, $uid) {
415
-  $query = "SELECT n.nid AS nid FROM {node} n WHERE n.type = '%s' AND n.uid = %d ";
416
-  if (module_exists('translation') && translation_supported_type($node->type)) {
415
+    $query = "SELECT n.nid AS nid FROM {node} n WHERE n.type = '%s' AND n.uid = %d ";
416
+    if (module_exists('translation') && translation_supported_type($node->type)) {
417 417
     $query .= "AND n.language = '%s'";
418
-  }
419
-  return db_result(db_query($query, $node->type, $uid, $node->language));
418
+    }
419
+    return db_result(db_query($query, $node->type, $uid, $node->language));
420 420
 }
421 421
 
422 422
 /**
@@ -428,19 +428,19 @@  discard block
 block discarded – undo
428 428
  *   e.g. user_edit, register or weight.
429 429
  */
430 430
 function content_profile_get_settings($type, $return = 'all') {
431
-  $settings = variable_get('content_profile_'. $type, array());
432
-  $settings += content_profile_settings_info();
433
-  if ($return == 'all') {
431
+    $settings = variable_get('content_profile_'. $type, array());
432
+    $settings += content_profile_settings_info();
433
+    if ($return == 'all') {
434 434
     return $settings;
435
-  }
436
-  return $settings[$return];
435
+    }
436
+    return $settings[$return];
437 437
 }
438 438
 
439 439
 /**
440 440
  * Saves the content_profile settings of a content type.
441 441
  */
442 442
 function content_profile_set_settings($type, $settings) {
443
-  variable_set('content_profile_'. $type, $settings);
443
+    variable_set('content_profile_'. $type, $settings);
444 444
 }
445 445
 
446 446
 /**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
  * and their default value.
449 449
  */
450 450
 function content_profile_settings_info() {
451
-  return module_invoke_all('content_profile_settings');
451
+    return module_invoke_all('content_profile_settings');
452 452
 }
453 453
 
454 454
 /**
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
  * Defines content profile settings and their default value.
458 458
  */
459 459
 function content_profile_content_profile_settings() {
460
-  return array(
460
+    return array(
461 461
     'weight' => 0,
462 462
     'user_display' => 'full',
463 463
     'edit_link' => 0,
464 464
     'edit_tab' => 'sub',
465 465
     'add_link' => 1,
466
-  );
466
+    );
467 467
 }
468 468
 
469 469
 /**
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
  *   Optional. If set, the cache is reset.
480 480
  */
481 481
 function content_profile_load($type, $uid, $lang = '', $reset = NULL) {
482
-  static $cache = array();
482
+    static $cache = array();
483 483
 
484
-  if (!isset($cache[$type][$uid][$lang]) || $reset) {
484
+    if (!isset($cache[$type][$uid][$lang]) || $reset) {
485 485
     $cache[$type][$uid][$lang] = FALSE;
486 486
     $params = array('type' => $type, 'uid' => $uid);
487 487
     if ($node = node_load($lang ? $params + array('language' => $lang) : $params, NULL, $reset)) {
488
-      $cache[$type][$uid][$lang] = $node->nid;
488
+        $cache[$type][$uid][$lang] = $node->nid;
489 489
     }
490 490
     return $node;
491
-  }
492
-  return !empty($cache[$type][$uid][$lang]) ? node_load($cache[$type][$uid][$lang]) : FALSE;
491
+    }
492
+    return !empty($cache[$type][$uid][$lang]) ? node_load($cache[$type][$uid][$lang]) : FALSE;
493 493
 }
494 494
 
495 495
 /**
@@ -498,19 +498,19 @@  discard block
 block discarded – undo
498 498
  * Show node submission guidelines for content profile node forms.
499 499
  */
500 500
 function content_profile_help($path, $arg) {
501
-  if (preg_match('/user\/\%\/(profile|edit)\/(.*)/', $path, $matches)) {
501
+    if (preg_match('/user\/\%\/(profile|edit)\/(.*)/', $path, $matches)) {
502 502
     foreach (content_profile_get_types('names') as $type => $typename) {
503
-      if ($type == $matches[2]) {
503
+        if ($type == $matches[2]) {
504 504
         $node = content_profile_load($type, $arg[1]);
505 505
         if ($node) {
506
-          return node_help('node/%/edit', array(1 => $node->nid));
506
+            return node_help('node/%/edit', array(1 => $node->nid));
507 507
         }
508 508
         else {
509
-          return node_help('node/add/'. $type, array('node', 'add', $type));
509
+            return node_help('node/add/'. $type, array('node', 'add', $type));
510 510
         }
511
-      }
511
+        }
512
+    }
512 513
     }
513
-  }
514 514
 }
515 515
 
516 516
 /**
@@ -518,14 +518,14 @@  discard block
 block discarded – undo
518 518
  * that shows all content_profiles as configured by the admin.
519 519
  */
520 520
 function content_profile_show_profiles($uid) {
521
-  global $user;
521
+    global $user;
522 522
 
523
-  $content = array();
524
-  foreach (content_profile_get_types('names') as $type => $type_name) {
523
+    $content = array();
524
+    foreach (content_profile_get_types('names') as $type => $type_name) {
525 525
     $node = content_profile_load($type, $uid);
526 526
 
527 527
     if (($style = content_profile_get_settings($type, 'user_display')) && $node && node_access('view', $node)) {
528
-      $content['content_profile_'. $type] = array(
528
+        $content['content_profile_'. $type] = array(
529 529
         '#theme' => ($style == 'link') ? 'content_profile_display_link' : 'content_profile_display_view',
530 530
         '#edit_link' => content_profile_get_settings($type, 'edit_link'),
531 531
         '#uid' => $uid,
@@ -533,59 +533,59 @@  discard block
 block discarded – undo
533 533
         '#content_type' => $type,
534 534
         '#weight' => content_profile_get_settings($type, 'weight'),
535 535
         '#suffix' => '<br />',
536
-      );
536
+        );
537 537
 
538
-      // Working around the bug described at http://drupal.org/node/302873
539
-      module_load_include('inc', 'content_profile', 'content_profile.theme');
538
+        // Working around the bug described at http://drupal.org/node/302873
539
+        module_load_include('inc', 'content_profile', 'content_profile.theme');
540 540
     }
541 541
     elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
542
-      $content['content_profile_'. $type] = array(
542
+        $content['content_profile_'. $type] = array(
543 543
         '#admin' => $uid != $user->uid,
544 544
         '#theme' => 'content_profile_display_add_link',
545 545
         '#uid' => $uid,
546 546
         '#content_type' => $type,
547 547
         '#weight' => content_profile_get_settings($type, 'weight'),
548 548
         '#suffix' => '<br />',
549
-      );
549
+        );
550
+    }
550 551
     }
551
-  }
552
-  if ($content) {
552
+    if ($content) {
553 553
     $content['#prefix'] = '<p id="content-profile-view">';
554 554
     $content['#suffix'] = '</p>';
555
-  }
556
-  return $content;
555
+    }
556
+    return $content;
557 557
 }
558 558
 
559 559
 /**
560 560
  * Implementation of hook_theme().
561 561
  */
562 562
 function content_profile_theme() {
563
-  $return = array(
563
+    $return = array(
564 564
     'content_profile_display_view' => array(
565
-      'template'  => 'content_profile-display-view',
566
-      'arguments' => array('element' => NULL),
567
-      'file' => 'content_profile.theme.inc',
565
+        'template'  => 'content_profile-display-view',
566
+        'arguments' => array('element' => NULL),
567
+        'file' => 'content_profile.theme.inc',
568 568
     ),
569 569
     'content_profile_display_add_link' => array(
570
-      'file' => 'content_profile.theme.inc',
570
+        'file' => 'content_profile.theme.inc',
571 571
     ),
572 572
     'content_profile_display_link' => array(
573
-      'file' => 'content_profile.theme.inc',
573
+        'file' => 'content_profile.theme.inc',
574 574
     ),
575 575
     'content_profile_display_tab_view' => array(
576
-      'file' => 'content_profile.theme.inc',
576
+        'file' => 'content_profile.theme.inc',
577 577
     ),
578 578
     'content_profile_display_tab_edit' => array(
579
-      'file' => 'content_profile.theme.inc',
579
+        'file' => 'content_profile.theme.inc',
580 580
     ),
581
-  );
582
-  if (module_exists('pageroute')) {
581
+    );
582
+    if (module_exists('pageroute')) {
583 583
     $return['content_profile_pageroute_empty']  = array(
584
-      'arguments' => array('type_name' => NULL),
585
-    	'file' => 'content_profile.pageroute.inc',
584
+        'arguments' => array('type_name' => NULL),
585
+        'file' => 'content_profile.pageroute.inc',
586 586
     );
587
-  }
588
-  return $return;
587
+    }
588
+    return $return;
589 589
 }
590 590
 
591 591
 /**
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
  * $conf['content_profile_extra_templates'] in settings.php.
595 595
  */
596 596
 function content_profile_theme_registry_alter(&$items) {
597
-  $templates = array_merge(array(
597
+    $templates = array_merge(array(
598 598
     'author_pane',
599 599
     'comment',
600 600
     'node',
@@ -603,47 +603,47 @@  discard block
 block discarded – undo
603 603
     'username',
604 604
     'user_profile',
605 605
     'user_signature',
606
-  ), variable_get('content_profile_extra_templates', array()));
606
+    ), variable_get('content_profile_extra_templates', array()));
607 607
 
608
-  foreach ($templates as $key) {
608
+    foreach ($templates as $key) {
609 609
     if (isset($items[$key])) {
610
-      $items[$key] += array('preprocess functions' => array());
611
-      $items[$key]['preprocess functions'][] = 'content_profile_template_preprocess';
610
+        $items[$key] += array('preprocess functions' => array());
611
+        $items[$key]['preprocess functions'][] = 'content_profile_template_preprocess';
612
+    }
612 613
     }
613
-  }
614 614
 }
615 615
 
616 616
 /**
617 617
  * Adds $content_profile variable if we can find a $uid.
618 618
  */
619 619
 function content_profile_template_preprocess(&$variables, $hook) {
620
-  // Search the uid
621
-  foreach (array('account_id', 'uid', 'account', 'node', 'comment', 'user') as $name) {
620
+    // Search the uid
621
+    foreach (array('account_id', 'uid', 'account', 'node', 'comment', 'user') as $name) {
622 622
     if (isset($variables[$name])) {
623
-      $uid = is_object($variables[$name]) ? $variables[$name]->uid : $variables[$name];
624
-      $variables['content_profile'] = new content_profile_theme_variables($uid);
625
-      break;
623
+        $uid = is_object($variables[$name]) ? $variables[$name]->uid : $variables[$name];
624
+        $variables['content_profile'] = new content_profile_theme_variables($uid);
625
+        break;
626
+    }
626 627
     }
627
-  }
628 628
 }
629 629
 
630 630
 /**
631 631
  * Implementation of hook_simpletest().
632 632
  */
633 633
 function content_profile_simpletest() {
634
-  // Scan through content_profile/tests directory for any .test files to tell SimpleTest module.
635
-  $tests = file_scan_directory(drupal_get_path('module', 'content_profile') .'/tests', '\.test');
636
-  return array_keys($tests);
634
+    // Scan through content_profile/tests directory for any .test files to tell SimpleTest module.
635
+    $tests = file_scan_directory(drupal_get_path('module', 'content_profile') .'/tests', '\.test');
636
+    return array_keys($tests);
637 637
 }
638 638
 
639 639
 /**
640 640
  * Implementation of hook_pageroute_info() for Pageroute integration.
641 641
  */
642 642
 function content_profile_pageroute_info() {
643
-  return array(
643
+    return array(
644 644
     'content_profile' => array(
645
-      'viewprofile' => 'content_profile.pageroute',
646
-      'editprofile' => 'content_profile.pageroute',
645
+        'viewprofile' => 'content_profile.pageroute',
646
+        'editprofile' => 'content_profile.pageroute',
647 647
     )
648
-  );
648
+    );
649 649
 }
Please login to merge, or discard this patch.
Switch Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
  */
235 235
 function content_profile_node_type($op, $info) {
236 236
   switch ($op) {
237
-    case 'delete':
238
-      variable_del('content_profile_use_'. $info->type);
239
-      variable_del('content_profile_'. $info->type);
240
-      break;
241
-    case 'update':
242
-      if (!empty($info->old_type) && $info->old_type != $info->type) {
243
-        if (is_content_profile($info->old_type)) {
244
-          $settings = variable_get('content_profile_'. $info->old_type, array());
245
-          variable_del('content_profile_use_'. $info->old_type);
246
-          variable_del('content_profile_'. $info->old_type);
247
-          variable_set('content_profile_use_'. $info->type, 1);
248
-          variable_set('content_profile_'. $info->type, $settings);
249
-        }
237
+  case 'delete':
238
+    variable_del('content_profile_use_'. $info->type);
239
+    variable_del('content_profile_'. $info->type);
240
+    break;
241
+  case 'update':
242
+    if (!empty($info->old_type) && $info->old_type != $info->type) {
243
+      if (is_content_profile($info->old_type)) {
244
+        $settings = variable_get('content_profile_'. $info->old_type, array());
245
+        variable_del('content_profile_use_'. $info->old_type);
246
+        variable_del('content_profile_'. $info->old_type);
247
+        variable_set('content_profile_use_'. $info->type, 1);
248
+        variable_set('content_profile_'. $info->type, $settings);
250 249
       }
251
-      break;
250
+    }
251
+    break;
252 252
   }
253 253
 }
254 254
 
@@ -292,33 +292,33 @@  discard block
 block discarded – undo
292 292
   global $user;
293 293
 
294 294
   switch ($op) {
295
-    case 'categories':
296
-      $data = array();
297
-      foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
298
-        $data[] = array(
299
-          'name' => $type,
300
-          'title' => drupal_ucfirst($type_name),
301
-          'weight' => content_profile_get_settings($type, 'weight') + 1,
302
-        );
303
-      }
304
-      return $data;
295
+  case 'categories':
296
+    $data = array();
297
+    foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
298
+      $data[] = array(
299
+        'name' => $type,
300
+        'title' => drupal_ucfirst($type_name),
301
+        'weight' => content_profile_get_settings($type, 'weight') + 1,
302
+      );
303
+    }
304
+    return $data;
305 305
 
306
-    case 'view':
307
-      $account->content['content_profile'] = content_profile_show_profiles($account->uid);
308
-      break;
306
+  case 'view':
307
+    $account->content['content_profile'] = content_profile_show_profiles($account->uid);
308
+    break;
309 309
 
310
-    case 'delete':
311
-      // Retrieve all profile nodes (in any language) for this user by issueing an SQL query.
312
-      if ($types = content_profile_get_types()) {
313
-        $condition = array_fill(0, count($types), "type = '%s'");
314
-        $arguments = array_merge(array_keys($types), array($account->uid));
310
+  case 'delete':
311
+    // Retrieve all profile nodes (in any language) for this user by issueing an SQL query.
312
+    if ($types = content_profile_get_types()) {
313
+      $condition = array_fill(0, count($types), "type = '%s'");
314
+      $arguments = array_merge(array_keys($types), array($account->uid));
315 315
 
316
-        $result = db_query("SELECT * FROM {node} WHERE (". implode(' OR ', $condition) .") AND uid = %d", $arguments);
317
-        while ($node = db_fetch_object($result)) {
318
-          _content_profile_node_delete($node);
319
-        }
316
+      $result = db_query("SELECT * FROM {node} WHERE (". implode(' OR ', $condition) .") AND uid = %d", $arguments);
317
+      while ($node = db_fetch_object($result)) {
318
+        _content_profile_node_delete($node);
320 319
       }
321
-      break;
320
+    }
321
+    break;
322 322
   }
323 323
 }
324 324
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function content_profile_ctools_plugin_directory($module, $plugin) {
21 21
   if ($module == 'ctools' && $plugin == 'relationships') {
22
-    return 'panels/' . $plugin;
22
+    return 'panels/'.$plugin;
23 23
   }
24 24
 }
25 25
 
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
   //Register a path for each content profile type
33 33
   foreach (content_profile_get_types('names') as $type => $typename) {
34
-    $items['admin/content/node-type/'. str_replace('_', '-', $type) .'/edit'] = array(
34
+    $items['admin/content/node-type/'.str_replace('_', '-', $type).'/edit'] = array(
35 35
       'title' => 'Edit',
36 36
       'type' => MENU_DEFAULT_LOCAL_TASK,
37 37
     );
38
-    $items['admin/content/node-type/'. str_replace('_', '-', $type) .'/profile'] = array(
38
+    $items['admin/content/node-type/'.str_replace('_', '-', $type).'/profile'] = array(
39 39
       'title' => 'Content profile',
40 40
       'description' => 'Configure the display and management of this content profile.',
41 41
       'page callback' => 'drupal_get_form',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     );
48 48
   }
49 49
   foreach (content_profile_get_types('names') as $type => $type_name) {
50
-    $items['user/%user/profile/'. $type] = array(
50
+    $items['user/%user/profile/'.$type] = array(
51 51
       'title callback' => 'check_plain',
52 52
       'title' => drupal_ucfirst($type_name),
53 53
       'page callback' => 'content_profile_page_edit',
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
  */
70 70
 function content_profile_menu_alter(&$items) {
71 71
   foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
72
-    if (!empty($items['user/%user_category/edit/'. $type])) {
73
-      $item = &$items['user/%user_category/edit/'. $type];
72
+    if (!empty($items['user/%user_category/edit/'.$type])) {
73
+      $item = &$items['user/%user_category/edit/'.$type];
74 74
       $item = array(
75 75
         'page callback' => 'content_profile_page_edit',
76 76
         'page arguments' => array($type, 1),
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
   // Else user may view the page when they are going to create their own profile
92 92
   // or have permission to create it for others.
93 93
   global $user;
94
-  if ($user->uid == $account->uid || user_access('administer nodes') ){
94
+  if ($user->uid == $account->uid || user_access('administer nodes')) {
95 95
     return node_access('create', $type);
96 96
   }
97 97
   return FALSE;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
   if (!$node) {
107 107
     $node = array('uid' => $account->uid, 'name' => (isset($account->name) ? $account->name : ''), 'type' => $type, 'language' => '');
108 108
   }
109
-  return drupal_get_form($type .'_node_form', $node);
109
+  return drupal_get_form($type.'_node_form', $node);
110 110
 }
111 111
 
112 112
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 function content_profile_views_api() {
117 117
   return array(
118 118
     'api' => 2,
119
-    'path' => drupal_get_path('module', 'content_profile') .'/views',
119
+    'path' => drupal_get_path('module', 'content_profile').'/views',
120 120
   );
121 121
 }
122 122
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
   if (is_object($type)) {
202 202
     $type = $type->type;
203 203
   }
204
-  return variable_get('content_profile_use_'. $type, FALSE);
204
+  return variable_get('content_profile_use_'.$type, FALSE);
205 205
 }
206 206
 
207 207
 /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  * @param $value
218 218
  *   The value to compare the given setting too.
219 219
  */
220
-function content_profile_get_types($op = 'types', $setting = NULL , $value = TRUE) {
220
+function content_profile_get_types($op = 'types', $setting = NULL, $value = TRUE) {
221 221
   $types = array();
222 222
 
223 223
   foreach (node_get_types($op) as $type => $info) {
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 function content_profile_node_type($op, $info) {
236 236
   switch ($op) {
237 237
     case 'delete':
238
-      variable_del('content_profile_use_'. $info->type);
239
-      variable_del('content_profile_'. $info->type);
238
+      variable_del('content_profile_use_'.$info->type);
239
+      variable_del('content_profile_'.$info->type);
240 240
       break;
241 241
     case 'update':
242 242
       if (!empty($info->old_type) && $info->old_type != $info->type) {
243 243
         if (is_content_profile($info->old_type)) {
244
-          $settings = variable_get('content_profile_'. $info->old_type, array());
245
-          variable_del('content_profile_use_'. $info->old_type);
246
-          variable_del('content_profile_'. $info->old_type);
247
-          variable_set('content_profile_use_'. $info->type, 1);
248
-          variable_set('content_profile_'. $info->type, $settings);
244
+          $settings = variable_get('content_profile_'.$info->old_type, array());
245
+          variable_del('content_profile_use_'.$info->old_type);
246
+          variable_del('content_profile_'.$info->old_type);
247
+          variable_set('content_profile_use_'.$info->type, 1);
248
+          variable_set('content_profile_'.$info->type, $settings);
249 249
         }
250 250
       }
251 251
       break;
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
     $form['content_profile']['content_profile_use'] = array(
269 269
       '#type' => 'checkbox',
270 270
       '#title' => t('Use this content type as a content profile for users'),
271
-      '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE),
271
+      '#default_value' => variable_get('content_profile_use_'.$form['#node_type']->type, FALSE),
272 272
     );
273 273
   }
274
-  elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
274
+  elseif (isset($form['#node']) && $form['#node']->type.'_node_form' == $form_id && is_content_profile($form['#node'])) {
275 275
     // Customize the redirect target and buttons of our own node forms.
276 276
     if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {
277 277
       $form['buttons']['preview']['#access'] = FALSE;
278 278
       $form['buttons']['delete']['#access'] = FALSE;
279
-      $form['#redirect'] = arg(2) == 'profile' ? 'user/'. $form['#node']->uid : $_GET['q'];
279
+      $form['#redirect'] = arg(2) == 'profile' ? 'user/'.$form['#node']->uid : $_GET['q'];
280 280
     }
281 281
     // Set the author value - note that this works only for admins.
282 282
     if (!empty($_GET['uid']) && ($uid = intval($_GET['uid'])) && ($user = user_load($uid))) {
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         $condition = array_fill(0, count($types), "type = '%s'");
314 314
         $arguments = array_merge(array_keys($types), array($account->uid));
315 315
 
316
-        $result = db_query("SELECT * FROM {node} WHERE (". implode(' OR ', $condition) .") AND uid = %d", $arguments);
316
+        $result = db_query("SELECT * FROM {node} WHERE (".implode(' OR ', $condition).") AND uid = %d", $arguments);
317 317
         while ($node = db_fetch_object($result)) {
318 318
           _content_profile_node_delete($node);
319 319
         }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     // Check if this nodetype already exists
381 381
     if ($nid = content_profile_profile_exists($node, $node->uid)) {
382 382
       // This node already exists, redirect to edit page
383
-      drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);
383
+      drupal_goto('node/'.$nid.'/edit', 'destination=user/'.$node->uid);
384 384
     }
385 385
   }
386 386
   elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
  *   e.g. user_edit, register or weight.
429 429
  */
430 430
 function content_profile_get_settings($type, $return = 'all') {
431
-  $settings = variable_get('content_profile_'. $type, array());
431
+  $settings = variable_get('content_profile_'.$type, array());
432 432
   $settings += content_profile_settings_info();
433 433
   if ($return == 'all') {
434 434
     return $settings;
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
  * Saves the content_profile settings of a content type.
441 441
  */
442 442
 function content_profile_set_settings($type, $settings) {
443
-  variable_set('content_profile_'. $type, $settings);
443
+  variable_set('content_profile_'.$type, $settings);
444 444
 }
445 445
 
446 446
 /**
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
           return node_help('node/%/edit', array(1 => $node->nid));
507 507
         }
508 508
         else {
509
-          return node_help('node/add/'. $type, array('node', 'add', $type));
509
+          return node_help('node/add/'.$type, array('node', 'add', $type));
510 510
         }
511 511
       }
512 512
     }
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     $node = content_profile_load($type, $uid);
526 526
 
527 527
     if (($style = content_profile_get_settings($type, 'user_display')) && $node && node_access('view', $node)) {
528
-      $content['content_profile_'. $type] = array(
528
+      $content['content_profile_'.$type] = array(
529 529
         '#theme' => ($style == 'link') ? 'content_profile_display_link' : 'content_profile_display_view',
530 530
         '#edit_link' => content_profile_get_settings($type, 'edit_link'),
531 531
         '#uid' => $uid,
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
       // Working around the bug described at http://drupal.org/node/302873
539 539
       module_load_include('inc', 'content_profile', 'content_profile.theme');
540 540
     }
541
-    elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
542
-      $content['content_profile_'. $type] = array(
541
+    elseif (user_access('create '.$type.' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
542
+      $content['content_profile_'.$type] = array(
543 543
         '#admin' => $uid != $user->uid,
544 544
         '#theme' => 'content_profile_display_add_link',
545 545
         '#uid' => $uid,
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
     ),
581 581
   );
582 582
   if (module_exists('pageroute')) {
583
-    $return['content_profile_pageroute_empty']  = array(
583
+    $return['content_profile_pageroute_empty'] = array(
584 584
       'arguments' => array('type_name' => NULL),
585 585
     	'file' => 'content_profile.pageroute.inc',
586 586
     );
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
  */
633 633
 function content_profile_simpletest() {
634 634
   // Scan through content_profile/tests directory for any .test files to tell SimpleTest module.
635
-  $tests = file_scan_directory(drupal_get_path('module', 'content_profile') .'/tests', '\.test');
635
+  $tests = file_scan_directory(drupal_get_path('module', 'content_profile').'/tests', '\.test');
636 636
   return array_keys($tests);
637 637
 }
638 638
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
   // Else user may view the page when they are going to create their own profile
92 92
   // or have permission to create it for others.
93 93
   global $user;
94
-  if ($user->uid == $account->uid || user_access('administer nodes') ){
94
+  if ($user->uid == $account->uid || user_access('administer nodes') ) {
95 95
     return node_access('create', $type);
96 96
   }
97 97
   return FALSE;
@@ -270,8 +270,7 @@  discard block
 block discarded – undo
270 270
       '#title' => t('Use this content type as a content profile for users'),
271 271
       '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE),
272 272
     );
273
-  }
274
-  elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
273
+  } elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
275 274
     // Customize the redirect target and buttons of our own node forms.
276 275
     if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {
277 276
       $form['buttons']['preview']['#access'] = FALSE;
@@ -382,8 +381,7 @@  discard block
 block discarded – undo
382 381
       // This node already exists, redirect to edit page
383 382
       drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);
384 383
     }
385
-  }
386
-  elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) {
384
+  } elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) {
387 385
     $form = $a3;
388 386
     // Only validate if the user-name changed or we add a new node
389 387
     if (!empty($node->nid) && $form['author']['name']['#default_value'] == $node->name) {
@@ -394,8 +392,7 @@  discard block
 block discarded – undo
394 392
     if ($uid && content_profile_profile_exists($node, $uid)) {
395 393
       form_set_error('name', t('This user already has a content profile of this type. You can only create one profile per user.'));
396 394
     }
397
-  }
398
-  elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) {
395
+  } elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) {
399 396
     // Make sure the translated profile belongs to the same user.
400 397
     $node->uid = $node->translation_source->uid;
401 398
     $node->name = $node->translation_source->name;
@@ -504,8 +501,7 @@  discard block
 block discarded – undo
504 501
         $node = content_profile_load($type, $arg[1]);
505 502
         if ($node) {
506 503
           return node_help('node/%/edit', array(1 => $node->nid));
507
-        }
508
-        else {
504
+        } else {
509 505
           return node_help('node/add/'. $type, array('node', 'add', $type));
510 506
         }
511 507
       }
@@ -537,8 +533,7 @@  discard block
 block discarded – undo
537 533
 
538 534
       // Working around the bug described at http://drupal.org/node/302873
539 535
       module_load_include('inc', 'content_profile', 'content_profile.theme');
540
-    }
541
-    elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
536
+    } elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
542 537
       $content['content_profile_'. $type] = array(
543 538
         '#admin' => $uid != $user->uid,
544 539
         '#theme' => 'content_profile_display_add_link',
Please login to merge, or discard this patch.
Upper-Lower-Casing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
   if ($user->uid == $account->uid || user_access('administer nodes') ){
95 95
     return node_access('create', $type);
96 96
   }
97
-  return FALSE;
97
+  return false;
98 98
 }
99 99
 
100 100
 /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     '#type' => 'fieldset',
139 139
     '#title' => t('Display settings'),
140 140
     '#description' => t('Customize the display of this content profile.'),
141
-    '#collapsible' => TRUE,
141
+    '#collapsible' => true,
142 142
   );
143 143
   $form['display']['user_display'] = array(
144 144
     '#type' => 'radios',
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
   if (is_object($type)) {
202 202
     $type = $type->type;
203 203
   }
204
-  return variable_get('content_profile_use_'. $type, FALSE);
204
+  return variable_get('content_profile_use_'. $type, false);
205 205
 }
206 206
 
207 207
 /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  * @param $value
218 218
  *   The value to compare the given setting too.
219 219
  */
220
-function content_profile_get_types($op = 'types', $setting = NULL , $value = TRUE) {
220
+function content_profile_get_types($op = 'types', $setting = null , $value = true) {
221 221
   $types = array();
222 222
 
223 223
   foreach (node_get_types($op) as $type => $info) {
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
       '#type' => 'fieldset',
262 262
       '#title' => t('Content Profile'),
263 263
       '#group' => 'additional_settings',
264
-      '#collapsible' => TRUE,
265
-      '#collapsed' => TRUE,
264
+      '#collapsible' => true,
265
+      '#collapsed' => true,
266 266
       '#weight' => 32,
267 267
     );
268 268
     $form['content_profile']['content_profile_use'] = array(
269 269
       '#type' => 'checkbox',
270 270
       '#title' => t('Use this content type as a content profile for users'),
271
-      '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE),
271
+      '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, false),
272 272
     );
273 273
   }
274 274
   elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
275 275
     // Customize the redirect target and buttons of our own node forms.
276 276
     if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {
277
-      $form['buttons']['preview']['#access'] = FALSE;
278
-      $form['buttons']['delete']['#access'] = FALSE;
277
+      $form['buttons']['preview']['#access'] = false;
278
+      $form['buttons']['delete']['#access'] = false;
279 279
       $form['#redirect'] = arg(2) == 'profile' ? 'user/'. $form['#node']->uid : $_GET['q'];
280 280
     }
281 281
     // Set the author value - note that this works only for admins.
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 /**
289 289
  * Implementation of hook_user().
290 290
  */
291
-function content_profile_user($op, &$edit, &$account, $category = NULL) {
291
+function content_profile_user($op, &$edit, &$account, $category = null) {
292 292
   global $user;
293 293
 
294 294
   switch ($op) {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 /**
375 375
  * Implementation of hook_nodeapi().
376 376
  */
377
-function content_profile_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
377
+function content_profile_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
378 378
 
379 379
   if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer nodes') && arg(0) != 'admin') {
380 380
     // Check if this nodetype already exists
@@ -478,18 +478,18 @@  discard block
 block discarded – undo
478 478
  * @param $reset
479 479
  *   Optional. If set, the cache is reset.
480 480
  */
481
-function content_profile_load($type, $uid, $lang = '', $reset = NULL) {
481
+function content_profile_load($type, $uid, $lang = '', $reset = null) {
482 482
   static $cache = array();
483 483
 
484 484
   if (!isset($cache[$type][$uid][$lang]) || $reset) {
485
-    $cache[$type][$uid][$lang] = FALSE;
485
+    $cache[$type][$uid][$lang] = false;
486 486
     $params = array('type' => $type, 'uid' => $uid);
487
-    if ($node = node_load($lang ? $params + array('language' => $lang) : $params, NULL, $reset)) {
487
+    if ($node = node_load($lang ? $params + array('language' => $lang) : $params, null, $reset)) {
488 488
       $cache[$type][$uid][$lang] = $node->nid;
489 489
     }
490 490
     return $node;
491 491
   }
492
-  return !empty($cache[$type][$uid][$lang]) ? node_load($cache[$type][$uid][$lang]) : FALSE;
492
+  return !empty($cache[$type][$uid][$lang]) ? node_load($cache[$type][$uid][$lang]) : false;
493 493
 }
494 494
 
495 495
 /**
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
   $return = array(
564 564
     'content_profile_display_view' => array(
565 565
       'template'  => 'content_profile-display-view',
566
-      'arguments' => array('element' => NULL),
566
+      'arguments' => array('element' => null),
567 567
       'file' => 'content_profile.theme.inc',
568 568
     ),
569 569
     'content_profile_display_add_link' => array(
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
   );
582 582
   if (module_exists('pageroute')) {
583 583
     $return['content_profile_pageroute_empty']  = array(
584
-      'arguments' => array('type_name' => NULL),
584
+      'arguments' => array('type_name' => null),
585 585
     	'file' => 'content_profile.pageroute.inc',
586 586
     );
587 587
   }
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.
boinc/modules/contrib/content_profile/views/content_profile.views.inc 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_views_data_alter().
11 11
  */
12 12
 function content_profile_views_data_alter(&$data) {
13
-  // node relationship for profiles
14
-  $data['users']['content_profile_rel'] = array(
13
+    // node relationship for profiles
14
+    $data['users']['content_profile_rel'] = array(
15 15
     'group' => t('Node'),
16 16
     'title' => t('Content Profile'),
17 17
     'help' => t('Create a relationship to a content profile of the user.'),
18 18
     'relationship' => array(
19
-      'handler' => 'content_profile_views_handler_relationship',
20
-      'base' => 'node',
21
-      'base field' => 'uid',
22
-      'label' => t('Content Profile'),
19
+        'handler' => 'content_profile_views_handler_relationship',
20
+        'base' => 'node',
21
+        'base field' => 'uid',
22
+        'label' => t('Content Profile'),
23 23
     ),
24
-  );
24
+    );
25 25
 }
26 26
 
27 27
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
  * Implementation of hook_views_handlers().
30 30
  */
31 31
 function content_profile_views_handlers() {
32
-  return array(
33
-  'info' => array(
32
+    return array(
33
+    'info' => array(
34 34
     'path' => drupal_get_path('module', 'content_profile') .'/views',
35 35
     ),
36
-  'handlers' => array(
36
+    'handlers' => array(
37 37
     'content_profile_views_handler_relationship' => array(
38
-     'parent' => 'views_handler_relationship',
39
-     ),
38
+        'parent' => 'views_handler_relationship',
39
+        ),
40 40
     ),
41
-  );
41
+    );
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 function content_profile_views_handlers() {
32 32
   return array(
33 33
   'info' => array(
34
-    'path' => drupal_get_path('module', 'content_profile') .'/views',
34
+    'path' => drupal_get_path('module', 'content_profile').'/views',
35 35
     ),
36 36
   'handlers' => array(
37 37
     'content_profile_views_handler_relationship' => array(
Please login to merge, or discard this patch.
modules/contrib/content_profile/panels/relationships/node_from_user.inc 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * Implementation of specially named hook_ctools_relationships().
12 12
  */
13 13
 function content_profile_node_from_user_ctools_relationships() {
14
-  $args['node_from_user'] = array(
14
+    $args['node_from_user'] = array(
15 15
     'title' => t("Profile Node"),
16 16
     'keyword' => 'content_profile',
17 17
     'description' => t('Adds a Content Profile from user context'),
@@ -19,49 +19,49 @@  discard block
 block discarded – undo
19 19
     'context' => 'content_profile_node_from_user_ctools_context',
20 20
     'settings form' => 'content_profile_node_from_user_ctools_settings_form',
21 21
     'settings form validate' => 'content_profile_node_from_user_ctools_settings_form_validate',
22
-  );
22
+    );
23 23
   
24
-  return $args;
24
+    return $args;
25 25
 }
26 26
 
27 27
 /**
28 28
  * Return a new context based on an existing context.
29 29
  */
30 30
 function content_profile_node_from_user_ctools_context($context, $conf) {
31
-  // If unset it wants a generic, unfilled context, which is just NULL.
32
-  if (empty($context->data) || !isset($context->data->uid)) {
31
+    // If unset it wants a generic, unfilled context, which is just NULL.
32
+    if (empty($context->data) || !isset($context->data->uid)) {
33 33
     $new_context = ctools_context_create_empty('node', NULL);
34
-  }
35
-  else {
34
+    }
35
+    else {
36 36
     // Load the node for the requested type
37 37
     $uid = $context->data->uid;
38 38
     $content_profile_node = content_profile_load($conf['type'], $uid);
39 39
 
40 40
     // Send it to ctools.
41 41
     $new_context = ctools_context_create('node', $content_profile_node);
42
-  }
42
+    }
43 43
 
44
-  // Have content profile relationships limit CCK field availability.
45
-  if (isset($new_context->restrictions['type'])) {
44
+    // Have content profile relationships limit CCK field availability.
45
+    if (isset($new_context->restrictions['type'])) {
46 46
     $new_context->restrictions['type'][] = $conf['type'];
47
-  }
48
-  else {
47
+    }
48
+    else {
49 49
     $new_context->restrictions['type'] = array($conf['type']);
50
-  }
51
-  return $new_context;
50
+    }
51
+    return $new_context;
52 52
 }
53 53
 
54 54
 /**
55 55
  * Settings form for the relationship
56 56
  */
57 57
 function content_profile_node_from_user_ctools_settings_form($conf) {
58
-  $options = content_profile_get_types('names');
59
-  $form['type'] = array(
58
+    $options = content_profile_get_types('names');
59
+    $form['type'] = array(
60 60
     '#type' => 'select',
61 61
     '#title' => t('Relationship type'),
62 62
     '#options' => $options,
63 63
     '#default_value' => $conf['type']
64
-  );
64
+    );
65 65
 
66
-  return $form;
66
+    return $form;
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
   // If unset it wants a generic, unfilled context, which is just NULL.
32 32
   if (empty($context->data) || !isset($context->data->uid)) {
33 33
     $new_context = ctools_context_create_empty('node', NULL);
34
-  }
35
-  else {
34
+  } else {
36 35
     // Load the node for the requested type
37 36
     $uid = $context->data->uid;
38 37
     $content_profile_node = content_profile_load($conf['type'], $uid);
@@ -44,8 +43,7 @@  discard block
 block discarded – undo
44 43
   // Have content profile relationships limit CCK field availability.
45 44
   if (isset($new_context->restrictions['type'])) {
46 45
     $new_context->restrictions['type'][] = $conf['type'];
47
-  }
48
-  else {
46
+  } else {
49 47
     $new_context->restrictions['type'] = array($conf['type']);
50 48
   }
51 49
   return $new_context;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 function content_profile_node_from_user_ctools_context($context, $conf) {
31 31
   // If unset it wants a generic, unfilled context, which is just NULL.
32 32
   if (empty($context->data) || !isset($context->data->uid)) {
33
-    $new_context = ctools_context_create_empty('node', NULL);
33
+    $new_context = ctools_context_create_empty('node', null);
34 34
   }
35 35
   else {
36 36
     // Load the node for the requested type
Please login to merge, or discard this patch.
boinc/modules/contrib/content_profile/content_profile.theme_vars.inc 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -11,109 +11,109 @@
 block discarded – undo
11 11
  */
12 12
 class content_profile_theme_variables {
13 13
 
14
-  var $uid;
15
-  var $_cache = array();
14
+    var $uid;
15
+    var $_cache = array();
16 16
 
17
-  function content_profile_theme_variables($uid) {
17
+    function content_profile_theme_variables($uid) {
18 18
     $this->uid = $uid;
19
-  }
19
+    }
20 20
 
21
-  /**
22
-   * Gets the user id of the profiles owner.
23
-   */
24
-  function get_uid() {
21
+    /**
22
+     * Gets the user id of the profiles owner.
23
+     */
24
+    function get_uid() {
25 25
     return $uid;
26
-  }
26
+    }
27 27
 
28
-  /**
29
-   * Gets all type names keyed with their machine readable names.
30
-   */
31
-  function get_profile_types() {
28
+    /**
29
+     * Gets all type names keyed with their machine readable names.
30
+     */
31
+    function get_profile_types() {
32 32
     return content_profile_get_types('names');
33
-  }
33
+    }
34 34
 
35
-  /**
36
-   * Gets all template variables for the content profile of this type.
37
-   *
38
-   * @param $type
39
-   *   The type of the user's content profile
40
-   * @param $teaser
41
-   *   Whether the value is to be generated for the teaser.
42
-   * @param $page
43
-   *   Whether the value is to be generated for the page view.
44
-   *
45
-   * @return
46
-   *   An array of variables available for the profile node
47
-   *   or FALSE if there has been no profile created yet.
48
-   */
49
-  function get_variables($type, $teaser = FALSE, $page = FALSE) {
35
+    /**
36
+     * Gets all template variables for the content profile of this type.
37
+     *
38
+     * @param $type
39
+     *   The type of the user's content profile
40
+     * @param $teaser
41
+     *   Whether the value is to be generated for the teaser.
42
+     * @param $page
43
+     *   Whether the value is to be generated for the page view.
44
+     *
45
+     * @return
46
+     *   An array of variables available for the profile node
47
+     *   or FALSE if there has been no profile created yet.
48
+     */
49
+    function get_variables($type, $teaser = FALSE, $page = FALSE) {
50 50
     if (!isset($this->_cache[$type][$teaser][$page])) {
51
-      $this->_cache[$type][$teaser][$page] = FALSE;
51
+        $this->_cache[$type][$teaser][$page] = FALSE;
52 52
 
53
-      if ($node = content_profile_load($type, $this->uid)) {
53
+        if ($node = content_profile_load($type, $this->uid)) {
54 54
         // Make sure the node is prepared for viewing
55 55
         $node = node_build_content($node, $teaser, $page);
56 56
         $vars = array('node' => $node, 'teaser' => $teaser, 'page' => $page);
57 57
 
58 58
         // Apply all node template preprocessors
59 59
         foreach ($this->_get_node_preprocessors() as $function) {
60
-          if (function_exists($function)) {
60
+            if (function_exists($function)) {
61 61
             $function($vars, 'node');
62
-          }
62
+            }
63 63
         }
64 64
         $this->_cache[$type][$teaser][$page] = $vars;
65
-      }
65
+        }
66 66
     }
67 67
     return $this->_cache[$type][$teaser][$page];
68
-  }
68
+    }
69 69
 
70
-  /**
71
-   * Gets a single template variable for the content profile of this type.
72
-   *
73
-   * @param $type
74
-   *   The type of the user's content profile
75
-   * @param $name
76
-   *   The name of the variable to get.
77
-   *
78
-   * @return
79
-   *   The variable or FALSE if there has been no profile created yet.
80
-   */
81
-  function get_variable($type, $name) {
70
+    /**
71
+     * Gets a single template variable for the content profile of this type.
72
+     *
73
+     * @param $type
74
+     *   The type of the user's content profile
75
+     * @param $name
76
+     *   The name of the variable to get.
77
+     *
78
+     * @return
79
+     *   The variable or FALSE if there has been no profile created yet.
80
+     */
81
+    function get_variable($type, $name) {
82 82
     if ($vars = $this->get_variables($type)) {
83
-      return $vars[$name];
83
+        return $vars[$name];
84 84
     }
85 85
     return FALSE;
86
-  }
86
+    }
87 87
 
88 88
 
89
-  /**
90
-   * Generate a display of the given node.
91
-   *
92
-   * @param $type
93
-   *   The type of the user's content profile
94
-   * @param $teaser
95
-   *   Whether to display the teaser only or the full form.
96
-   * @param $page
97
-   *   Whether the node is being displayed by itself as a page.
98
-   * @param $links
99
-   *   Whether or not to display node links. Links are omitted for node previews.
100
-   *
101
-   * @return
102
-   *   An HTML representation of the themed node or FALSE if there has been no profile created yet.
103
-   */
104
-  function get_view($type, $teaser = FALSE, $page = FALSE, $links = TRUE) {
89
+    /**
90
+     * Generate a display of the given node.
91
+     *
92
+     * @param $type
93
+     *   The type of the user's content profile
94
+     * @param $teaser
95
+     *   Whether to display the teaser only or the full form.
96
+     * @param $page
97
+     *   Whether the node is being displayed by itself as a page.
98
+     * @param $links
99
+     *   Whether or not to display node links. Links are omitted for node previews.
100
+     *
101
+     * @return
102
+     *   An HTML representation of the themed node or FALSE if there has been no profile created yet.
103
+     */
104
+    function get_view($type, $teaser = FALSE, $page = FALSE, $links = TRUE) {
105 105
     if ($node = content_profile_load($type, $this->uid)) {
106
-      return node_view($node, $teaser, $page, $links);
106
+        return node_view($node, $teaser, $page, $links);
107 107
     }
108 108
     return FALSE;
109
-  }
109
+    }
110 110
 
111 111
 
112
-  function _get_node_preprocessors() {
112
+    function _get_node_preprocessors() {
113 113
     $hooks = theme_get_registry();
114 114
     $functions = $hooks['node']['preprocess functions'];
115 115
     // We don't need 'template_preprocess'
116 116
     unset($functions[0]);
117 117
     return $functions;
118
-  }
118
+    }
119 119
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
    *   An array of variables available for the profile node
47 47
    *   or FALSE if there has been no profile created yet.
48 48
    */
49
-  function get_variables($type, $teaser = FALSE, $page = FALSE) {
49
+  function get_variables($type, $teaser = false, $page = false) {
50 50
     if (!isset($this->_cache[$type][$teaser][$page])) {
51
-      $this->_cache[$type][$teaser][$page] = FALSE;
51
+      $this->_cache[$type][$teaser][$page] = false;
52 52
 
53 53
       if ($node = content_profile_load($type, $this->uid)) {
54 54
         // Make sure the node is prepared for viewing
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     if ($vars = $this->get_variables($type)) {
83 83
       return $vars[$name];
84 84
     }
85
-    return FALSE;
85
+    return false;
86 86
   }
87 87
 
88 88
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
    * @return
102 102
    *   An HTML representation of the themed node or FALSE if there has been no profile created yet.
103 103
    */
104
-  function get_view($type, $teaser = FALSE, $page = FALSE, $links = TRUE) {
104
+  function get_view($type, $teaser = false, $page = false, $links = true) {
105 105
     if ($node = content_profile_load($type, $this->uid)) {
106 106
       return node_view($node, $teaser, $page, $links);
107 107
     }
108
-    return FALSE;
108
+    return false;
109 109
   }
110 110
 
111 111
 
Please login to merge, or discard this patch.
boinc/modules/contrib/content_profile/content_profile.rules_defaults.inc 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -10,103 +10,103 @@
 block discarded – undo
10 10
  * no profile.
11 11
  */
12 12
 function content_profile_rules_defaults() {
13
-  $types = array_keys(content_profile_get_types('names'));
14
-  $type = array_shift($types);
15
-  $config =
13
+    $types = array_keys(content_profile_get_types('names'));
14
+    $type = array_shift($types);
15
+    $config =
16 16
 array (
17
-  'rules' =>
18
-  array (
17
+    'rules' =>
18
+    array (
19 19
     'content_profile_rule_1' =>
20 20
     array (
21
-      '#type' => 'rule',
22
-      '#set' => 'event_user_login',
23
-      '#label' => 'Redirect to profile creation page, if users have no profile.',
24
-      '#active' => 0,
25
-      '#weight' => '0',
26
-      '#conditions' =>
27
-      array (
21
+        '#type' => 'rule',
22
+        '#set' => 'event_user_login',
23
+        '#label' => 'Redirect to profile creation page, if users have no profile.',
24
+        '#active' => 0,
25
+        '#weight' => '0',
26
+        '#conditions' =>
27
+        array (
28 28
         0 =>
29 29
         array (
30
-          '#negate' => 1,
31
-          '#weight' => 0,
32
-          '#info' =>
33
-          array (
30
+            '#negate' => 1,
31
+            '#weight' => 0,
32
+            '#info' =>
33
+            array (
34 34
             'label' => 'Logged in user has his Profile created',
35 35
             'arguments' =>
36 36
             array (
37
-              'user' =>
38
-              array (
37
+                'user' =>
38
+                array (
39 39
                 'type' => 'user',
40 40
                 'label' => 'User',
41
-              ),
41
+                ),
42 42
             ),
43 43
             'module' => 'Content Profile',
44
-          ),
45
-          '#name' => 'content_profile_user_has_profile_condition',
46
-          '#settings' =>
47
-          array (
44
+            ),
45
+            '#name' => 'content_profile_user_has_profile_condition',
46
+            '#settings' =>
47
+            array (
48 48
             'type' => $type,
49 49
             '#argument map' =>
50 50
             array (
51
-              'account' => 'user',
51
+                'account' => 'user',
52 52
             ),
53
-          ),
54
-          '#type' => 'condition',
53
+            ),
54
+            '#type' => 'condition',
55
+        ),
55 56
         ),
56
-      ),
57
-      '#actions' =>
58
-      array (
57
+        '#actions' =>
58
+        array (
59 59
         0 =>
60 60
         array (
61
-          '#type' => 'action',
62
-          '#settings' =>
63
-          array (
61
+            '#type' => 'action',
62
+            '#settings' =>
63
+            array (
64 64
             'path' => 'node/add/'. str_replace('_', '-', $type),
65 65
             'query' => '',
66 66
             'fragment' => '',
67 67
             'force' => 1,
68 68
             'override' => 1,
69
-          ),
70
-          '#name' => 'rules_action_drupal_goto',
71
-          '#info' =>
72
-          array (
69
+            ),
70
+            '#name' => 'rules_action_drupal_goto',
71
+            '#info' =>
72
+            array (
73 73
             'label' => 'Redirect to profile creation page',
74 74
             'label callback' => false,
75 75
             'module' => 'System',
76 76
             'eval input' =>
77 77
             array (
78
-              0 => 'path',
79
-              1 => 'query',
80
-              2 => 'fragment',
78
+                0 => 'path',
79
+                1 => 'query',
80
+                2 => 'fragment',
81
+            ),
81 82
             ),
82
-          ),
83
-          '#weight' => 0,
83
+            '#weight' => 0,
84 84
         ),
85 85
         1 =>
86 86
         array (
87
-          '#weight' => 0,
88
-          '#info' =>
89
-          array (
87
+            '#weight' => 0,
88
+            '#info' =>
89
+            array (
90 90
             'label' => 'Show a message',
91 91
             'label callback' => false,
92 92
             'module' => 'System',
93 93
             'eval input' =>
94 94
             array (
95
-              0 => 'message',
95
+                0 => 'message',
96
+            ),
96 97
             ),
97
-          ),
98
-          '#name' => 'rules_action_drupal_message',
99
-          '#settings' =>
100
-          array (
98
+            '#name' => 'rules_action_drupal_message',
99
+            '#settings' =>
100
+            array (
101 101
             'message' => 'You haven\'t filled out your profile information yet. Please do so now!',
102 102
             'error' => 1,
103
-          ),
104
-          '#type' => 'action',
103
+            ),
104
+            '#type' => 'action',
105 105
         ),
106
-      ),
106
+        ),
107
+    ),
107 108
     ),
108
-  ),
109 109
 );
110 110
 
111
-  return $config;
111
+    return $config;
112 112
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
   $types = array_keys(content_profile_get_types('names'));
14 14
   $type = array_shift($types);
15 15
   $config =
16
-array (
16
+array(
17 17
   'rules' =>
18
-  array (
18
+  array(
19 19
     'content_profile_rule_1' =>
20
-    array (
20
+    array(
21 21
       '#type' => 'rule',
22 22
       '#set' => 'event_user_login',
23 23
       '#label' => 'Redirect to profile creation page, if users have no profile.',
24 24
       '#active' => 0,
25 25
       '#weight' => '0',
26 26
       '#conditions' =>
27
-      array (
27
+      array(
28 28
         0 =>
29
-        array (
29
+        array(
30 30
           '#negate' => 1,
31 31
           '#weight' => 0,
32 32
           '#info' =>
33
-          array (
33
+          array(
34 34
             'label' => 'Logged in user has his Profile created',
35 35
             'arguments' =>
36
-            array (
36
+            array(
37 37
               'user' =>
38
-              array (
38
+              array(
39 39
                 'type' => 'user',
40 40
                 'label' => 'User',
41 41
               ),
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
           ),
45 45
           '#name' => 'content_profile_user_has_profile_condition',
46 46
           '#settings' =>
47
-          array (
47
+          array(
48 48
             'type' => $type,
49 49
             '#argument map' =>
50
-            array (
50
+            array(
51 51
               'account' => 'user',
52 52
             ),
53 53
           ),
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
         ),
56 56
       ),
57 57
       '#actions' =>
58
-      array (
58
+      array(
59 59
         0 =>
60
-        array (
60
+        array(
61 61
           '#type' => 'action',
62 62
           '#settings' =>
63
-          array (
64
-            'path' => 'node/add/'. str_replace('_', '-', $type),
63
+          array(
64
+            'path' => 'node/add/'.str_replace('_', '-', $type),
65 65
             'query' => '',
66 66
             'fragment' => '',
67 67
             'force' => 1,
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
           ),
70 70
           '#name' => 'rules_action_drupal_goto',
71 71
           '#info' =>
72
-          array (
72
+          array(
73 73
             'label' => 'Redirect to profile creation page',
74 74
             'label callback' => false,
75 75
             'module' => 'System',
76 76
             'eval input' =>
77
-            array (
77
+            array(
78 78
               0 => 'path',
79 79
               1 => 'query',
80 80
               2 => 'fragment',
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
           '#weight' => 0,
84 84
         ),
85 85
         1 =>
86
-        array (
86
+        array(
87 87
           '#weight' => 0,
88 88
           '#info' =>
89
-          array (
89
+          array(
90 90
             'label' => 'Show a message',
91 91
             'label callback' => false,
92 92
             'module' => 'System',
93 93
             'eval input' =>
94
-            array (
94
+            array(
95 95
               0 => 'message',
96 96
             ),
97 97
           ),
98 98
           '#name' => 'rules_action_drupal_message',
99 99
           '#settings' =>
100
-          array (
100
+          array(
101 101
             'message' => 'You haven\'t filled out your profile information yet. Please do so now!',
102 102
             'error' => 1,
103 103
           ),
Please login to merge, or discard this patch.