Commit cc5ebf9c authored by yched's avatar yched

more cleanup - thanks doug green and his coder module

parent 31eaa098
......@@ -28,10 +28,10 @@ function content_help($section) {
if (strpos($section, 'node/add') === 0) {
$types = content_types();
foreach ($types as $type_name => $type) {
if ($section == 'node/add#' . $type_name) {
if ($section == 'node/add#'. $type_name) {
return t($types[$type_name]['description']);
}
if ($section == 'node/add/' . $type_name) {
if ($section == 'node/add/'. $type_name) {
return t($types[$type_name]['help']);
}
}
......@@ -322,7 +322,7 @@ function content_update(&$node) {
function content_delete(&$node) {
_content_field_invoke('delete', $node);
_content_field_invoke_default('delete', $node);
db_query('DELETE FROM {'. 'node_'. $node->type .'} WHERE nid = %d', $node->nid);
db_query('DELETE FROM {node_'. $node->type .'} WHERE nid = %d', $node->nid);
cache_clear_all('content:'. $node->nid, TRUE);
}
......@@ -350,7 +350,7 @@ function content_nodeapi(&$node, $op, $teaser, $page) {
_content_field_invoke('delete revision', $node);
_content_field_invoke_default('delete revision', $node);
cache_clear_all('content:'. $node->nid .':'. $node->vid);
db_query('DELETE FROM {'. 'node_'. $node->type .'} WHERE vid = %d', $node->vid);
db_query('DELETE FROM {node_'. $node->type .'} WHERE vid = %d', $node->vid);
}
break;
}
......
......@@ -51,7 +51,7 @@ function _content_admin_type_fields() {
while ($type = db_fetch_array($result)) {
$types[] = $type['label'];
}
$row[] = implode (', ', $types);
$row[] = implode(', ', $types);
$rows[] = $row;
}
......@@ -238,7 +238,7 @@ function content_admin_field_overview_form($type_name) {
// Create a dummy node and form and call hook_form_alter()
// to produce an array of fields and weights added to the node by all modules.
$dummy_node = new StdClass();
$dummy_node = new stdClass();
$dummy_node->type = $type['type_name'];
$dummy_form_id = $type['type_name'] .'_node_form';
$dummy_form = node_form_array($dummy_node);
......@@ -865,7 +865,6 @@ function _content_admin_field_validate($form_id, $form_values) {
module_invoke($widget_type['module'], 'widget_settings', 'validate', array_merge($field, $form_values));
module_invoke($field_type['module'], 'field_settings', 'validate', array_merge($field, $form_values));
}
/**
......
......@@ -238,8 +238,8 @@ function content_field_instance_delete($properties) {
* Implementation of hook_simpletest().
*/
function content_simpletest() {
$dir = drupal_get_path('module', 'content'). '/tests';
$tests = file_scan_directory($dir, '\.test$');
$dir = drupal_get_path('module', 'content') .'/tests';
$tests = file_scan_directory($dir, '\.test$');
return array_keys($tests);
}
......@@ -35,7 +35,7 @@ function fieldgroup_menu($may_cache) {
);
if (arg(4) == 'groups' && arg(5)) {
$items[] = array(
'path' => 'admin/node/types/'. arg(3) .'/groups/'. arg(5). '/edit',
'path' => 'admin/node/types/'. arg(3) .'/groups/'. arg(5) .'/edit',
'title' => t('edit group'),
'callback' => 'fieldgroup_edit_group',
'access' => user_access('administer content types'),
......@@ -43,7 +43,7 @@ function fieldgroup_menu($may_cache) {
'type' => MENU_CALLBACK_ITEM,
);
$items[] = array(
'path' => 'admin/node/types/'. arg(3) .'/groups/'. arg(5). '/remove',
'path' => 'admin/node/types/'. arg(3) .'/groups/'. arg(5) .'/remove',
'title' => t('edit group'),
'callback' => 'fieldgroup_remove_group',
'access' => user_access('administer content types'),
......
......@@ -270,7 +270,7 @@ function number_allowed_values($field) {
$list = array_map('trim', $list);
$list = array_filter($list, 'strlen');
foreach ($list as $opt) {
list ($key, $value) = explode('|', $opt);
list($key, $value) = explode('|', $opt);
$allowed_values[$field['field_name']][$key] = $value ? $value : $key;
}
}
......
......@@ -336,7 +336,7 @@ function text_widget($op, &$node, $field, &$items) {
foreach ($items as $delta => $data) {
$error_field = $field['field_name'].']['.$delta.'][value';
if (strlen($data['value']) > $field['max_length']) {
form_set_error($error_field, t('%label is longer than %max characters.', array('%label' => $field['widget']['label'],'%max' => $field['max_length'])));
form_set_error($error_field, t('%label is longer than %max characters.', array('%label' => $field['widget']['label'], '%max' => $field['max_length'])));
}
}
}
......@@ -378,7 +378,7 @@ function text_allowed_values($field) {
$list = array_map('trim', $list);
$list = array_filter($list, 'strlen');
foreach ($list as $opt) {
list ($key, $value) = explode('|', $opt);
list($key, $value) = explode('|', $opt);
$allowed_values[$field['field_name']][$key] = $value ? $value : $key;
}
}
......
......@@ -182,7 +182,7 @@ function userreference_widget($op, &$node, $field, &$node_field) {
else {
switch ($op) {
case 'prepare form values':
foreach($node_field as $delta => $item) {
foreach ($node_field as $delta => $item) {
if (!empty($node_field[$delta]['uid'])) {
$node_field[$delta]['default user_name'] = db_result(db_query("SELECT name FROM {users} WHERE uid = '%d'", $node_field[$delta]['uid']));
}
......@@ -264,7 +264,8 @@ function userreference_widget($op, &$node, $field, &$node_field) {
function _userreference_potential_references($field) {
if (!$field['required']) {
$users = array('none' => t('<none>'));
} else {
}
else {
$users = array();
}
$roles = array();
......@@ -276,10 +277,10 @@ function _userreference_potential_references($field) {
}
}
if (!$roles || !isset($field['referenceable_roles']) || in_array(DRUPAL_AUTHENTICATED_RID, $field['referenceable_roles'])) {
$result = db_query("SELECT u.name, u.uid FROM {users} u WHERE uid > 0 ORDER BY u.name ASC");
$result = db_query('SELECT u.name, u.uid FROM {users} u WHERE uid > 0 ORDER BY u.name ASC');
}
else {
$result = db_query("SELECT u.name, u.uid FROM {users} u LEFT JOIN {users_roles} r ON u.uid = r.uid WHERE u.uid > 0 AND r.rid IN (" . implode($roles, ',') . ') ORDER BY u.name ASC');
$result = db_query('SELECT u.name, u.uid FROM {users} u LEFT JOIN {users_roles} r ON u.uid = r.uid WHERE u.uid > 0 AND r.rid IN ('. implode($roles, ',') .') ORDER BY u.name ASC');
}
while ($user = db_fetch_object($result)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment