diff --git a/core/modules/comment/comment-node-form.js b/core/modules/comment/comment-node-form.js index 76db240..1d75e0d 100644 --- a/core/modules/comment/comment-node-form.js +++ b/core/modules/comment/comment-node-form.js @@ -1,3 +1,7 @@ +/** + * @file + * Attach behaviors to the node form. + */ (function ($) { diff --git a/core/modules/comment/comment-wrapper.tpl.php b/core/modules/comment/comment-wrapper.tpl.php index d855631..5e58a67 100644 --- a/core/modules/comment/comment-wrapper.tpl.php +++ b/core/modules/comment/comment-wrapper.tpl.php @@ -2,7 +2,7 @@ /** * @file - * Default theme implementation to provide an HTML container for comments. + * Provides an HTML container for comments. * * Available variables: * - $content: The array of content-related elements for the node. Use diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc index 4f3d350..088f6fe 100644 --- a/core/modules/comment/comment.admin.inc +++ b/core/modules/comment/comment.admin.inc @@ -6,7 +6,15 @@ */ /** - * Menu callback; present an administrative comment listing. + * Page callback: Presents an administrative comment listing. + * + * Path: admin/content/comment + * + * @param $type + * The type of the overview form ('approval' or 'new'). See + * comment_admin_overview() for details. + * + * @see comment_menu() */ function comment_admin($type = 'new') { $edit = $_POST; @@ -20,13 +28,13 @@ function comment_admin($type = 'new') { } /** - * Form builder for the comment overview administration form. + * Form constructor for the comment overview administration form. * * @param $arg - * Current path's fourth component: the type of overview form ('approval' or - * 'new'). + * The type of overview form ('approval' or 'new'). * * @ingroup forms + * @see comment_admin() * @see comment_admin_overview_validate() * @see comment_admin_overview_submit() * @see theme_comment_admin_overview() @@ -140,7 +148,9 @@ function comment_admin_overview($form, &$form_state, $arg) { } /** - * Validate comment_admin_overview form submissions. + * Form validation header for comment_admin_overview(). + * + * @see comment_admin_overview_submit() */ function comment_admin_overview_validate($form, &$form_state) { $form_state['values']['comments'] = array_diff($form_state['values']['comments'], array(0)); @@ -151,10 +161,12 @@ function comment_admin_overview_validate($form, &$form_state) { } /** - * Process comment_admin_overview form submissions. + * Form submission handler for comment_admin_overview(). * - * Execute the chosen 'Update option' on the selected comments, such as + * Executes the chosen 'Update option' on the selected comments, such as * publishing, unpublishing or deleting. + * + * @see comment_admin_overview_validate() */ function comment_admin_overview_submit($form, &$form_state) { $operation = $form_state['values']['operation']; @@ -182,12 +194,8 @@ function comment_admin_overview_submit($form, &$form_state) { } /** - * List the selected comments and verify that the admin wants to delete them. + * Form constructor for the confirmation form for bulk comment deletion. * - * @param $form_state - * An associative array containing the current state of the form. - * @return - * TRUE if the comments should be deleted, FALSE otherwise. * @ingroup forms * @see comment_multiple_delete_confirm_submit() */ @@ -224,7 +232,7 @@ function comment_multiple_delete_confirm($form, &$form_state) { } /** - * Process comment_multiple_delete_confirm form submissions. + * Form submission handler for comment_multiple_delete_confirm(). */ function comment_multiple_delete_confirm_submit($form, &$form_state) { if ($form_state['values']['confirm']) { @@ -238,7 +246,14 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) { } /** - * Page callback for comment deletions. + * Page callback: Shows a confirmation page for comment deletions. + * + * Path: comment/%/delete + * + * @param $cid + * The ID of the comment that is about to be deleted. + * + * @see comment_menu() */ function comment_confirm_delete_page($cid) { if ($comment = comment_load($cid)) { @@ -248,7 +263,10 @@ function comment_confirm_delete_page($cid) { } /** - * Form builder; Builds the confirmation form for deleting a single comment. + * Form constructor the for confirmation form for comment deletion. + * + * @param $comment + * The comment that is about to be deleted. * * @ingroup forms * @see comment_confirm_delete_submit() @@ -268,7 +286,7 @@ function comment_confirm_delete($form, &$form_state, $comment) { } /** - * Process comment_confirm_delete form submissions. + * Form submission handler for comment_confirm_delete(). */ function comment_confirm_delete_submit($form, &$form_state) { $comment = $form['#comment']; diff --git a/core/modules/comment/comment.api.php b/core/modules/comment/comment.api.php index 0591265..8e5b18f 100644 --- a/core/modules/comment/comment.api.php +++ b/core/modules/comment/comment.api.php @@ -11,9 +11,10 @@ */ /** - * The comment passed validation and is about to be saved. + * Act on a comment being inserted or updated. * - * Modules may make changes to the comment before it is saved to the database. + * This hook is invoked from comment_save() before the comment is saved to the + * database. * * @param $comment * The comment object. @@ -24,7 +25,7 @@ function hook_comment_presave($comment) { } /** - * The comment is being inserted. + * Respond to creation of a new comment. * * @param $comment * The comment object. @@ -35,7 +36,7 @@ function hook_comment_insert($comment) { } /** - * The comment is being updated. + * Respond to updates to a comment. * * @param $comment * The comment object. @@ -46,7 +47,7 @@ function hook_comment_update($comment) { } /** - * Comments are being loaded from the database. + * Act on comments being loaded from the database. * * @param $comments * An array of comment objects indexed by cid. @@ -59,7 +60,7 @@ function hook_comment_load($comments) { } /** - * The comment is being viewed. This hook can be used to add additional data to the comment before theming. + * Act on a comment that is being assembled before rendering. * * @param $comment * Passes in the comment the action is being performed on. @@ -76,16 +77,16 @@ function hook_comment_view($comment, $view_mode, $langcode) { } /** - * The comment was built; the module may modify the structured content. + * Alter the results of comment_view(). * - * This hook is called after the content has been assembled in a structured array - * and may be used for doing processing which requires that the complete comment - * content structure has been built. + * This hook is called after the content has been assembled in a structured + * array and may be used for doing processing which requires that the complete + * comment content structure has been built. * - * If the module wishes to act on the rendered HTML of the comment rather than the - * structured content array, it may use this hook to add a #post_render callback. - * Alternatively, it could also implement hook_preprocess_comment(). See - * drupal_render() and theme() documentation respectively for details. + * If the module wishes to act on the rendered HTML of the comment rather than + * the structured content array, it may use this hook to add a #post_render + * callback. Alternatively, it could also implement hook_preprocess_comment(). + * See drupal_render() and theme() documentation respectively for details. * * @param $build * A renderable array representing the comment. @@ -105,36 +106,30 @@ function hook_comment_view_alter(&$build) { } /** - * The comment is being published by the moderator. + * Respond to a comment being published by a moderator. * * @param $comment - * Passes in the comment the action is being performed on. - * @return - * Nothing. + * The comment the action is being performed on. */ function hook_comment_publish($comment) { drupal_set_message(t('Comment: @subject has been published', array('@subject' => $comment->subject))); } /** - * The comment is being unpublished by the moderator. + * Respond to a comment being unpublished by a moderator. * * @param $comment - * Passes in the comment the action is being performed on. - * @return - * Nothing. + * The comment the action is being performed on. */ function hook_comment_unpublish($comment) { drupal_set_message(t('Comment: @subject has been unpublished', array('@subject' => $comment->subject))); } /** - * The comment is being deleted by the moderator. + * Respond to comment deletion. * * @param $comment - * Passes in the comment the action is being performed on. - * @return - * Nothing. + * The comment the action is being performed on. */ function hook_comment_delete($comment) { drupal_set_message(t('Comment: @subject has been deleted', array('@subject' => $comment->subject))); diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 0213808..f7dcf04 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -2,7 +2,7 @@ /** * @file - * Install, update and uninstall functions for the comment module. + * Install, update and uninstall functions for the Comment module. */ /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index ae9278c..62619c6 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -4,7 +4,7 @@ * @file * Enables users to comment on published content. * - * When enabled, the Drupal comment module creates a discussion + * When enabled, the Drupal Comment module creates a discussion * board for each Drupal node. Users can post comments to discuss * a forum topic, story, collaborative book page, etc. */ @@ -140,9 +140,17 @@ function comment_entity_info() { } /** - * Menu loader callback for Field UI paths. + * Menu loader callback: Loads the comment bundle name for Field UI paths. * - * Return a comment bundle name from a node type in the URL. + * @param $name + * The URL-formatted machine name of the node type whose comment fields are + * to be edited. 'URL-formatted' means that underscores are replaced by + * hyphens. + * + * @return + * The comment bundle name corresponding to the node type. + * + * @see comment_menu_alter() */ function comment_node_type_load($name) { if ($type = node_type_get_type(strtr($name, array('-' => '_')))) { @@ -357,6 +365,11 @@ function comment_node_type_delete($info) { /** * Creates a comment_body field instance for a given node type. + * + * @param $info + * An object representing info on the node type. The only property that is + * currently used is $info->type, which is the machine name of the node type + * for which the body field (instance) is to be created. */ function _comment_body_field_create($info) { // Create the field if needed. @@ -472,6 +485,7 @@ function comment_block_view($delta = '') { * * @param $cid * A comment identifier. + * * @return * The comment listing set to the page on which the comment appears. */ @@ -493,7 +507,7 @@ function comment_permalink($cid) { } /** - * Find the most recent comments that are available to the current user. + * Finds the most recent comments that are available to the current user. * * @param integer $number * (optional) The maximum number of comments to find. Defaults to 10. @@ -522,7 +536,7 @@ function comment_get_recent($number = 10) { } /** - * Calculate page number for first new comment. + * Calculates the page number for the first new comment. * * @param $num_comments * Number of comments. @@ -530,6 +544,7 @@ function comment_get_recent($number = 10) { * Number of new replies. * @param $node * The first new comment node. + * * @return * "page=X" if the page number is greater than zero; empty string otherwise. */ @@ -589,7 +604,7 @@ function comment_new_page_count($num_comments, $new_replies, $node) { } /** - * Returns HTML for a list of recent comments to be displayed in the comment block. + * Returns HTML for a list of recent comments. * * @ingroup themeable */ @@ -713,10 +728,14 @@ function comment_node_view($node, $view_mode) { } /** - * Build the comment-related elements for node detail pages. + * Builds the comment-related elements for node detail pages. * * @param $node - * A node object. + * The node object for which to build the comment-related elements. + * + * @return + * A renderable array representing the comment-related page elements for the + * node. */ function comment_node_page_additions($node) { $additions = array(); @@ -755,7 +774,7 @@ function comment_node_page_additions($node) { } /** - * Retrieve comments for a thread. + * Retrieves comments for a thread. * * @param $node * The node whose comment(s) needs rendering. @@ -764,6 +783,9 @@ function comment_node_page_additions($node) { * @param $comments_per_page * The amount of comments to display per page. * + * @return + * An array of comment IDs to be displayed. + * * To display threaded comments in the correct order we keep a 'thread' field * and order by that value. This field keeps this data in * a way which is easy to update and convenient to use. @@ -858,12 +880,10 @@ function comment_get_thread($node, $mode, $comments_per_page) { } /** - * Loop over comment thread, noting indentation level. + * Loops over a comment thread, noting indentation level. * * @param array $comments * An array of comment objects, keyed by cid. - * @return - * The $comments argument is altered by reference with indentation information. */ function comment_prepare_thread(&$comments) { // A flag stating if we are still searching for first new comment on the thread. @@ -901,10 +921,10 @@ function comment_prepare_thread(&$comments) { } /** - * Generate an array for rendering the given comment. + * Generates an array for rendering a comment. * * @param $comment - * A comment object. + * The comment object. * @param $node * The node the comment is attached to. * @param $view_mode @@ -970,8 +990,8 @@ function comment_view($comment, $node, $view_mode = 'full', $langcode = NULL) { /** * Builds a structured array representing the comment's content. * - * The content built for the comment (field values, comments, file attachments or - * other comment components) will vary depending on the $view_mode parameter. + * The content built for the comment (field values, comments, file attachments + * or other comment components) will vary depending on the $view_mode parameter. * * @param $comment * A comment object. @@ -1015,14 +1035,13 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode = } /** - * Helper function, build links for an individual comment. - * - * Adds reply, edit, delete etc. depending on the current user permissions. + * Adds reply, edit, delete etc. links, depending on user permissions. * * @param $comment * The comment object. * @param $node * The node the comment is attached to. + * * @return * A structured array of links. */ @@ -1077,7 +1096,7 @@ function comment_links($comment, $node) { } /** - * Construct a drupal_render() style array from an array of loaded comments. + * Constructs a drupal_render() style array from an array of loaded comments. * * @param $comments * An array of comments as returned by comment_load_multiple(). @@ -1420,6 +1439,7 @@ function comment_user_delete($account) { * recognized now. * @param $comment * The comment object. + * * @return * TRUE if the current user has acces to the comment, FALSE otherwise. */ @@ -1584,20 +1604,20 @@ function comment_save($comment) { } /** - * Delete a comment and all its replies. + * Deletes a comment and all its replies. * * @param $cid - * The comment to delete. + * The ID of the comment to delete. */ function comment_delete($cid) { comment_delete_multiple(array($cid)); } /** - * Delete comments and all their replies. + * Deletes comments and all their replies. * * @param $cids - * The comment to delete. + * The IDs of the comments to delete. */ function comment_delete_multiple($cids) { $comments = comment_load_multiple($cids); @@ -1628,7 +1648,7 @@ function comment_delete_multiple($cids) { } /** - * Load comments from the database. + * Loads comments from the database. * * @param $cids * An array of comment IDs. @@ -1645,17 +1665,17 @@ function comment_delete_multiple($cids) { * @return * An array of comment objects, indexed by comment ID. * + * @todo Remove $conditions in Drupal 8. + * * @see entity_load() * @see EntityFieldQuery - * - * @todo Remove $conditions in Drupal 8. */ function comment_load_multiple($cids = array(), $conditions = array(), $reset = FALSE) { return entity_load('comment', $cids, $conditions, $reset); } /** - * Load the entire comment by cid. + * Loads the entire comment by cid. * * @param $cid * The identifying comment id. @@ -1703,14 +1723,16 @@ class CommentController extends DrupalDefaultEntityController { } /** - * Get number of new comments for current user and specified node. + * Gets number of new comments for current user and specified node. * * @param $nid * Node-id to count comments for. * @param $timestamp * Time to count from (defaults to time of last user access * to node). - * @return The result or FALSE on error. + * + * @return + * The result or FALSE on error. */ function comment_num_new($nid, $timestamp = 0) { global $user; @@ -1736,7 +1758,7 @@ function comment_num_new($nid, $timestamp = 0) { } /** - * Get the display ordinal for a comment, starting from 0. + * Gets the display ordinal for a comment, starting from 0. * * Count the number of comments which appear before the comment we want to * display, taking into account display settings and threading. @@ -1745,8 +1767,10 @@ function comment_num_new($nid, $timestamp = 0) { * The comment ID. * @param $node_type * The node type of the comment's parent. + * * @return * The display ordinal for the comment. + * * @see comment_get_display_page() */ function comment_get_display_ordinal($cid, $node_type) { @@ -1778,7 +1802,7 @@ function comment_get_display_ordinal($cid, $node_type) { } /** - * Return the page number for a comment. + * Returns the page number for a comment. * * Finds the correct page number for a comment taking into account display * and paging settings. @@ -1787,6 +1811,7 @@ function comment_get_display_ordinal($cid, $node_type) { * The comment ID. * @param $node_type * The node type the comment is attached to. + * * @return * The page number. */ @@ -1797,7 +1822,14 @@ function comment_get_display_page($cid, $node_type) { } /** - * Page callback for comment editing. + * Page callback: Displays the comment editing form. + * + * Path: comment/%comment/edit + * + * @param $comment + * The comment object representing the comment to be edited. + * + * @see comment_menu() */ function comment_edit_page($comment) { drupal_set_title(t('Edit comment %comment', array('%comment' => $comment->subject)), PASS_THROUGH); @@ -1817,11 +1849,10 @@ function comment_forms() { } /** - * Generate the basic commenting form, for appending to a node or display on a separate page. + * Form constructor for the basic commenting form. * * @see comment_form_validate() * @see comment_form_submit() - * * @ingroup forms */ function comment_form($form, &$form_state, $comment) { @@ -2032,7 +2063,7 @@ function comment_form($form, &$form_state, $comment) { } /** - * Build a preview from submitted form values. + * Builds a preview from submitted form values. */ function comment_form_build_preview($form, &$form_state) { $comment = comment_form_submit_build_comment($form, $form_state); @@ -2095,7 +2126,9 @@ function comment_preview($comment) { } /** - * Validate comment form submissions. + * Form validation handler for comment_form(). + * + * @see comment_form_submit() */ function comment_form_validate($form, &$form_state) { global $user; @@ -2190,7 +2223,7 @@ function comment_submit($comment) { } /** - * Updates the form state's comment entity by processing this submission's values. + * Updates the comment entity by processing the submission's values. * * This is the default builder function for the comment form. It is called * during the "Save" and "Preview" submit handlers to retrieve the entity to @@ -2199,6 +2232,8 @@ function comment_submit($comment) { * before proceeding to the next step. * * @see comment_form() + * @see comment_form_preview() + * @see comment_form_submit() */ function comment_form_submit_build_comment($form, &$form_state) { $comment = $form_state['comment']; @@ -2208,7 +2243,10 @@ function comment_form_submit_build_comment($form, &$form_state) { } /** - * Process comment form submissions; prepare the comment, store it, and set a redirection target. + * Form submission handler for comment_form(). + * + * @see comment_form_validate() + * @see comment_form_submit_build_comment() */ function comment_form_submit($form, &$form_state) { $node = node_load($form_state['values']['nid']); @@ -2256,7 +2294,7 @@ function comment_form_submit($form, &$form_state) { } /** - * Process variables for comment.tpl.php. + * Processes variables for comment.tpl.php. * * @see comment.tpl.php */ @@ -2364,7 +2402,7 @@ function theme_comment_post_forbidden($variables) { } /** - * Process variables for comment-wrapper.tpl.php. + * Processes variables for comment-wrapper.tpl.php. * * @see comment-wrapper.tpl.php * @see theme_comment_wrapper() @@ -2378,7 +2416,7 @@ function template_preprocess_comment_wrapper(&$variables) { } /** - * Return an array of viewing modes for comment listings. + * Returns an array of viewing modes for comment listings. * * We can't use a global variable array because the locale system * is not initialized yet when the comment module is loaded. @@ -2391,22 +2429,26 @@ function _comment_get_modes() { } /** - * Return an array of "comments per page" settings from which the user - * can choose. + * Returns an array of "comments per page" values that users can select from. */ function _comment_per_page() { return drupal_map_assoc(array(10, 30, 50, 70, 90, 150, 200, 250, 300)); } /** - * Updates the comment statistics for a given node. This should be called any - * time a comment is added, deleted, or updated. + * Updates the comment statistics for a given node. + * + * This function should be called any time a comment is added, deleted, or + * updated. * * The following fields are contained in the node_comment_statistics table. - * - last_comment_timestamp: the timestamp of the last comment for this node or the node create stamp if no comments exist for the node. + * - last_comment_timestamp: the timestamp of the last comment for this node or + * the node create stamp if no comments exist for the node. * - last_comment_name: the name of the anonymous poster for the last comment - * - last_comment_uid: the uid of the poster for the last comment for this node or the node authors uid if no comments exists for the node. - * - comment_count: the total number of approved/published comments on this node. + * - last_comment_uid: the uid of the poster for the last comment for this node + * or the node authors uid if no comments exists for the node. + * - comment_count: the total number of approved/published comments on this + * node. */ function _comment_update_node_statistics($nid) { // Allow bulk updates and inserts to temporarily disable the @@ -2454,7 +2496,7 @@ function _comment_update_node_statistics($nid) { } /** - * Generate sorting code. + * Generates sorting code. * * Consists of a leading character indicating length, followed by N digits * with a numerical value in base 36 (alphadecimal). These codes can be sorted @@ -2474,7 +2516,7 @@ function comment_int_to_alphadecimal($i = 0) { } /** - * Decode sorting code back to an integer. + * Decodes sorting code back to an integer. * * @see comment_int_to_alphadecimal() */ @@ -2483,7 +2525,7 @@ function comment_alphadecimal_to_int($c = '00') { } /** - * Increment a sorting code to the next value. + * Increments a sorting code to the next value. * * @see comment_int_to_alphadecimal() */ @@ -2606,7 +2648,7 @@ function comment_unpublish_by_keyword_action($comment, $context) { } /** - * Form builder; Prepare a form for blacklisted keywords. + * Form constructor for the blacklisted keywords form. * * @ingroup forms * @see comment_unpublish_by_keyword_action() @@ -2624,7 +2666,7 @@ function comment_unpublish_by_keyword_action_form($context) { } /** - * Process comment_unpublish_by_keyword_action_form form submissions. + * Form submission handler for comment_unpublish_by_keyword_action_form(). * * @see comment_unpublish_by_keyword_action() */ diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index 7e88bff..c72ac6e 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -2,11 +2,12 @@ /** * @file - * User page callbacks for the comment module. + * User page callbacks for the Comment module. */ /** - * This function is responsible for generating a comment reply form. + * Form constructor for the comment reply form. + * * There are several cases that have to be handled, including: * - replies to comments * - replies to nodes @@ -18,10 +19,9 @@ * * @param $node * Every comment belongs to a node. This is that node. - * * @param $pid - * Some comments are replies to other comments. In those cases, $pid is the parent - * comment's cid. + * Some comments are replies to other comments. In those cases, $pid is the + * parent comment's cid. * * @return * The rendered parent node or comment plus the new comment form. @@ -99,10 +99,14 @@ function comment_reply($node, $pid = NULL) { } /** - * Menu callback; publish specified comment. + * Page callback: Publishes specified comment. + * + * Path: comment/%/approve * * @param $cid * A comment identifier. + * + * @see comment_menu() */ function comment_approve($cid) { if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], "comment/$cid/approve")) { diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test index 2e96ba3..181c138 100644 --- a/core/modules/comment/comment.test +++ b/core/modules/comment/comment.test @@ -2,7 +2,7 @@ /** * @file - * Tests for comment.module. + * Tests for the Comment module. */ class CommentHelperCase extends DrupalWebTestCase { @@ -19,7 +19,7 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Post comment. + * Posts a comment. * * @param $node * Node to post comment on. @@ -94,9 +94,13 @@ class CommentHelperCase extends DrupalWebTestCase { /** * Checks current page for specified comment. * - * @param object $comment Comment object. - * @param boolean $reply The comment is a reply to another comment. - * @return boolean Comment found. + * @param object $comment + * The comment object. + * @param boolean $reply + * Boolean indicating whether the comment is a reply to another comment. + * + * @return boolean + * Boolean indicating whether the comment was found. */ function commentExists($comment, $reply = FALSE) { if ($comment && is_object($comment)) { @@ -115,7 +119,7 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Delete comment. + * Deletes a comment. * * @param object $comment * Comment to delete. @@ -126,20 +130,20 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Set comment subject setting. + * Sets the value governing whether the subject field should be enabled. * * @param boolean $enabled - * Subject value. + * Boolean specifying whether the subject field should be enabled. */ function setCommentSubject($enabled) { $this->setCommentSettings('comment_subject_field', ($enabled ? '1' : '0'), 'Comment subject ' . ($enabled ? 'enabled' : 'disabled') . '.'); } /** - * Set comment preview setting. + * Sets the value governing the previewing mode for the comment form. * * @param int $mode - * Preview value. + * The preview mode: DRUPAL_DISABLED, DRUPAL_OPTIONAL or DRUPAL_REQUIRED. */ function setCommentPreview($mode) { switch ($mode) { @@ -159,27 +163,30 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Set comment form location setting. + * Sets the value governing whether the comment form is on its own page. * * @param boolean $enabled - * Form value. + * TRUE if the comment form should be displayed on the same page as the + * comments; FALSE if it should be displayed on its own page. */ function setCommentForm($enabled) { $this->setCommentSettings('comment_form_location', ($enabled ? COMMENT_FORM_BELOW : COMMENT_FORM_SEPARATE_PAGE), 'Comment controls ' . ($enabled ? 'enabled' : 'disabled') . '.'); } /** - * Set comment anonymous level setting. + * Sets the value governing restrictions on anonymous comments. * * @param integer $level - * Anonymous level. + * - 0: No contact information allowed. + * - 1: Contact information allowed but not required. + * - 2: Contact information required. */ function setCommentAnonymous($level) { $this->setCommentSettings('comment_anonymous', $level, 'Anonymous commenting set to level ' . $level . '.'); } /** - * Set the default number of comments per page. + * Sets the value specifying the default number of comments per page. * * @param integer $comments * Comments per page value. @@ -189,7 +196,7 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Set comment setting for article content type. + * Sets a comment setting for article content type. * * @param string $name * Name of variable. @@ -204,16 +211,17 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Check for contact info. + * Checks for contact info. * - * @return boolean Contact info is available. + * @return boolean + * Contact info is available. */ function commentContactInfoAvailable() { return preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->drupalGetContent()); } /** - * Perform the specified operation on the specified comment. + * Performs the specified operation on the specified comment. * * @param object $comment * Comment to perform operation on. @@ -238,10 +246,11 @@ class CommentHelperCase extends DrupalWebTestCase { } /** - * Get the comment ID for an unapproved comment. + * Gets the comment ID for an unapproved comment. * * @param string $subject * Comment subject to find. + * * @return integer * Comment id. */ @@ -313,7 +322,7 @@ class CommentInterfaceTest extends CommentHelperCase { } /** - * Test comment interface. + * Tests the comment interface. */ function testCommentInterface() { $langcode = LANGUAGE_NONE; @@ -735,7 +744,7 @@ class CommentInterfaceTest extends CommentHelperCase { } /** - * Asserts that comment links appear according to the passed environment setup. + * Asserts that comment links appear according to the passed environment. * * @param $info * An associative array describing the environment to pass to @@ -831,7 +840,7 @@ class CommentInterfaceTest extends CommentHelperCase { } /** - * Test previewing comments. + * Tests previewing comments. */ class CommentPreviewTest extends CommentHelperCase { public static function getInfo() { @@ -843,7 +852,7 @@ class CommentPreviewTest extends CommentHelperCase { } /** - * Test comment preview. + * Tests comment preview. */ function testCommentPreview() { $langcode = LANGUAGE_NONE; @@ -874,7 +883,7 @@ class CommentPreviewTest extends CommentHelperCase { } /** - * Test comment edit, preview, and save. + * Tests comment edit, preview, and save. */ function testCommentEditPreviewSave() { $langcode = LANGUAGE_NONE; @@ -938,7 +947,9 @@ class CommentPreviewTest extends CommentHelperCase { } } - +/** + * Tests anonymous commenting. + */ class CommentAnonymous extends CommentHelperCase { public static function getInfo() { return array( @@ -954,7 +965,7 @@ class CommentAnonymous extends CommentHelperCase { } /** - * Test anonymous comment functionality. + * Tests anonymous comment functionality. */ function testAnonymous() { $this->drupalLogin($this->admin_user); @@ -1092,7 +1103,7 @@ class CommentAnonymous extends CommentHelperCase { } /** - * Verify pagination of comments. + * Verifies pagination of comments. */ class CommentPagerTest extends CommentHelperCase { @@ -1105,7 +1116,7 @@ class CommentPagerTest extends CommentHelperCase { } /** - * Confirm comment paging works correctly with flat and threaded comments. + * Confirms comment paging works correctly with flat and threaded comments. */ function testCommentPaging() { $this->drupalLogin($this->admin_user); @@ -1178,7 +1189,7 @@ class CommentPagerTest extends CommentHelperCase { } /** - * Test comment ordering and threading. + * Tests comment ordering and threading. */ function testCommentOrderingThreading() { $this->drupalLogin($this->admin_user); @@ -1253,7 +1264,7 @@ class CommentPagerTest extends CommentHelperCase { } /** - * Helper function: assert that the comments are displayed in the correct order. + * Asserts that the comments are displayed in the correct order. * * @param $comments * And array of comments. @@ -1278,7 +1289,7 @@ class CommentPagerTest extends CommentHelperCase { } /** - * Test comment_new_page_count(). + * Tests comment_new_page_count(). */ function testCommentNewPageIndicator() { $this->drupalLogin($this->admin_user); @@ -1425,7 +1436,9 @@ class CommentNodeAccessTest extends CommentHelperCase { $this->assertText($reply_subject); } } - +/** + * Tests comment approval functionality. + */ class CommentApprovalTest extends CommentHelperCase { public static function getInfo() { return array( @@ -1505,7 +1518,7 @@ class CommentApprovalTest extends CommentHelperCase { } /** - * Test comment approval functionality through node interface. + * Tests comment approval functionality through node interface. */ function testApprovalNodeInterface() { // Set anonymous comments to require approval. @@ -1548,7 +1561,7 @@ class CommentApprovalTest extends CommentHelperCase { } /** - * Functional tests for the comment module blocks. + * Tests the comment module blocks. */ class CommentBlockFunctionalTest extends CommentHelperCase { public static function getInfo() { @@ -1560,7 +1573,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase { } /** - * Test the recent comments block. + * Tests the recent comments block. */ function testRecentCommentBlock() { $this->drupalLogin($this->admin_user); @@ -1655,7 +1668,7 @@ class CommentRSSUnitTest extends CommentHelperCase { } /** - * Test comments as part of an RSS feed. + * Tests comments as part of an RSS feed. */ function testCommentRSS() { // Find comment in RSS feed. @@ -1675,7 +1688,7 @@ class CommentRSSUnitTest extends CommentHelperCase { /** - * Test to make sure comment content is rebuilt. + * Tests comment content rebuilding. */ class CommentContentRebuild extends CommentHelperCase { public static function getInfo() { @@ -1687,8 +1700,7 @@ class CommentContentRebuild extends CommentHelperCase { } /** - * Test to ensure that the comment's content array is rebuilt for every - * call to comment_view(). + * Tests the rebuilding of comment's content arrays on calling comment_view(). */ function testCommentRebuild() { // Update the comment settings so preview isn't required. @@ -1715,7 +1727,7 @@ class CommentContentRebuild extends CommentHelperCase { } /** - * Test comment token replacement in strings. + * Tests comment token replacement in strings. */ class CommentTokenReplaceTestCase extends CommentHelperCase { public static function getInfo() { @@ -1815,7 +1827,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase { } /** - * Test actions provided by the comment module. + * Tests actions provided by the comment module. */ class CommentActionsTestCase extends CommentHelperCase { public static function getInfo() { @@ -1827,7 +1839,7 @@ class CommentActionsTestCase extends CommentHelperCase { } /** - * Test comment publish and unpublish actions. + * Tests comment publish and unpublish actions. */ function testCommentPublishUnpublishActions() { $this->drupalLogin($this->web_user); @@ -1861,7 +1873,7 @@ class CommentActionsTestCase extends CommentHelperCase { } /** - * Verify that a watchdog message has been entered. + * Verifies that a watchdog message has been entered. * * @param $watchdog_message * The watchdog message. @@ -1876,7 +1888,7 @@ class CommentActionsTestCase extends CommentHelperCase { } /** - * Helper function: clear the watchdog. + * Clears the watchdog. */ function clearWatchdog() { db_truncate('watchdog')->execute(); @@ -1884,7 +1896,7 @@ class CommentActionsTestCase extends CommentHelperCase { } /** - * Test fields on comments. + * Tests fields on comments. */ class CommentFieldsTest extends CommentHelperCase { public static function getInfo() { @@ -1929,7 +1941,7 @@ class CommentFieldsTest extends CommentHelperCase { } /** - * Test that comment module works when enabled after a content module. + * Tests that comment module works when enabled after a content module. */ function testCommentEnable() { // Create a user to do module administration. @@ -1973,7 +1985,7 @@ class CommentFieldsTest extends CommentHelperCase { } /** - * Test that comment module works correctly with plain text format. + * Tests that comment module works correctly with plain text format. */ function testCommentFormat() { // Disable text processing for comments. diff --git a/core/modules/comment/comment.tpl.php b/core/modules/comment/comment.tpl.php index a483813..d4f0b7c 100644 --- a/core/modules/comment/comment.tpl.php +++ b/core/modules/comment/comment.tpl.php @@ -6,8 +6,8 @@ * * Available variables: * - $author: Comment author. Can be link or plain text. - * - $content: An array of comment items. Use render($content) to print them all, or - * print a subset such as render($content['field_example']). Use + * - $content: An array of comment items. Use render($content) to print them + * all, or print a subset such as render($content['field_example']). Use * hide($content['field_example']) to temporarily suppress the printing of a * given element. * - $created: Formatted date and time for when the comment was created. @@ -27,13 +27,15 @@ * - $title: Linked title. * - $classes: String of classes that can be used to style contextually through * CSS. It can be manipulated through the variable $classes_array from - * preprocess functions. The default values can be one or more of the following: + * preprocess functions. The default values can be one or more of the + * following: * - comment: The current template type, i.e., "theming hook". * - comment-by-anonymous: Comment by an unregistered user. * - comment-by-node-author: Comment by the author of the parent node. * - comment-preview: When previewing a new or edited comment. * The following applies only to viewers who are registered users: - * - comment-unpublished: An unpublished comment visible only to administrators. + * - comment-unpublished: An unpublished comment visible only to + * administrators. * - comment-by-viewer: Comment by the user currently viewing the page. * - comment-new: New comment since last the visit. * - $title_prefix (array): An array containing additional output populated by