Welcome, visitor! Log in
 

Source View: pre_comment_author_url

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN  (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file

Line Code
370       if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
371            $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
372            $comment_author = stripslashes($comment_author);
373            $comment_author = esc_attr($comment_author);
374            $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author;
375       }
376  
377       if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
378            $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
379            $comment_author_email = stripslashes($comment_author_email);
380            $comment_author_email = esc_attr($comment_author_email);
381            $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
382       }
383  
384       if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) {
385            $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]);
386            $comment_author_url = stripslashes($comment_author_url);
387            $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url;
388       }
389  }
390  
391  /**
392   * Validates whether this comment is allowed to be made or not.
393   *
394   * @since 2.0.0
395   * @uses $wpdb
396   * @uses apply_filters() Calls 'pre_comment_approved' hook on the type of comment
397   * @uses do_action() Calls 'check_comment_flood' hook on $comment_author_IP, $comment_author_email, and $comment_date_gmt
398   *
399   * @param array $commentdata Contains information on the comment
400   * @return mixed Signifies the approval status (0|1|'spam')
 
Line Code
917   * @uses apply_filters() Calls 'pre_comment_author_name' hook on comment author's name
918   * @uses apply_filters() Calls 'pre_comment_content' hook on the comment's content
919   * @uses apply_filters() Calls 'pre_comment_user_ip' hook on comment author's IP
920   * @uses apply_filters() Calls 'pre_comment_author_url' hook on comment author's URL
921   * @uses apply_filters() Calls 'pre_comment_author_email' hook on comment author's email address
922   *
923   * @param array $commentdata Contains information on the comment.
924   * @return array Parsed comment information.
925   */
926  function wp_filter_comment($commentdata) {
927       $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
928       $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
929       $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
930       $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);
931       $commentdata['comment_author_IP']    = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
932       $commentdata['comment_author_url']   = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
933       $commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);
934       $commentdata['filtered'] = true;
935       return $commentdata;
936  }
937  
938  /**
939   * Whether comment should be blocked because of comment flood.
940   *
941   * @since 2.1.0
942   *
943   * @param bool $block Whether plugin has already blocked comment.
944   * @param int $time_lastcomment Timestamp for last comment.
945   * @param int $time_newcomment Timestamp for new comment.
946   * @return bool Whether comment should be blocked.
947   */