Plugin Directory

Changeset 1303365

Timestamp:
12/08/2015 11:04:29 PM (9 years ago)
Author:
nickmomrik
Message:

Code standards cleanup and bump to 1.1.

Location:
comment-word-count
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • comment-word-count/trunk/comment-word-count.php

    r155533 r1303365  
    22/*
    33Plugin Name: Comment Word Count
    4 Plugin URI: http://wordpress.org/extend/plugins/comment-word-count/
     4Plugin URI: http/plugins/comment-word-count/
    55Description: Outputs the total number of words in all comments.
    6 Version: 1.02
     6Version: 1.
    77Author: Nick Momrik
    88Author URI: http://nickmomrik.com/
     
    1111function mdv_comment_word_count() {
    1212    global $wpdb;
     13
    1314    $words = $wpdb->get_results("SELECT comment_content FROM $wpdb->comments WHERE comment_approved = '1'");
    14     if ($words) {
    15         foreach ($words as $word) {
    16             $comment = strip_tags($word->comment_content);
    17             $comment = explode(' ', $comment);
    18             $count = count($comment);
     15    if ( $words ) {
     16        $oldcount = 0;
     17        foreach ( $words as $word ) {
     18            $comment = strip_tags( $word->comment_content );
     19            $comment = explode( ' ', $comment );
     20            $count = count( $comment );
    1921            $totalcount = $count + $oldcount;
    2022            $oldcount = $totalcount;
    2123        }
    2224    } else {
    23         $totalcount=0;
     25        $totalcount0;
    2426    }
    25     echo number_format($totalcount);
     27
     28    echo number_format( $totalcount );
    2629}
    27 ?>
  • comment-word-count/trunk/readme.txt

    r248712 r1303365  
    22Contributors: nickmomrik
    33Tags: comments, count, words
    4 Stable tag: trunk
     4Stable tag: 1.1
     5Tested up to: 4.4
    56
    67Outputs the total number of words in all comments.
Note: See TracChangeset for help on using the changeset viewer.