Plugin Directory

Changeset 3199667


Ignore:
Timestamp:
11/29/2024 10:03:44 PM (16 months ago)
Author:
GregRoss
Message:

Update to version 5.1 from GitHub

Location:
just-writing-statistics
Files:
24 edited
1 copied

Legend:

Unmodified
Added
Removed
  • just-writing-statistics/tags/5.1/admin/class-jws-admin.php

    r3199097 r3199667  
    748748
    749749        $sql_jws_statistics = '';
     750        $frequency_title = '';
    750751
    751752        if (!isset($jws_tab) || $jws_tab == 'top-content') {
     
    796797                ORDER BY post_author ASC";
    797798        } elseif ($jws_tab == 'frequency') {
     799            $tag_join = '';
     800            $tag_where = '';
     801            $cat_join = '';
     802            $cat_where = '';
     803            $author_where = '';
     804            $post_where = '';
     805
     806            // Check to see if we have a specific tag to query against.
     807            if (isset( $_GET['tag'] ) ) {
     808                $tag_obj = get_term_by('id', $_GET['tag'], 'post_tag');
     809
     810                if( $tag_obj !== false ) {
     811                    $tag_id = $tag_obj->term_id;
     812
     813                    $tag_join = $wpdb->prepare(
     814                        "JOIN %i ON (`$table_name_posts`.post_id = %i.object_id)",
     815                        $wpdb->prefix . 'term_relationships',
     816                        $wpdb->prefix . 'term_relationships'
     817                    );
     818                    $tag_where = $wpdb->prepare(
     819                        "AND %i.term_taxonomy_id = %d",
     820                        $wpdb->prefix . 'term_relationships',
     821                        $tag_id
     822                    );
     823                }
     824                $frequency_title = sprintf(__('Word frequency statistics for tag: %s', 'just-writing-statistics'), $tag_obj->name);
     825            }
     826
     827            // Check to see if we have a specific category to query against.
     828            if (isset( $_GET['cat'] ) ) {
     829                $cat_obj = get_term_by('id', $_GET['cat'], 'category');
     830
     831                if( $cat_obj !== false ) {
     832                    $cat_id = $cat_obj->term_id;
     833
     834                    $cat_join = $wpdb->prepare(
     835                        "JOIN %i ON (`$table_name_posts`.post_id = %i.object_id)",
     836                        $wpdb->prefix . 'term_relationships',
     837                        $wpdb->prefix . 'term_relationships'
     838                    );
     839                    $cat_where = $wpdb->prepare(
     840                        "AND %i.term_taxonomy_id = %d",
     841                        $wpdb->prefix . 'term_relationships',
     842                        $cat_id
     843                    );
     844                    $frequency_title = sprintf(__('Word frequency statistics for category: %s', 'just-writing-statistics'), $cat_obj->name);
     845                }
     846            }
     847
     848            // Check to see if we have a specific author to query against.
     849            if (isset( $_GET['author'] ) ) {
     850                $author_obj = get_user_by('login', $_GET['author']);
     851
     852                if( $author_obj !== false ) {
     853                    $author_id = $author_obj->ID;
     854
     855                    $author_where = $wpdb->prepare(
     856                        "AND post_author = %d",
     857                        $author_id
     858                    );
     859                }
     860                $frequency_title = sprintf(__('Word frequency statistics for author: %s', 'just-writing-statistics'), $author_obj->display_name);
     861            }
     862
     863            // Check to see if we have a specific post to query against.
     864            if (isset( $_GET['post'] ) ) {
     865                $post_obj = get_post($_GET['post']);
     866
     867                if( $post_obj !== false ) {
     868                    $post_id = $post_obj->ID;
     869
     870                    $post_where = $wpdb->prepare(
     871                        "AND post_id = %d",
     872                        $post_id
     873                    );
     874                }
     875                $frequency_title = sprintf(__('Word frequency statistics for post:  %s', 'just-writing-statistics'), $post_obj->post_title);
     876            }
     877
    798878            $sql_jws_statistics = "
    799879                SELECT post_word_frequency
    800880                FROM $table_name_posts
    801                 WHERE (post_status = 'publish' OR post_status = 'draft' OR post_status = 'future') $excluded_types_sql";
     881                $tag_join
     882                $cat_join
     883                WHERE (post_status = 'publish' OR post_status = 'draft' OR post_status = 'future') $tag_where $cat_where $author_where $post_where $excluded_types_sql";
    802884        } elseif ($jws_tab == 'word-to-posts') {
    803885            // Set a default word query that should pretty much aways be around.
     
    9751057
    9761058                foreach( $tags as $tag ) {
     1059                    $jws_dataset_tags[$tag->name]['id'] = $tag->term_id;
     1060
    9771061                    if (!isset($jws_dataset_tags[$tag->name][$total->post_type])) {
    9781062                        $jws_dataset_tags[$tag->name][$total->post_type]['published']['posts'] = 0;
     
    10261110
    10271111                foreach( $categories as $category ) {
     1112                    $jws_dataset_categories[$category->name]['id'] = $category->term_id;
     1113
    10281114                    if (!isset($jws_dataset_categories[$category->name][$total->post_type])) {
    10291115                        $jws_dataset_categories[$category->name][$total->post_type]['published']['posts'] = 0;
     
    10771163                if (!isset($jws_dataset_authors[$total->post_author])) {
    10781164                    $jws_dataset_authors[$total->post_author]['display_name'] = get_the_author_meta('display_name', $total->post_author);
     1165                    $jws_dataset_authors[$total->post_author]['id'] = $total->post_author;
     1166                    $jws_dataset_authors[$total->post_author]['login'] = get_the_author_meta('user_login', $total->post_author);;
    10791167                    $jws_dataset_authors[$total->post_author]['total'] = 0;
    10801168                    $jws_dataset_authors[$total->post_author]['items'] = 0;
     
    11121200            );
    11131201        } elseif ($jws_tab == 'frequency') {
    1114             $jws_dataset_word_frequency = [];
     1202            $jws_dataset_word_frequency = array();
     1203            $jws_dataset_word_frequency['words'] = array();
    11151204            $global_word_frequencies = [];
    11161205            $unique_counts = [];
     
    11451234                // Now store the sorted values into the data set.
    11461235                foreach( $count_groupings[$count] as $word => $count) {
    1147                     $jws_dataset_word_frequency[$word] = $count;
    1148                 }
    1149             }
     1236                    $jws_dataset_word_frequency['words'][$word] = $count;
     1237                }
     1238            }
     1239
     1240            $jws_dataset_word_frequency['title'] = $frequency_title;
    11501241        } elseif ($jws_tab == 'word-to-posts') {
    11511242            $jws_dataset_word_to_posts = [];
     
    12951386            echo jws_calculate_word_count_post( $post );
    12961387        }
    1297 
     1388    }
     1389
     1390    /**
     1391     * Add frequency stats to the post action list.
     1392     *
     1393     * @since 5.1.0
     1394     * @param array  $actions The current list of actions in the list.
     1395     * @param object $post    The post object.
     1396     * @return array The new list of actions.
     1397     */
     1398    public function add_frequency_stats_action_link( $actions, $post ) {
     1399        if ( $post instanceof WP_Post && is_array( $actions ) ) {
     1400            $actions[] = '<a href="' . add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'post' => $post->ID ), admin_url('admin.php')) . '">' . __('Frequency Stats', 'just-writing-statistics') . '</a>';
     1401        }
     1402
     1403        return $actions;
    12981404    }
    12991405
  • just-writing-statistics/tags/5.1/admin/partials/jws-statistics-all.php

    r3199097 r3199667  
    183183                            <span class="edit"><?php edit_post_link(__('Edit', 'just-writing-statistics'), '', ' | ', $post['post_id']); ?></span>
    184184                            <span class="trash"><a href="<?php echo get_delete_post_link($post['post_id']); ?>"><?php _e('Trash', 'just-writing-statistics'); ?></a> | </span>
    185                             <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a></span>
     185                            <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a> | </span>
     186                            <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'post' => $post['post_id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
    186187                        </div>
    187188                    </td>
  • just-writing-statistics/tags/5.1/admin/partials/jws-statistics-author.php

    r3116736 r3199667  
    143143                            <?php echo get_avatar($index, 32, 'mysteryman', $author['display_name'], ['class' => 'avatar avatar-32 photo']); ?>
    144144                            <?php echo esc_html( $author['display_name'] ); ?>
     145                            <div class="row-actions">
     146                              <span class='view'><a href="<?php echo add_query_arg(array( 'user_id' => $author['id'] ), admin_url('user-edit.php')); ?>"><?php _e('Edit', 'just-writing-statistics'); ?></a> | </span>
     147                              <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'author' => $author['login'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
     148                            </div>
    145149                        </td>
    146150                        <td><?php echo number_format($author['total']); ?></td>
  • just-writing-statistics/tags/5.1/admin/partials/jws-statistics-category.php

    r2852111 r3199667  
    122122
    123123                        <?php echo '<tr'.($jws_counter_monthly_statistics % 2 == 1 ? '' : " class='alternate'").'>'; ?>
    124                         <td><nobr><?php echo esc_html( $category_name ); ?></td>
     124                        <td>
     125                          <nobr><?php echo esc_html( $category_name ); ?>
     126                          <div class="row-actions">
     127                              <span class='view'><a href="<?php echo add_query_arg(array( 'taxonomy' => 'category', 'tag_ID' => $category['id'], 'post_type' => 'post' ), admin_url('term.php')); ?>"><?php _e('Edit', 'just-writing-statistics'); ?></a> | </span>
     128                              <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'cat' => $category['id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
     129                          </div>
     130                        </td>
    125131                        <td><?php echo number_format($category['total']); ?></td>
    126132                        <?php foreach ($jws_dataset_post_types as $index => $post_type) : ?>
  • just-writing-statistics/tags/5.1/admin/partials/jws-statistics-frequency.php

    r3199097 r3199667  
    1414
    1515?>
     16<?php if( $jws_dataset_word_frequency['title'] !== '' ) { ?>
     17    <div>
     18      <h2>
     19        <?php echo $jws_dataset_word_frequency['title'];?>
     20      </h2>
     21    </div>
     22<?php } ?>
    1623    <div>
    1724        <div class="full jws-chart-container" id="JWSWordCloud">
     
    2734    $table_rows = '';
    2835    $i = 0;
    29     $top_weight = $jws_dataset_word_frequency[array_key_first($jws_dataset_word_frequency)];
     36    $top_weight = 400;
     37    if( array_key_exists( 'words', $jws_dataset_word_frequency) ) {
     38      $first_key = array_key_first($jws_dataset_word_frequency['words']);
     39      if( $first_key != '' ) {
     40        $top_weight = $jws_dataset_word_frequency['words'][$first_key];
     41      }
     42    }
    3043
    31     foreach ($jws_dataset_word_frequency as $word => $frequency) {
     44    foreach ($jws_dataset_word_frequency['words'] as $word => $frequency) {
    3245      $size = round( $frequency / $top_weight * 400 );
    3346      if ($size >= 16) {
     
    107120                <thead>
    108121                <tr>
    109                     <th colspan="3" class="jws_totals_title"><?php printf(__('Word Frequency (%d Unique Words)', 'just-writing-statistics'), count( $jws_dataset_word_frequency)); ?></th>
     122                    <th colspan="3" class="jws_totals_title"><?php printf(__('Word Frequency (%d Unique Words)', 'just-writing-statistics'), count( $jws_dataset_word_frequency['words'])); ?></th>
    110123                </tr>
    111124                <tr>
  • just-writing-statistics/tags/5.1/admin/partials/jws-statistics-tags.php

    r2852111 r3199667  
    122122
    123123                        <?php echo '<tr'.($jws_counter_monthly_statistics % 2 == 1 ? '' : " class='alternate'").'>'; ?>
    124                         <td><nobr><?php echo esc_html( $tag_name ); ?></td>
     124                        <td>
     125                          <nobr><?php echo esc_html( $tag_name ); ?>
     126                          <div class="row-actions">
     127                              <span class='view'><a href="<?php echo add_query_arg(array( 'taxonomy' => 'post_tag', 'tag_ID' => $tag['id'], 'post_type' => 'post' ), admin_url('term.php')); ?>"><?php _e('Edit', 'just-writing-statistics'); ?></a> | </span>
     128                              <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'tag' => $tag['id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
     129                          </div>
     130                        </td>
    125131                        <td><?php echo number_format($tag['total']); ?></td>
    126132                        <?php foreach ($jws_dataset_post_types as $index => $post_type) : ?>
  • just-writing-statistics/tags/5.1/admin/partials/jws-statistics-top.php

    r2852111 r3199667  
    174174                            <span class="edit"><?php edit_post_link(__('Edit', 'just-writing-statistics'), '', ' | ', $post['post_id']); ?></span>
    175175                            <span class="trash"><a href="<?php echo get_delete_post_link($post['post_id']); ?>"><?php _e('Trash', 'just-writing-statistics'); ?></a> | </span>
    176                             <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a></span>
     176                            <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a> | </span>
     177                            <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'post' => $post['post_id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
    177178                        </div>
    178179                    </td>
  • just-writing-statistics/tags/5.1/includes/class-jws-activator.php

    r2842555 r3199667  
    1212 * @author     GregRoss, RedLettuce
    1313 */
    14 class Just_Writing_Statsitics_Activator
     14class Just_Writing_Statistics_Activator
    1515{
    1616    /**
  • just-writing-statistics/tags/5.1/includes/class-jws.php

    r2852111 r3199667  
    177177        }
    178178
     179        $this->loader->add_filter( 'post_row_actions', $plugin_admin, 'add_frequency_stats_action_link', 10, 2 );
     180        $this->loader->add_filter( 'page_row_actions', $plugin_admin, 'add_frequency_stats_action_link', 10, 2 );
    179181    }
    180182
  • just-writing-statistics/tags/5.1/just-writing-statistics.php

    r3199097 r3199667  
    1010 * Plugin URI:  https://toolstack.com/just-writing-statistics
    1111 * Description: Count the words on your WordPress site instantly.
    12  * Version:     5.0
     12 * Version:     5.1
    1313 * Author:      GregRoss
    1414 * Author URI:  https://toolstack.com
     
    2525}
    2626
    27 define('JWS_VERSION', '5.0');
     27define('JWS_VERSION', '5.1');
    2828
    2929function activate_just_writing_statistics()
  • just-writing-statistics/tags/5.1/public/class-jws-public.php

    r3078086 r3199667  
    123123        $option = get_option('jws_reading_time');
    124124
    125         if ($post && is_array( $option) && array_key_exists('insert', $option) && $option['insert'] == 'Y') {
     125        if ($post && is_array($option) && array_key_exists('insert', $option) && $option['insert'] == 'Y') {
    126126
    127127            $reading_time_settings_wpm = (get_option('jws_reading_time')['wpm'] ?: 250);
  • just-writing-statistics/tags/5.1/readme.txt

    r3199097 r3199667  
    44Requires at least: 4.6
    55Tested up to: 6.7.1
    6 Stable tag: 5.0
     6Stable tag: 5.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    110110
    111111== Changelog ==
     112= 5.1 =
     113* Release date: November 29, 2024
     114* Add category, tag, author, and post frequency stats UI.
     115* Fix activation error.
     116
    112117= 5.0 =
    113118* Release date: November 28, 2024
  • just-writing-statistics/trunk/admin/class-jws-admin.php

    r3199097 r3199667  
    748748
    749749        $sql_jws_statistics = '';
     750        $frequency_title = '';
    750751
    751752        if (!isset($jws_tab) || $jws_tab == 'top-content') {
     
    796797                ORDER BY post_author ASC";
    797798        } elseif ($jws_tab == 'frequency') {
     799            $tag_join = '';
     800            $tag_where = '';
     801            $cat_join = '';
     802            $cat_where = '';
     803            $author_where = '';
     804            $post_where = '';
     805
     806            // Check to see if we have a specific tag to query against.
     807            if (isset( $_GET['tag'] ) ) {
     808                $tag_obj = get_term_by('id', $_GET['tag'], 'post_tag');
     809
     810                if( $tag_obj !== false ) {
     811                    $tag_id = $tag_obj->term_id;
     812
     813                    $tag_join = $wpdb->prepare(
     814                        "JOIN %i ON (`$table_name_posts`.post_id = %i.object_id)",
     815                        $wpdb->prefix . 'term_relationships',
     816                        $wpdb->prefix . 'term_relationships'
     817                    );
     818                    $tag_where = $wpdb->prepare(
     819                        "AND %i.term_taxonomy_id = %d",
     820                        $wpdb->prefix . 'term_relationships',
     821                        $tag_id
     822                    );
     823                }
     824                $frequency_title = sprintf(__('Word frequency statistics for tag: %s', 'just-writing-statistics'), $tag_obj->name);
     825            }
     826
     827            // Check to see if we have a specific category to query against.
     828            if (isset( $_GET['cat'] ) ) {
     829                $cat_obj = get_term_by('id', $_GET['cat'], 'category');
     830
     831                if( $cat_obj !== false ) {
     832                    $cat_id = $cat_obj->term_id;
     833
     834                    $cat_join = $wpdb->prepare(
     835                        "JOIN %i ON (`$table_name_posts`.post_id = %i.object_id)",
     836                        $wpdb->prefix . 'term_relationships',
     837                        $wpdb->prefix . 'term_relationships'
     838                    );
     839                    $cat_where = $wpdb->prepare(
     840                        "AND %i.term_taxonomy_id = %d",
     841                        $wpdb->prefix . 'term_relationships',
     842                        $cat_id
     843                    );
     844                    $frequency_title = sprintf(__('Word frequency statistics for category: %s', 'just-writing-statistics'), $cat_obj->name);
     845                }
     846            }
     847
     848            // Check to see if we have a specific author to query against.
     849            if (isset( $_GET['author'] ) ) {
     850                $author_obj = get_user_by('login', $_GET['author']);
     851
     852                if( $author_obj !== false ) {
     853                    $author_id = $author_obj->ID;
     854
     855                    $author_where = $wpdb->prepare(
     856                        "AND post_author = %d",
     857                        $author_id
     858                    );
     859                }
     860                $frequency_title = sprintf(__('Word frequency statistics for author: %s', 'just-writing-statistics'), $author_obj->display_name);
     861            }
     862
     863            // Check to see if we have a specific post to query against.
     864            if (isset( $_GET['post'] ) ) {
     865                $post_obj = get_post($_GET['post']);
     866
     867                if( $post_obj !== false ) {
     868                    $post_id = $post_obj->ID;
     869
     870                    $post_where = $wpdb->prepare(
     871                        "AND post_id = %d",
     872                        $post_id
     873                    );
     874                }
     875                $frequency_title = sprintf(__('Word frequency statistics for post:  %s', 'just-writing-statistics'), $post_obj->post_title);
     876            }
     877
    798878            $sql_jws_statistics = "
    799879                SELECT post_word_frequency
    800880                FROM $table_name_posts
    801                 WHERE (post_status = 'publish' OR post_status = 'draft' OR post_status = 'future') $excluded_types_sql";
     881                $tag_join
     882                $cat_join
     883                WHERE (post_status = 'publish' OR post_status = 'draft' OR post_status = 'future') $tag_where $cat_where $author_where $post_where $excluded_types_sql";
    802884        } elseif ($jws_tab == 'word-to-posts') {
    803885            // Set a default word query that should pretty much aways be around.
     
    9751057
    9761058                foreach( $tags as $tag ) {
     1059                    $jws_dataset_tags[$tag->name]['id'] = $tag->term_id;
     1060
    9771061                    if (!isset($jws_dataset_tags[$tag->name][$total->post_type])) {
    9781062                        $jws_dataset_tags[$tag->name][$total->post_type]['published']['posts'] = 0;
     
    10261110
    10271111                foreach( $categories as $category ) {
     1112                    $jws_dataset_categories[$category->name]['id'] = $category->term_id;
     1113
    10281114                    if (!isset($jws_dataset_categories[$category->name][$total->post_type])) {
    10291115                        $jws_dataset_categories[$category->name][$total->post_type]['published']['posts'] = 0;
     
    10771163                if (!isset($jws_dataset_authors[$total->post_author])) {
    10781164                    $jws_dataset_authors[$total->post_author]['display_name'] = get_the_author_meta('display_name', $total->post_author);
     1165                    $jws_dataset_authors[$total->post_author]['id'] = $total->post_author;
     1166                    $jws_dataset_authors[$total->post_author]['login'] = get_the_author_meta('user_login', $total->post_author);;
    10791167                    $jws_dataset_authors[$total->post_author]['total'] = 0;
    10801168                    $jws_dataset_authors[$total->post_author]['items'] = 0;
     
    11121200            );
    11131201        } elseif ($jws_tab == 'frequency') {
    1114             $jws_dataset_word_frequency = [];
     1202            $jws_dataset_word_frequency = array();
     1203            $jws_dataset_word_frequency['words'] = array();
    11151204            $global_word_frequencies = [];
    11161205            $unique_counts = [];
     
    11451234                // Now store the sorted values into the data set.
    11461235                foreach( $count_groupings[$count] as $word => $count) {
    1147                     $jws_dataset_word_frequency[$word] = $count;
    1148                 }
    1149             }
     1236                    $jws_dataset_word_frequency['words'][$word] = $count;
     1237                }
     1238            }
     1239
     1240            $jws_dataset_word_frequency['title'] = $frequency_title;
    11501241        } elseif ($jws_tab == 'word-to-posts') {
    11511242            $jws_dataset_word_to_posts = [];
     
    12951386            echo jws_calculate_word_count_post( $post );
    12961387        }
    1297 
     1388    }
     1389
     1390    /**
     1391     * Add frequency stats to the post action list.
     1392     *
     1393     * @since 5.1.0
     1394     * @param array  $actions The current list of actions in the list.
     1395     * @param object $post    The post object.
     1396     * @return array The new list of actions.
     1397     */
     1398    public function add_frequency_stats_action_link( $actions, $post ) {
     1399        if ( $post instanceof WP_Post && is_array( $actions ) ) {
     1400            $actions[] = '<a href="' . add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'post' => $post->ID ), admin_url('admin.php')) . '">' . __('Frequency Stats', 'just-writing-statistics') . '</a>';
     1401        }
     1402
     1403        return $actions;
    12981404    }
    12991405
  • just-writing-statistics/trunk/admin/partials/jws-statistics-all.php

    r3199097 r3199667  
    183183                            <span class="edit"><?php edit_post_link(__('Edit', 'just-writing-statistics'), '', ' | ', $post['post_id']); ?></span>
    184184                            <span class="trash"><a href="<?php echo get_delete_post_link($post['post_id']); ?>"><?php _e('Trash', 'just-writing-statistics'); ?></a> | </span>
    185                             <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a></span>
     185                            <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a> | </span>
     186                            <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'post' => $post['post_id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
    186187                        </div>
    187188                    </td>
  • just-writing-statistics/trunk/admin/partials/jws-statistics-author.php

    r3116736 r3199667  
    143143                            <?php echo get_avatar($index, 32, 'mysteryman', $author['display_name'], ['class' => 'avatar avatar-32 photo']); ?>
    144144                            <?php echo esc_html( $author['display_name'] ); ?>
     145                            <div class="row-actions">
     146                              <span class='view'><a href="<?php echo add_query_arg(array( 'user_id' => $author['id'] ), admin_url('user-edit.php')); ?>"><?php _e('Edit', 'just-writing-statistics'); ?></a> | </span>
     147                              <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'author' => $author['login'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
     148                            </div>
    145149                        </td>
    146150                        <td><?php echo number_format($author['total']); ?></td>
  • just-writing-statistics/trunk/admin/partials/jws-statistics-category.php

    r2852111 r3199667  
    122122
    123123                        <?php echo '<tr'.($jws_counter_monthly_statistics % 2 == 1 ? '' : " class='alternate'").'>'; ?>
    124                         <td><nobr><?php echo esc_html( $category_name ); ?></td>
     124                        <td>
     125                          <nobr><?php echo esc_html( $category_name ); ?>
     126                          <div class="row-actions">
     127                              <span class='view'><a href="<?php echo add_query_arg(array( 'taxonomy' => 'category', 'tag_ID' => $category['id'], 'post_type' => 'post' ), admin_url('term.php')); ?>"><?php _e('Edit', 'just-writing-statistics'); ?></a> | </span>
     128                              <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'cat' => $category['id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
     129                          </div>
     130                        </td>
    125131                        <td><?php echo number_format($category['total']); ?></td>
    126132                        <?php foreach ($jws_dataset_post_types as $index => $post_type) : ?>
  • just-writing-statistics/trunk/admin/partials/jws-statistics-frequency.php

    r3199097 r3199667  
    1414
    1515?>
     16<?php if( $jws_dataset_word_frequency['title'] !== '' ) { ?>
     17    <div>
     18      <h2>
     19        <?php echo $jws_dataset_word_frequency['title'];?>
     20      </h2>
     21    </div>
     22<?php } ?>
    1623    <div>
    1724        <div class="full jws-chart-container" id="JWSWordCloud">
     
    2734    $table_rows = '';
    2835    $i = 0;
    29     $top_weight = $jws_dataset_word_frequency[array_key_first($jws_dataset_word_frequency)];
     36    $top_weight = 400;
     37    if( array_key_exists( 'words', $jws_dataset_word_frequency) ) {
     38      $first_key = array_key_first($jws_dataset_word_frequency['words']);
     39      if( $first_key != '' ) {
     40        $top_weight = $jws_dataset_word_frequency['words'][$first_key];
     41      }
     42    }
    3043
    31     foreach ($jws_dataset_word_frequency as $word => $frequency) {
     44    foreach ($jws_dataset_word_frequency['words'] as $word => $frequency) {
    3245      $size = round( $frequency / $top_weight * 400 );
    3346      if ($size >= 16) {
     
    107120                <thead>
    108121                <tr>
    109                     <th colspan="3" class="jws_totals_title"><?php printf(__('Word Frequency (%d Unique Words)', 'just-writing-statistics'), count( $jws_dataset_word_frequency)); ?></th>
     122                    <th colspan="3" class="jws_totals_title"><?php printf(__('Word Frequency (%d Unique Words)', 'just-writing-statistics'), count( $jws_dataset_word_frequency['words'])); ?></th>
    110123                </tr>
    111124                <tr>
  • just-writing-statistics/trunk/admin/partials/jws-statistics-tags.php

    r2852111 r3199667  
    122122
    123123                        <?php echo '<tr'.($jws_counter_monthly_statistics % 2 == 1 ? '' : " class='alternate'").'>'; ?>
    124                         <td><nobr><?php echo esc_html( $tag_name ); ?></td>
     124                        <td>
     125                          <nobr><?php echo esc_html( $tag_name ); ?>
     126                          <div class="row-actions">
     127                              <span class='view'><a href="<?php echo add_query_arg(array( 'taxonomy' => 'post_tag', 'tag_ID' => $tag['id'], 'post_type' => 'post' ), admin_url('term.php')); ?>"><?php _e('Edit', 'just-writing-statistics'); ?></a> | </span>
     128                              <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'tag' => $tag['id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
     129                          </div>
     130                        </td>
    125131                        <td><?php echo number_format($tag['total']); ?></td>
    126132                        <?php foreach ($jws_dataset_post_types as $index => $post_type) : ?>
  • just-writing-statistics/trunk/admin/partials/jws-statistics-top.php

    r2852111 r3199667  
    174174                            <span class="edit"><?php edit_post_link(__('Edit', 'just-writing-statistics'), '', ' | ', $post['post_id']); ?></span>
    175175                            <span class="trash"><a href="<?php echo get_delete_post_link($post['post_id']); ?>"><?php _e('Trash', 'just-writing-statistics'); ?></a> | </span>
    176                             <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a></span>
     176                            <span class='view'><a href="<?php echo esc_attr( $post['permalink'] ); ?>"><?php _e('View', 'just-writing-statistics'); ?></a> | </span>
     177                            <span class="frequency"><a href="<?php echo add_query_arg(array( 'page' => $this->plugin_name, 'tab' => 'frequency', 'post' => $post['post_id'] ), admin_url('admin.php')); ?>"><?php _e('Frequency Stats', 'just-writing-statistics'); ?></a></span>
    177178                        </div>
    178179                    </td>
  • just-writing-statistics/trunk/includes/class-jws-activator.php

    r2842555 r3199667  
    1212 * @author     GregRoss, RedLettuce
    1313 */
    14 class Just_Writing_Statsitics_Activator
     14class Just_Writing_Statistics_Activator
    1515{
    1616    /**
  • just-writing-statistics/trunk/includes/class-jws.php

    r2852111 r3199667  
    177177        }
    178178
     179        $this->loader->add_filter( 'post_row_actions', $plugin_admin, 'add_frequency_stats_action_link', 10, 2 );
     180        $this->loader->add_filter( 'page_row_actions', $plugin_admin, 'add_frequency_stats_action_link', 10, 2 );
    179181    }
    180182
  • just-writing-statistics/trunk/just-writing-statistics.php

    r3199097 r3199667  
    1010 * Plugin URI:  https://toolstack.com/just-writing-statistics
    1111 * Description: Count the words on your WordPress site instantly.
    12  * Version:     5.0
     12 * Version:     5.1
    1313 * Author:      GregRoss
    1414 * Author URI:  https://toolstack.com
     
    2525}
    2626
    27 define('JWS_VERSION', '5.0');
     27define('JWS_VERSION', '5.1');
    2828
    2929function activate_just_writing_statistics()
  • just-writing-statistics/trunk/public/class-jws-public.php

    r3078086 r3199667  
    123123        $option = get_option('jws_reading_time');
    124124
    125         if ($post && is_array( $option) && array_key_exists('insert', $option) && $option['insert'] == 'Y') {
     125        if ($post && is_array($option) && array_key_exists('insert', $option) && $option['insert'] == 'Y') {
    126126
    127127            $reading_time_settings_wpm = (get_option('jws_reading_time')['wpm'] ?: 250);
  • just-writing-statistics/trunk/readme.txt

    r3199097 r3199667  
    44Requires at least: 4.6
    55Tested up to: 6.7.1
    6 Stable tag: 5.0
     6Stable tag: 5.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    110110
    111111== Changelog ==
     112= 5.1 =
     113* Release date: November 29, 2024
     114* Add category, tag, author, and post frequency stats UI.
     115* Fix activation error.
     116
    112117= 5.0 =
    113118* Release date: November 28, 2024
Note: See TracChangeset for help on using the changeset viewer.