diff options
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/content_types.inc | 18 | ||||
-rw-r--r-- | modules/node/node.admin.inc | 30 | ||||
-rw-r--r-- | modules/node/node.module | 112 | ||||
-rw-r--r-- | modules/node/node.pages.inc | 36 |
4 files changed, 98 insertions, 98 deletions
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index a436336c4..328f67bb8 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -20,16 +20,16 @@ function node_overview_types() { if (node_hook($type, 'form')) { $type_url_str = str_replace('_', '-', $type->type); $row = array( - l($name, 'admin/content/node-type/'. $type_url_str), + l($name, 'admin/content/node-type/' . $type_url_str), check_plain($type->type), filter_xss_admin($type->description), ); // Set the edit column. - $row[] = array('data' => l(t('edit'), 'admin/content/node-type/'. $type_url_str)); + $row[] = array('data' => l(t('edit'), 'admin/content/node-type/' . $type_url_str)); // Set the delete column. if ($type->custom) { - $row[] = array('data' => l(t('delete'), 'admin/content/node-type/'. $type_url_str .'/delete')); + $row[] = array('data' => l(t('delete'), 'admin/content/node-type/' . $type_url_str . '/delete')); } else { $row[] = array('data' => ''); @@ -152,7 +152,7 @@ function node_type_form(&$form_state, $type = NULL) { ); $form['workflow']['node_options'] = array('#type' => 'checkboxes', '#title' => t('Default options'), - '#default_value' => variable_get('node_options_'. $type->type, array('status', 'promote')), + '#default_value' => variable_get('node_options_' . $type->type, array('status', 'promote')), '#options' => array( 'status' => t('Published'), 'promote' => t('Promoted to front page'), @@ -280,7 +280,7 @@ function node_type_form_submit($form, &$form_state) { node_type_reset($type); } elseif ($op == t('Delete content type')) { - $form_state['redirect'] = 'admin/content/node-type/'. str_replace('_', '-', $type->old_type) .'/delete'; + $form_state['redirect'] = 'admin/content/node-type/' . str_replace('_', '-', $type->old_type) . '/delete'; return; } @@ -300,8 +300,8 @@ function node_type_form_submit($form, &$form_state) { // Save or reset persistent variable values. foreach ($variables as $key => $value) { - $variable_new = $key .'_'. $type->type; - $variable_old = $key .'_'. $type->old_type; + $variable_new = $key . '_' . $type->type; + $variable_old = $key . '_' . $type->old_type; if ($op == t('Reset to defaults')) { variable_del($variable_old); @@ -385,10 +385,10 @@ function node_type_delete_confirm(&$form_state, $type) { $num_nodes = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = '%s'", $type->type)); if ($num_nodes) { - $caption .= '<p>'. format_plural($num_nodes, '<strong>Warning:</strong> there is currently 1 %type post on your site. It may not be able to be displayed or edited correctly, once you have removed this content type.', '<strong>Warning:</strong> there are currently @count %type posts on your site. They may not be able to be displayed or edited correctly, once you have removed this content type.', array('%type' => $type->name)) .'</p>'; + $caption .= '<p>' . format_plural($num_nodes, '<strong>Warning:</strong> there is currently 1 %type post on your site. It may not be able to be displayed or edited correctly, once you have removed this content type.', '<strong>Warning:</strong> there are currently @count %type posts on your site. They may not be able to be displayed or edited correctly, once you have removed this content type.', array('%type' => $type->name)) . '</p>'; } - $caption .= '<p>'. t('This action cannot be undone.') .'</p>'; + $caption .= '<p>' . t('This action cannot be undone.') . '</p>'; return confirm_form($form, $message, 'admin/build/types', $caption, t('Delete')); } diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc index 0b1252d74..81160b1d6 100644 --- a/modules/node/node.admin.inc +++ b/modules/node/node.admin.inc @@ -14,8 +14,8 @@ function node_configure() { // in the {node_access} table, or if there are modules that // implement hook_node_grants(). if (db_result(db_query('SELECT COUNT(*) FROM {node_access}')) != 1 || count(module_implements('node_grants')) > 0) { - $status = '<p>'. t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings.') .'</p>'; - $status .= '<p>'. t('Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed posts will automatically use the new permissions.') .'</p>'; + $status = '<p>' . t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings.') . '</p>'; + $status .= '<p>' . t('Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed posts will automatically use the new permissions.') . '</p>'; $form['access'] = array( '#type' => 'fieldset', @@ -48,7 +48,7 @@ function node_configure() { 1800 => t('1800 characters'), 2000 => t('2000 characters'), ), - '#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.") + '#description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited' . Note that this setting will only affect new or updated content and will not affect existing teasers.") ); $form['node_preview'] = array( @@ -186,7 +186,7 @@ function node_build_filter_query() { case 'status': // Note: no exploitable hole as $key/$value have already been checked when submitted list($key, $value) = explode('-', $value, 2); - $where[] = 'n.'. $key .' = %d'; + $where[] = 'n.' . $key . ' = %d'; break; case 'category': $table = "tn$index"; @@ -202,7 +202,7 @@ function node_build_filter_query() { } $args[] = $value; } - $where = count($where) ? 'WHERE '. implode(' AND ', $where) : ''; + $where = count($where) ? 'WHERE ' . implode(' AND ', $where) : ''; return array('where' => $where, 'join' => $join, 'args' => $args); } @@ -288,17 +288,17 @@ function theme_node_filters($form) { $output .= '<ul class="clear-block">'; if (!empty($form['current'])) { foreach (element_children($form['current']) as $key) { - $output .= '<li>'. drupal_render($form['current'][$key]) .'</li>'; + $output .= '<li>' . drupal_render($form['current'][$key]) . '</li>'; } } - $output .= '<li><dl class="multiselect">'. (!empty($form['current']) ? '<dt><em>'. t('and') .'</em> '. t('where') .'</dt>' : '') .'<dd class="a">'; + $output .= '<li><dl class="multiselect">' . (!empty($form['current']) ? '<dt><em>' . t('and') . '</em> ' . t('where') . '</dt>' : '') . '<dd class="a">'; foreach (element_children($form['filter']) as $key) { $output .= drupal_render($form['filter'][$key]); } $output .= '</dd>'; - $output .= '<dt>'. t('is') .'</dt><dd class="b">'; + $output .= '<dt>' . t('is') . '</dt><dd class="b">'; foreach (element_children($form['status']) as $key) { $output .= drupal_render($form['status'][$key]); @@ -306,7 +306,7 @@ function theme_node_filters($form) { $output .= '</dd>'; $output .= '</dl>'; - $output .= '<div class="container-inline" id="node-admin-buttons">'. drupal_render($form['buttons']) .'</div>'; + $output .= '<div class="container-inline" id="node-admin-buttons">' . drupal_render($form['buttons']) . '</div>'; $output .= '</li></ul>'; return $output; @@ -370,7 +370,7 @@ function node_mass_update($nodes, $updates) { 'error_message' => t('The update has encountered an error.'), // The operations do not live in the .module file, so we need to // tell the batch engine which file to load before calling them. - 'file' => drupal_get_path('module', 'node') .'/node.admin.inc', + 'file' => drupal_get_path('module', 'node') . '/node.admin.inc', ); batch_set($batch); } @@ -412,7 +412,7 @@ function _node_mass_update_batch_process($nodes, $updates, &$context) { $node = _node_mass_update_helper($nid, $updates); // Store result for post-processing in the finished callback. - $context['results'][] = l($node->title, 'node/'. $node->nid); + $context['results'][] = l($node->title, 'node/' . $node->nid); // Update our progress information. $context['sandbox']['progress']++; @@ -462,7 +462,7 @@ function node_admin_nodes() { $filter = node_build_filter_query(); - $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC'), 50, 0, NULL, $filter['args']); + $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n ' . $filter['join'] . ' INNER JOIN {users} u ON n.uid = u.uid ' . $filter['where'] . ' ORDER BY n.changed DESC'), 50, 0, NULL, $filter['args']); // Enable language column if locale is enabled or if we have any node with language $count = db_result(db_query("SELECT COUNT(*) FROM {node} n WHERE language != ''")); @@ -495,14 +495,14 @@ function node_admin_nodes() { while ($node = db_fetch_object($result)) { $nodes[$node->nid] = ''; $options = empty($node->language) ? array() : array('language' => $languages[$node->language]); - $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid, $options) .' '. theme('mark', node_mark($node->nid, $node->changed))); + $form['title'][$node->nid] = array('#value' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed))); $form['name'][$node->nid] = array('#value' => check_plain(node_get_types('name', $node))); $form['username'][$node->nid] = array('#value' => theme('username', $node)); $form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published'))); if ($multilanguage) { $form['language'][$node->nid] = array('#value' => empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name)); } - $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array('query' => $destination))); + $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/' . $node->nid . '/edit', array('query' => $destination))); } $form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes); $form['pager'] = array('#value' => theme('pager', NULL, 50, 0)); @@ -611,7 +611,7 @@ function node_multiple_delete_confirm(&$form_state, $nodes) { '#type' => 'hidden', '#value' => $nid, '#prefix' => '<li>', - '#suffix' => check_plain($title) ."</li>\n", + '#suffix' => check_plain($title) . "</li>\n", ); } $form['operation'] = array('#type' => 'hidden', '#value' => 'delete'); diff --git a/modules/node/node.module b/modules/node/node.module index fea24b56a..f46f2d050 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -36,28 +36,28 @@ function node_help($path, $arg) { switch ($path) { case 'admin/help#node': - $output = '<p>'. t('The node module manages content on your site, and stores all posts (regardless of type) as a "node". In addition to basic publishing settings, including whether the post has been published, promoted to the site front page, or should remain present (or sticky) at the top of lists, the node module also records basic information about the author of a post. Optional revision control over edits is available. For additional functionality, the node module is often extended by other modules.') .'</p>'; - $output .= '<p>'. t('Though each post on your site is a node, each post is also of a particular <a href="@content-type">content type</a>. <a href="@content-type">Content types</a> are used to define the characteristics of a post, including the title and description of the fields displayed on its add and edit pages. Each content type may have different default settings for <em>Publishing options</em> and other workflow controls. By default, the two content types in a standard Drupal installation are <em>Page</em> and <em>Story</em>. Use the <a href="@content-type">content types page</a> to add new or edit existing content types. Additional content types also become available as you enable additional core, contributed and custom modules.', array('@content-type' => url('admin/build/types'))) .'</p>'; - $output .= '<p>'. t('The administrative <a href="@content">content page</a> allows you to review and manage your site content. The <a href="@post-settings">post settings page</a> sets certain options for the display of posts. The node module makes a number of permissions available for each content type, which may be set by role on the <a href="@permissions">permissions page</a>.', array('@content' => url('admin/content/node'), '@post-settings' => url('admin/content/node-settings'), '@permissions' => url('admin/user/permissions'))) .'</p>'; - $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@node">Node module</a>.', array('@node' => 'http://drupal.org/handbook/modules/node/')) .'</p>'; + $output = '<p>' . t('The node module manages content on your site, and stores all posts (regardless of type) as a "node" . In addition to basic publishing settings, including whether the post has been published, promoted to the site front page, or should remain present (or sticky) at the top of lists, the node module also records basic information about the author of a post. Optional revision control over edits is available. For additional functionality, the node module is often extended by other modules.') . '</p>'; + $output .= '<p>' . t('Though each post on your site is a node, each post is also of a particular <a href="@content-type">content type</a>. <a href="@content-type">Content types</a> are used to define the characteristics of a post, including the title and description of the fields displayed on its add and edit pages. Each content type may have different default settings for <em>Publishing options</em> and other workflow controls. By default, the two content types in a standard Drupal installation are <em>Page</em> and <em>Story</em>. Use the <a href="@content-type">content types page</a> to add new or edit existing content types. Additional content types also become available as you enable additional core, contributed and custom modules.', array('@content-type' => url('admin/build/types'))) . '</p>'; + $output .= '<p>' . t('The administrative <a href="@content">content page</a> allows you to review and manage your site content. The <a href="@post-settings">post settings page</a> sets certain options for the display of posts. The node module makes a number of permissions available for each content type, which may be set by role on the <a href="@permissions">permissions page</a>.', array('@content' => url('admin/content/node'), '@post-settings' => url('admin/content/node-settings'), '@permissions' => url('admin/user/permissions'))) . '</p>'; + $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@node">Node module</a>.', array('@node' => 'http://drupal.org/handbook/modules/node/')) . '</p>'; return $output; case 'admin/content/node': return ' '; // Return a non-null value so that the 'more help' link is shown. case 'admin/build/types': - return '<p>'. t('Below is a list of all the content types on your site. All posts that exist on your site are instances of one of these content types.') .'</p>'; + return '<p>' . t('Below is a list of all the content types on your site. All posts that exist on your site are instances of one of these content types.') . '</p>'; case 'admin/build/types/add': - return '<p>'. t('To create a new content type, enter the human-readable name, the machine-readable name, and all other relevant fields that are on this page. Once created, users of your site will be able to create posts that are instances of this content type.') .'</p>'; + return '<p>' . t('To create a new content type, enter the human-readable name, the machine-readable name, and all other relevant fields that are on this page. Once created, users of your site will be able to create posts that are instances of this content type.') . '</p>'; case 'node/%/revisions': - return '<p>'. t('The revisions let you track differences between multiple versions of a post.') .'</p>'; + return '<p>' . t('The revisions let you track differences between multiple versions of a post.') . '</p>'; case 'node/%/edit': $node = node_load($arg[1]); $type = node_get_types('type', $node->type); - return (!empty($type->help) ? '<p>'. filter_xss_admin($type->help) .'</p>' : ''); + return (!empty($type->help) ? '<p>' . filter_xss_admin($type->help) . '</p>' : ''); } if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) { $type = node_get_types('type', str_replace('-', '_', $arg[2])); - return (!empty($type->help) ? '<p>'. filter_xss_admin($type->help) .'</p>' : ''); + return (!empty($type->help) ? '<p>' . filter_xss_admin($type->help) . '</p>' : ''); } } @@ -135,7 +135,7 @@ function node_title_list($result, $title = NULL) { $items = array(); $num_rows = FALSE; while ($node = db_fetch_object($result)) { - $items[] = l($node->title, 'node/'. $node->nid, !empty($node->comment_count) ? array('title' => format_plural($node->comment_count, '1 comment', '@count comments')) : array()); + $items[] = l($node->title, 'node/' . $node->nid, !empty($node->comment_count) ? array('title' => format_plural($node->comment_count, '1 comment', '@count comments')) : array()); $num_rows = TRUE; } @@ -219,11 +219,11 @@ function node_teaser_js(&$form, &$form_state) { // Glue the teaser to the body. if (trim($form_state['values']['teaser_js'])) { // Space the teaser from the body - $body = trim($form_state['values']['teaser_js']) ."\r\n<!--break-->\r\n". trim($form_state['values']['body']); + $body = trim($form_state['values']['teaser_js']) . "\r\n<!--break-->\r\n" . trim($form_state['values']['body']); } else { // Empty teaser, no spaces. - $body = '<!--break-->'. $form_state['values']['body']; + $body = '<!--break-->' . $form_state['values']['body']; } // Pass updated body value on to preview/submit form processing. form_set_value($form['body'], $body, $form_state); @@ -649,7 +649,7 @@ function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) { if ($module == 'node') { $module = 'node_content'; // Avoid function name collisions. } - $function = $module .'_'. $hook; + $function = $module . '_' . $hook; return ($function($node, $a2, $a3, $a4)); } } @@ -669,7 +669,7 @@ function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) { function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { $return = array(); foreach (module_implements('nodeapi') as $name) { - $function = $name .'_nodeapi'; + $function = $name . '_nodeapi'; $result = $function($node, $op, $a3, $a4); if (isset($result) && is_array($result)) { $return = array_merge($return, $result); @@ -716,7 +716,7 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { elseif (is_array($param)) { // Turn the conditions into a query. foreach ($param as $key => $value) { - $cond[] = 'n.'. db_escape_string($key) ." = '%s'"; + $cond[] = 'n.' . db_escape_string($key) . " = '%s'"; $arguments[] = $value; } $cond = implode(' AND ', $cond); @@ -743,10 +743,10 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { // No db_rewrite_sql is applied so as to get complete indexing for search. if ($revision) { array_unshift($arguments, $revision); - $node = db_fetch_object(db_query('SELECT '. $fields .' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments)); + $node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE ' . $cond, $arguments)); } else { - $node = db_fetch_object(db_query('SELECT '. $fields .' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments)); + $node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE ' . $cond, $arguments)); } if ($node && $node->nid) { @@ -1113,7 +1113,7 @@ function node_show($node, $cid, $message = FALSE) { * @ingroup themeable */ function theme_node_log_message($log) { - return '<div class="log"><div class="title">'. t('Log') .':</div>'. $log .'</div>'; + return '<div class="log"><div class="title">' . t('Log') . ':</div>' . $log . '</div>'; } /** @@ -1164,7 +1164,7 @@ function node_search($op = 'search', $keys = NULL) { ); $form['content_ranking']['#theme'] = 'node_search_admin'; $form['content_ranking']['info'] = array( - '#value' => '<em>'. t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') .'</em>' + '#value' => '<em>' . t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') . '</em>' ); $ranking = array('node_rank_relevance' => t('Keyword relevance'), @@ -1200,7 +1200,7 @@ function node_search($op = 'search', $keys = NULL) { $types[] = "n.type = '%s'"; $arguments1[] = $t; } - $conditions1 .= ' AND ('. implode(' OR ', $types) .')'; + $conditions1 .= ' AND (' . implode(' OR ', $types) . ')'; $keys = search_query_insert($keys, 'type'); } @@ -1210,7 +1210,7 @@ function node_search($op = 'search', $keys = NULL) { $categories[] = "tn.tid = %d"; $arguments1[] = $c; } - $conditions1 .= ' AND ('. implode(' OR ', $categories) .')'; + $conditions1 .= ' AND (' . implode(' OR ', $categories) . ')'; $join1 .= ' INNER JOIN {term_node} tn ON n.vid = tn.vid'; $keys = search_query_insert($keys, 'category'); } @@ -1259,10 +1259,10 @@ function node_search($op = 'search', $keys = NULL) { $join2 .= ' LEFT JOIN {node_counter} nc ON nc.nid = i.sid'; $total += $weight; } - $select2 = (count($ranking) ? implode(' + ', $ranking) : 'i.relevance') .' AS score'; + $select2 = (count($ranking) ? implode(' + ', $ranking) : 'i.relevance') . ' AS score'; // Do search - $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join1 .' INNER JOIN {users} u ON n.uid = u.uid', $conditions1 . (empty($where1) ? '' : ' AND '. $where1), $arguments1, $select2, $join2, $arguments2); + $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid ' . $join1 . ' INNER JOIN {users} u ON n.uid = u.uid', $conditions1 . (empty($where1) ? '' : ' AND ' . $where1), $arguments1, $select2, $join2, $arguments2); // Load results $results = array(); @@ -1280,7 +1280,7 @@ function node_search($op = 'search', $keys = NULL) { $extra = node_invoke_nodeapi($node, 'search result'); $results[] = array( - 'link' => url('node/'. $item->sid, array('absolute' => TRUE)), + 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_get_types('name', $node)), 'title' => $node->title, 'user' => theme('username', $node), @@ -1473,7 +1473,7 @@ function node_menu() { ); foreach (node_get_types('types', NULL, TRUE) as $type) { $type_url_str = str_replace('_', '-', $type->type); - $items['node/add/'. $type_url_str] = array( + $items['node/add/' . $type_url_str] = array( 'title' => drupal_ucfirst($type->name), 'title callback' => 'check_plain', 'page callback' => 'node_add', @@ -1483,18 +1483,18 @@ function node_menu() { 'description' => $type->description, 'file' => 'node.pages.inc', ); - $items['admin/content/node-type/'. $type_url_str] = array( + $items['admin/content/node-type/' . $type_url_str] = array( 'title' => $type->name, 'page callback' => 'drupal_get_form', 'page arguments' => array('node_type_form', $type), 'file' => 'content_types.inc', 'type' => MENU_CALLBACK, ); - $items['admin/content/node-type/'. $type_url_str .'/edit'] = array( + $items['admin/content/node-type/' . $type_url_str . '/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['admin/content/node-type/'. $type_url_str .'/delete'] = array( + $items['admin/content/node-type/' . $type_url_str . '/delete'] = array( 'title' => 'Delete', 'page arguments' => array('node_type_delete_confirm', $type), 'file' => 'content_types.inc', @@ -1583,7 +1583,7 @@ function node_page_title($node) { * Implementation of hook_init(). */ function node_init() { - drupal_add_css(drupal_get_path('module', 'node') .'/node.css'); + drupal_add_css(drupal_get_path('module', 'node') . '/node.css'); } function node_last_changed($nid) { @@ -1671,7 +1671,7 @@ function node_feed($nids = FALSE, $channel = array()) { // Allow modules to add additional item fields and/or modify $item $extra = node_invoke_nodeapi($item, 'rss item'); - $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => format_date($item->created, 'custom', 'r')), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false')))); + $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => format_date($item->created, 'custom', 'r')), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false')))); foreach ($extra as $element) { if (isset($element['namespace'])) { $namespaces = array_merge($namespaces, $element['namespace']); @@ -1686,7 +1686,7 @@ function node_feed($nids = FALSE, $channel = array()) { case 'teaser': $item_text = $item->teaser; if (!empty($item->readmore)) { - $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) .'</p>'; + $item_text .= '<p>' . l(t('read more'), 'node/' . $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . '</p>'; } break; case 'title': @@ -1707,7 +1707,7 @@ function node_feed($nids = FALSE, $channel = array()) { $channel = array_merge($channel_defaults, $channel); $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; - $output .= "<rss version=\"". $channel["version"] ."\" xml:base=\"". $base_url ."\" ". drupal_attributes($namespaces) .">\n"; + $output .= "<rss version=\"" . $channel["version"] . "\" xml:base=\"" . $base_url . "\" " . drupal_attributes($namespaces) . ">\n"; $output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']); $output .= "</rss>\n"; @@ -1730,21 +1730,21 @@ function node_page_default() { if ($num_rows) { $feed_url = url('rss.xml', array('absolute' => TRUE)); - drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') .' '. t('RSS')); + drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') . ' ' . t('RSS')); $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); } else { - $default_message = '<h1 class="title">'. t('Welcome to your new Drupal website!') .'</h1>'; - $default_message .= '<p>'. t('Please follow these steps to set up and start using your website:') .'</p>'; + $default_message = '<h1 class="title">' . t('Welcome to your new Drupal website!') . '</h1>'; + $default_message .= '<p>' . t('Please follow these steps to set up and start using your website:') . '</p>'; $default_message .= '<ol>'; - $default_message .= '<li>'. t('<strong>Configure your website</strong> Once logged in, visit the <a href="@admin">administration section</a>, where you can <a href="@config">customize and configure</a> all aspects of your website.', array('@admin' => url('admin'), '@config' => url('admin/settings'))) .'</li>'; - $default_message .= '<li>'. t('<strong>Enable additional functionality</strong> Next, visit the <a href="@modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="@download_modules">Drupal modules download section</a>.', array('@modules' => url('admin/build/modules'), '@download_modules' => 'http://drupal.org/project/modules')) .'</li>'; - $default_message .= '<li>'. t('<strong>Customize your website design</strong> To change the "look and feel" of your website, visit the <a href="@themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="@download_themes">Drupal themes download section</a>.', array('@themes' => url('admin/build/themes'), '@download_themes' => 'http://drupal.org/project/themes')) .'</li>'; - $default_message .= '<li>'. t('<strong>Start posting content</strong> Finally, you can <a href="@content">create content</a> for your website. This message will disappear once you have promoted a post to the front page.', array('@content' => url('node/add'))) .'</li>'; + $default_message .= '<li>' . t('<strong>Configure your website</strong> Once logged in, visit the <a href="@admin">administration section</a>, where you can <a href="@config">customize and configure</a> all aspects of your website.', array('@admin' => url('admin'), '@config' => url('admin/settings'))) . '</li>'; + $default_message .= '<li>' . t('<strong>Enable additional functionality</strong> Next, visit the <a href="@modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="@download_modules">Drupal modules download section</a>.', array('@modules' => url('admin/build/modules'), '@download_modules' => 'http://drupal.org/project/modules')) . '</li>'; + $default_message .= '<li>' . t('<strong>Customize your website design</strong> To change the "look and feel" of your website, visit the <a href="@themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="@download_themes">Drupal themes download section</a>.', array('@themes' => url('admin/build/themes'), '@download_themes' => 'http://drupal.org/project/themes')) . '</li>'; + $default_message .= '<li>' . t('<strong>Start posting content</strong> Finally, you can <a href="@content">create content</a> for your website. This message will disappear once you have promoted a post to the front page.', array('@content' => url('node/add'))) . '</li>'; $default_message .= '</ol>'; - $default_message .= '<p>'. t('For more information, please refer to the <a href="@help">help section</a>, or the <a href="@handbook">online Drupal handbooks</a>. You may also post at the <a href="@forum">Drupal forum</a>, or view the wide range of <a href="@support">other support options</a> available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) .'</p>'; + $default_message .= '<p>' . t('For more information, please refer to the <a href="@help">help section</a>, or the <a href="@handbook">online Drupal handbooks</a>. You may also post at the <a href="@forum">Drupal forum</a>, or view the wide range of <a href="@support">other support options</a> available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) . '</p>'; - $output = '<div id="first-time">'. $default_message .'</div>'; + $output = '<div id="first-time">' . $default_message . '</div>'; } drupal_set_title(''); @@ -1793,7 +1793,7 @@ function _node_index_node($node) { $node = node_build_content($node, FALSE, FALSE); $node->body = drupal_render($node->content); - $text = '<h1>'. check_plain($node->title) .'</h1>'. $node->body; + $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->body; // Fetch extra data normally not visible $extra = node_invoke_nodeapi($node, 'update index'); @@ -1895,17 +1895,17 @@ function node_search_validate($form, &$form_state) { $keys = search_query_insert($keys, 'category', implode(',', $form_state['values']['category'])); } if ($form_state['values']['or'] != '') { - if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_state['values']['or'], $matches)) { - $keys .= ' '. implode(' OR ', $matches[1]); + if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' ' . $form_state['values']['or'], $matches)) { + $keys .= ' ' . implode(' OR ', $matches[1]); } } if ($form_state['values']['negative'] != '') { - if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_state['values']['negative'], $matches)) { - $keys .= ' -'. implode(' -', $matches[1]); + if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' ' . $form_state['values']['negative'], $matches)) { + $keys .= ' -' . implode(' -', $matches[1]); } } if ($form_state['values']['phrase'] != '') { - $keys .= ' "'. str_replace('"', ' ', $form_state['values']['phrase']) .'"'; + $keys .= ' "' . str_replace('"', ' ', $form_state['values']['phrase']) . '"'; } if (!empty($keys)) { form_set_value($form['basic']['inline']['processed_keys'], trim($keys), $form_state); @@ -2014,7 +2014,7 @@ function node_access($op, $node, $account = NULL) { $grants_sql = ''; if (count($grants)) { - $grants_sql = 'AND ('. implode(' OR ', $grants) .')'; + $grants_sql = 'AND (' . implode(' OR ', $grants) . ')'; } $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql AND grant_$op >= 1"; @@ -2047,7 +2047,7 @@ function _node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') { return ''; } - return 'INNER JOIN {node_access} '. $node_access_alias .' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid'; + return 'INNER JOIN {node_access} ' . $node_access_alias . ' ON ' . $node_access_alias . '.nid = ' . $node_alias . '.nid'; } /** @@ -2078,7 +2078,7 @@ function _node_access_where_sql($op = 'view', $node_access_alias = 'na', $accoun $grants_sql = ''; if (count($grants)) { - $grants_sql = 'AND ('. implode(' OR ', $grants) .')'; + $grants_sql = 'AND (' . implode(' OR ', $grants) . ')'; } $sql = "$node_access_alias.grant_$op >= 1 $grants_sql"; @@ -2126,7 +2126,7 @@ function node_access_view_all_nodes() { $grants_sql = ''; if (count($grants)) { - $grants_sql = 'AND ('. implode(' OR ', $grants) .')'; + $grants_sql = 'AND (' . implode(' OR ', $grants) . ')'; } $sql = "SELECT COUNT(*) FROM {node_access} WHERE nid = 0 $grants_sql AND grant_view >= 1"; @@ -2385,17 +2385,17 @@ function node_content_access($op, $node, $account) { $type = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type); if ($op == 'create') { - return user_access('create '. $type .' content', $account); + return user_access('create ' . $type . ' content', $account); } if ($op == 'update') { - if (user_access('edit any '. $type .' content', $account) || (user_access('edit own '. $type .' content', $account) && ($account->uid == $node->uid))) { + if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->uid))) { return TRUE; } } if ($op == 'delete') { - if (user_access('delete any '. $type .' content', $account) || (user_access('delete own '. $type .' content', $account) && ($account->uid == $node->uid))) { + if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->uid))) { return TRUE; } } @@ -2437,7 +2437,7 @@ function node_forms() { $forms = array(); if ($types = node_get_types()) { foreach (array_keys($types) as $type) { - $forms[$type .'_node_form']['callback'] = 'node_form'; + $forms[$type . '_node_form']['callback'] = 'node_form'; } } return $forms; @@ -2705,7 +2705,7 @@ function node_unpublish_by_keyword_action_form($context) { $form['keywords'] = array( '#title' => t('Keywords'), '#type' => 'textarea', - '#description' => t('The post will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc.". Character sequences are case-sensitive.'), + '#description' => t('The post will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc." . Character sequences are case-sensitive.'), '#default_value' => isset($context['keywords']) ? drupal_implode_tags($context['keywords']) : '', ); return $form; diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index dc3e529cb..0f94a4ac2 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -12,7 +12,7 @@ */ function node_page_edit($node) { drupal_set_title($node->title); - return drupal_get_form($node->type .'_node_form', $node); + return drupal_get_form($node->type . '_node_form', $node); } function node_add_page() { @@ -32,8 +32,8 @@ function theme_node_add_list($content) { if ($content) { $output = '<dl class="node-type-list">'; foreach ($content as $item) { - $output .= '<dt>'. l($item['title'], $item['href'], $item['options']) .'</dt>'; - $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>'; + $output .= '<dt>' . l($item['title'], $item['href'], $item['options']) . '</dt>'; + $output .= '<dd>' . filter_xss_admin($item['description']) . '</dd>'; } $output .= '</dl>'; } @@ -55,7 +55,7 @@ function node_add($type) { $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => ''); drupal_set_title(t('Create @name', array('@name' => $types[$type]->name))); - $output = drupal_get_form($type .'_node_form', $node); + $output = drupal_get_form($type . '_node_form', $node); } return $output; @@ -67,7 +67,7 @@ function node_form_validate($form, &$form_state) { function node_object_prepare(&$node) { // Set up default values, if required. - $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); + $node_options = variable_get('node_options_' . $node->type, array('status', 'promote')); // If this is a new node, fill in the default values. if (!isset($node->nid)) { foreach (array('status', 'promote', 'sticky') as $key) { @@ -249,7 +249,7 @@ function node_form(&$form_state, $node) { ); } $form['#validate'][] = 'node_form_validate'; - $form['#theme'] = array($node->type .'_node_form', 'node_form'); + $form['#theme'] = array($node->type . '_node_form', 'node_form'); return $form; } @@ -306,7 +306,7 @@ function node_form_delete_submit($form, &$form_state) { unset($_REQUEST['destination']); } $node = $form['#node']; - $form_state['redirect'] = array('node/'. $node->nid .'/delete', $destination); + $form_state['redirect'] = array('node/' . $node->nid . '/delete', $destination); } @@ -431,9 +431,9 @@ function theme_node_preview($node) { if ($preview_trimmed_version) { drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication.<span class="no-js"> You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.</span>')); - $output .= '<h3>'. t('Preview trimmed version') .'</h3>'; + $output .= '<h3>' . t('Preview trimmed version') . '</h3>'; $output .= node_view(clone $node, 1, FALSE, 0); - $output .= '<h3>'. t('Preview full version') .'</h3>'; + $output .= '<h3>' . t('Preview full version') . '</h3>'; $output .= node_view($node, 0, FALSE, 0); } else { @@ -450,7 +450,7 @@ function node_form_submit($form, &$form_state) { $node = node_form_submit_build_node($form, $form_state); $insert = empty($node->nid); node_save($node); - $node_link = l(t('view'), 'node/'. $node->nid); + $node_link = l(t('view'), 'node/' . $node->nid); $watchdog_args = array('@type' => $node->type, '%title' => $node->title); $t_args = array('@type' => node_get_types('name', $node), '%title' => $node->title); @@ -465,7 +465,7 @@ function node_form_submit($form, &$form_state) { if ($node->nid) { unset($form_state['rebuild']); $form_state['nid'] = $node->nid; - $form_state['redirect'] = 'node/'. $node->nid; + $form_state['redirect'] = 'node/' . $node->nid; } else { // In the unlikely case something went wrong on save, the node will be @@ -499,7 +499,7 @@ function node_delete_confirm(&$form_state, $node) { return confirm_form($form, t('Are you sure you want to delete %title?', array('%title' => $node->title)), - isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid, + isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), t('Cancel') @@ -542,13 +542,13 @@ function node_revision_overview($node) { if ($revision->current_vid > 0) { $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid"), '!username' => theme('username', $revision))) - . (($revision->log != '') ? '<p class="revision-log">'. filter_xss($revision->log) .'</p>' : ''), + . (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''), 'class' => 'revision-current'); $operations[] = array('data' => theme('placeholder', t('current revision')), 'class' => 'revision-current', 'colspan' => 2); } else { $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', $revision))) - . (($revision->log != '') ? '<p class="revision-log">'. filter_xss($revision->log) .'</p>' : ''); + . (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''); if ($revert_permission) { $operations[] = l(t('revert'), "node/$node->nid/revisions/$revision->vid/revert"); } @@ -567,7 +567,7 @@ function node_revision_overview($node) { */ function node_revision_revert_confirm($form_state, $node_revision) { $form['#node_revision'] = $node_revision; - return confirm_form($form, t('Are you sure you want to revert to the revision from %revision-date?', array('%revision-date' => format_date($node_revision->revision_timestamp))), 'node/'. $node_revision->nid .'/revisions', '', t('Revert'), t('Cancel')); + return confirm_form($form, t('Are you sure you want to revert to the revision from %revision-date?', array('%revision-date' => format_date($node_revision->revision_timestamp))), 'node/' . $node_revision->nid . '/revisions', '', t('Revert'), t('Cancel')); } function node_revision_revert_confirm_submit($form, &$form_state) { @@ -582,12 +582,12 @@ function node_revision_revert_confirm_submit($form, &$form_state) { watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid)); drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_get_types('name', $node_revision), '%title' => $node_revision->title, '%revision-date' => format_date($node_revision->revision_timestamp)))); - $form_state['redirect'] = 'node/'. $node_revision->nid .'/revisions'; + $form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions'; } function node_revision_delete_confirm($form_state, $node_revision) { $form['#node_revision'] = $node_revision; - return confirm_form($form, t('Are you sure you want to delete the revision from %revision-date?', array('%revision-date' => format_date($node_revision->revision_timestamp))), 'node/'. $node_revision->nid .'/revisions', t('This action cannot be undone.'), t('Delete'), t('Cancel')); + return confirm_form($form, t('Are you sure you want to delete the revision from %revision-date?', array('%revision-date' => format_date($node_revision->revision_timestamp))), 'node/' . $node_revision->nid . '/revisions', t('This action cannot be undone.'), t('Delete'), t('Cancel')); } function node_revision_delete_confirm_submit($form, &$form_state) { @@ -596,7 +596,7 @@ function node_revision_delete_confirm_submit($form, &$form_state) { node_invoke_nodeapi($node_revision, 'delete revision'); watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid)); drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_get_types('name', $node_revision), '%title' => $node_revision->title))); - $form_state['redirect'] = 'node/'. $node_revision->nid; + $form_state['redirect'] = 'node/' . $node_revision->nid; if (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', $node_revision->nid)) > 1) { $form_state['redirect'] .= '/revisions'; } |