web/wp-content/themes/thematic/library/extensions/comments-extensions.php
changeset 1 0d28b7c10758
equal deleted inserted replaced
0:0d9a58d2c515 1:0d28b7c10758
       
     1 <?php
       
     2 
       
     3 
       
     4 // Located in comments.php
       
     5 // Just before #comments
       
     6 function thematic_abovecomments() {
       
     7     do_action('thematic_abovecomments');
       
     8 }
       
     9 
       
    10 
       
    11 // Located in comments.php
       
    12 // Just before #comments-list
       
    13 function thematic_abovecommentslist() {
       
    14     do_action('thematic_abovecommentslist');
       
    15 }
       
    16 
       
    17 
       
    18 // Located in comments.php
       
    19 // Just after #comments-list
       
    20 function thematic_belowcommentslist() {
       
    21     do_action('thematic_belowcommentslist');
       
    22 }
       
    23 
       
    24 
       
    25 // Located in comments.php
       
    26 // Just before #trackbacks-list
       
    27 function thematic_abovetrackbackslist() {
       
    28     do_action('thematic_abovetrackbackslist');
       
    29 }
       
    30 
       
    31 
       
    32 // Located in comments.php
       
    33 // Just after #trackbacks-list
       
    34 function thematic_belowtrackbackslist() {
       
    35     do_action('thematic_belowtrackbackslist');
       
    36 }
       
    37 
       
    38 
       
    39 // Located in comments.php
       
    40 // Just before the comments form
       
    41 function thematic_abovecommentsform() {
       
    42     do_action('thematic_abovecommentsform');
       
    43 }
       
    44 
       
    45 
       
    46 // Adds the Subscribe to comments button
       
    47 function thematic_show_subscription_checkbox() {
       
    48     if(function_exists('show_subscription_checkbox')) { show_subscription_checkbox(); }
       
    49 }
       
    50 add_action('comment_form', 'thematic_show_subscription_checkbox', 98);
       
    51 
       
    52 
       
    53 // Located in comments.php
       
    54 // Just after the comments form
       
    55 function thematic_belowcommentsform() {
       
    56     do_action('thematic_belowcommentsform');
       
    57 }
       
    58 
       
    59 
       
    60 // Adds the Subscribe without commenting button
       
    61 function thematic_show_manual_subscription_form() {
       
    62     if(function_exists('show_manual_subscription_form')) { show_manual_subscription_form(); }
       
    63 }
       
    64 add_action('thematic_belowcommentsform', 'thematic_show_manual_subscription_form', 5);
       
    65 
       
    66 
       
    67 // Located in comments.php
       
    68 // Just after #comments
       
    69 function thematic_belowcomments() {
       
    70     do_action('thematic_belowcomments');
       
    71 }
       
    72 
       
    73 // Located in comments.php
       
    74 // Creates the standard text for one comment
       
    75 function thematic_singlecomment_text() {
       
    76     $content = __('<span>One</span> Comment', 'thematic');
       
    77     return apply_filters(thematic_singlecomment_text, $content);
       
    78 }
       
    79 
       
    80 // Located in comments.php
       
    81 // Creates the standard text for more than one comment
       
    82 function thematic_multiplecomments_text() {
       
    83     $content = __('<span>%d</span> Comments', 'thematic');
       
    84     return apply_filters(thematic_multiplecomments_text, $content);
       
    85 }
       
    86 
       
    87 // creates the list comments arguments
       
    88 function list_comments_arg() {
       
    89 	$content = 'type=comment&callback=thematic_comments';
       
    90 	return apply_filters('list_comments_arg', $content);
       
    91 }
       
    92 
       
    93 // Located in comments.php
       
    94 // Creates the standard text 'Post a Comment'
       
    95 function thematic_postcomment_text() {
       
    96     $content = __('Post a Comment', 'thematic');
       
    97     return apply_filters(thematic_postcomment_text, $content);
       
    98 }
       
    99 
       
   100 // Located in comments.php
       
   101 // Creates the standard text 'Post a Reply to %s'
       
   102 function thematic_postreply_text() {
       
   103     $content = __('Post a Reply to %s', 'thematic');
       
   104     return apply_filters(thematic_postreply_text, $content);
       
   105 }
       
   106 
       
   107 // Located in comments.php
       
   108 // Creates the standard text 'Comment' for the text box
       
   109 function thematic_commentbox_text() {
       
   110     $content = __('Comment', 'thematic');
       
   111     return apply_filters(thematic_commentbox_text, $content);
       
   112 }
       
   113 
       
   114 // Located in comments.php
       
   115 // Creates the standard text 'Post Comment' for the send button
       
   116 function thematic_commentbutton_text() {
       
   117     $content = __('Post Comment', 'thematic');
       
   118     return apply_filters(thematic_commentbutton_text, $content);
       
   119 }
       
   120 
       
   121 // Produces an avatar image with the hCard-compliant photo class
       
   122 function thematic_commenter_link() {
       
   123 	$commenter = get_comment_author_link();
       
   124 	if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) {
       
   125 		$commenter = ereg_replace( '(<a[^>]* class=[\'"]?)', '\\1url ' , $commenter );
       
   126 	} else {
       
   127 		$commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter );
       
   128 	}
       
   129 	$avatar_email = get_comment_author_email();
       
   130 	$avatar_size = apply_filters( 'avatar_size', '80' ); // Available filter: avatar_size
       
   131 	$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, $avatar_size ) );
       
   132 	echo $avatar . ' <span class="fn n">' . $commenter . '</span>';
       
   133 } // end thematic_commenter_link
       
   134 
       
   135 
       
   136 // A hook for the standard comments template
       
   137 function thematic_comments_template() {
       
   138 	do_action('thematic_comments_template');
       
   139 } // end thematic_comments
       
   140 
       
   141 
       
   142 	// The standard comments template is injected into thematic_comments_template() by default
       
   143 	function thematic_include_comments() {
       
   144 		comments_template('', true);
       
   145 	} // end thematic_include_comments
       
   146 	
       
   147 	add_action('thematic_comments_template','thematic_include_comments',5);
       
   148 	
       
   149